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

login
register
mail settings
Submitter Kai Tietz
Date Jan. 11, 2011, 3:10 p.m.
Message ID <AANLkTinbk2Xmh3ebjifj8MnztsMWoAcrCveA2uGbJPtq@mail.gmail.com>
Download mbox | patch
Permalink /patch/78397/
State New
Headers show

Comments

Kai Tietz - Jan. 11, 2011, 3:10 p.m.
2011/1/11 Kai Tietz <ktietz70@googlemail.com>:
> 2011/1/11 Andreas Schwab <schwab@redhat.com>:
>> Kai Tietz <ktietz70@googlemail.com> writes:
>>
>>> 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 ();
>>
>> That doesn't work.
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> place_field (rli=0x10c8c590, field=0xf7eb15a0) at ../../gcc/stor-layout.c:1132
>> 1132      else if (TREE_CODE (type) == ERROR_MARK)
>> (gdb) bt
>> #0  place_field (rli=0x10c8c590, field=0xf7eb15a0)
>>    at ../../gcc/stor-layout.c:1132
>> #1  0x103e1398 in layout_type (type=0xf7eb1540) at ../../gcc/stor-layout.c:2095
>> #2  layout_type (type=0xf7eb1540) at ../../gcc/stor-layout.c:1849
>> #3  0x105ee484 in rs6000_build_builtin_va_list ()
>>    at ../../gcc/config/rs6000/rs6000.c:9435
>> #4  rs6000_build_builtin_va_list () at ../../gcc/config/rs6000/rs6000.c:9390
>> #5  0x100a8668 in java_init_decl_processing () at ../../gcc/java/decl.c:1158
>> #6  0x100bea78 in java_init () at ../../gcc/java/lang.c:324
>> #7  0x103eb9c4 in lang_dependent_init (argc=1, argv=0xffffe204)
>>    at ../../gcc/toplev.c:1738
>> #8  do_compile (argc=1, argv=0xffffe204) at ../../gcc/toplev.c:1873
>> #9  toplev_main (argc=1, argv=0xffffe204) at ../../gcc/toplev.c:1937
>> #10 0x1008d310 in main (argc=<value optimized out>, argv=<value optimized out>)
>>    at ../../gcc/main.c:36
>>
>> Andreas.
>>
>> --
>> Andreas Schwab, schwab@redhat.com
>> GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
>> "And now for something completely different."
>>
>
> Ok, there is another target using for va_list_type_node record another
> unitialized type-node ... Let me see ...
>

Yes, rs9000 uses here unsigned_char_type_node, which isn't intialized by java.

Following patch should solve your issue:

Ok for apply, if it solves the issue?

Regards,
Kai
Andreas Schwab - Jan. 11, 2011, 3:52 p.m.
Kai Tietz <ktietz70@googlemail.com> writes:

> Following patch should solve your issue:

It doesn't.

Andreas.

Patch

Index: decl.c
===================================================================
--- decl.c      (revision 168662)
+++ decl.c      (working copy)
@@ -1154,6 +1154,7 @@ 
     = add_builtin_function ("_Jv_remJ", t,
                            0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Initialize va_list_type_node.  */
+  unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
   unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE);
   long_integer_type_node = make_signed_type (LONG_TYPE_SIZE);