[patch java]: Intialize va_list_type_node to avoid segfault for x86_64 targets in respect for alignment

Kai Tietz ktietz70@googlemail.com
Fri Jan 7 12:26:00 GMT 2011


Hello,

we noticed that java doesn't initialize in decl.c
(java_init_decl_processing) the va_list_type_node. This leads to
issues in some architectures for wrong checks and/or ICE (as for
x86_64 one in i386.c (ix86_local_alignment)).

ChangeLog

2011-01-07  Kai Tietz

        * decl.c (java_init_decl_processing): Setup va_list_type_node.

Tested for i686-pc-cygwin and x86_64-w64-mingw32. Ok for apply?

Regards,
Kai
-------------- next part --------------
Index: gcc/gcc/java/decl.c
===================================================================
--- gcc.orig/gcc/java/decl.c	2010-12-15 14:28:00.000000000 +0100
+++ gcc/gcc/java/decl.c	2011-01-07 12:28:26.951395700 +0100
@@ -1154,6 +1154,19 @@ java_init_decl_processing (void)
     = add_builtin_function ("_Jv_remJ", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
+  /* Initialize va_list_type_node.  */
+  t = targetm.build_builtin_va_list ();
+
+  /* Many back-ends define record types without setting TYPE_NAME.
+     If we copied the record type here, we'd keep the original
+     record type without a name.  This breaks name mangling.  So,
+     don't copy record types and let c_common_nodes_and_builtins()
+     declare the type to be __builtin_va_list.  */
+  if (TREE_CODE (t) != RECORD_TYPE)
+    t = build_variant_type_copy (t);
+
+  va_list_type_node = t;
+
   initialize_builtins ();
 
   soft_fmod_node = built_in_decls[BUILT_IN_FMOD];


More information about the Gcc-patches mailing list