]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: gcc-if: build proper String_Pointer for Get_External_Name
authorAlexandre Oliva <oliva@adacore.com>
Fri, 13 May 2022 10:48:50 +0000 (07:48 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Fri, 13 May 2022 10:48:50 +0000 (07:48 -0300)
The compiler is allowed to assume it can access String bounds, such as
the prefix passed to Get_External_Name, even in circumstances in which
the prefix is not going to be used and has_prefix is false, so, from
the C side, we have to build a proper String_Template for the
String_Pointer.

for  gcc/ada/ChangeLog

* gcc-interface/decl.cc (is_cplusplus_method): Build proper
String for Get_External_Name.

gcc/ada/gcc-interface/decl.cc

index 56ad4998e2286c58fbb0eaf9ac74bc7d9d82e87f..28e1ab7ce8159ae86e7f147b98f26dfbcd21316c 100644 (file)
@@ -4956,7 +4956,8 @@ is_cplusplus_method (Entity_Id gnat_entity)
      'this' parameter is not encoded in the mangled name of a method.  */
   if (Is_Subprogram (gnat_entity) && Present (Interface_Name (gnat_entity)))
     {
-      String_Pointer sp = { NULL, NULL };
+      String_Template temp = { 0, 0 };
+      String_Pointer sp = { "", &temp };
       Get_External_Name (gnat_entity, false, sp);
 
       void *mem;