On Sat, May 04, 2013 at 09:33:34AM +0930, Alan Modra wrote: > On Fri, May 03, 2013 at 07:10:15PM +0200, Jakub Jelinek wrote: > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, but > > not tested on powerpc32 where it actually caused runtime issues, can > > somebody please try it there? Ok for trunk/4.8? > > /home/amodra/build/gcc-current/./gcc/gcj > -B/home/amodra/build/gcc-current/powerpc-linux/64/libjava/ > -B/home/amodra/build/gcc-current/powerpc-linux/64/libjava/ > -B/home/amodra/build/gcc-current/./gcc/ -B/home/amodra/gnu/powerpc-linux/bin/ > -B/home/amodra/gnu/powerpc-linux/lib/ -isystem > /home/amodra/gnu/powerpc-linux/include -isystem > /home/amodra/gnu/powerpc-linux/sys-include -m64 -fclasspath= > -fbootclasspath=/home/amodra/src/gcc-current/libjava/classpath/lib > --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -m64 > -fsource-filename=/home/amodra/build/gcc-current/powerpc-linux/64/libjava/classpath/lib/classes > -fjni -findirect-dispatch -fno-indirect-classes -c @gnu-CORBA.list -fPIC -o > .libs/gnu-CORBA.o -v -save-temps > > Looks like this is not the only problem. Using the attached patch to > verify section anchor block layout leads me to > > .org .LANCB76+23560 > .type _atable_syms_gnu_CORBA_NamingService_NameValidator, @object > .size _atable_syms_gnu_CORBA_NamingService_NameValidator, 96 > _atable_syms_gnu_CORBA_NamingService_NameValidator: > .quad _Utf42 > .quad _Utf34 > .quad _Utf35 > .quad _Utf3318.82185 > .quad _Utf34 > .quad _Utf170 > .quad _Utf293 > .quad _Utf34 > .quad _Utf170 > .quad 0 > .quad 0 > .quad 0 > .org .LANCB76+23608 > > The difference between .org's is 48, but the actual size 96. The next > _atable in this file shows 48/72.
Ah right, build_decl (in gen_indirect_dispatch_tables (GET_TABLE macro)) calls layout_decl immediately, so when the type changes soon afterwards, while TYPE_SIZE{,_UNIT} is correct, DECL_SIZE{,_UNIT} isn't. Can you try this? Just the relayout_decl call has been added... An alternative would be to create symbols_array_type as an ARRAY_TYPE with just low bound 0 and no upper bound, guess then build_decl wouldn't set a DECL_SIZE for it, or rework the code so that it creates this decl only in emit_symbols_table rather than in gen_indirect_dispatch_tables. But I hope this should work fine too, emit_symbol_table is called very soon in the compilation so nothing should be e.g. creating RTL for the decls at that point. 2013-05-04 Jakub Jelinek <ja...@redhat.com> PR libgcj/57074 * class.c (emit_symbol_table): Use array type of the right size for the_syms_decl and its DECL_INITIAL, instead of symbols_array_type. Set TREE_TYPE (the_syms_decl) to it. (emit_assertion_table): Use array type of the right size for table_decl and its DECL_INITIAL. --- gcc/java/class.c.jj 2013-01-11 09:02:30.000000000 +0100 +++ gcc/java/class.c 2013-05-02 20:38:13.848886817 +0200 @@ -2958,9 +2958,14 @@ emit_symbol_table (tree name, tree the_t null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, null_symbol); - table = build_constructor (symbols_array_type, v); + tree symbols_arr_type + = build_prim_array_type (symbol_type, vec_safe_length (v)); + + table = build_constructor (symbols_arr_type, v); /* Make it the initial value for otable_syms and emit the decl. */ + TREE_TYPE (the_syms_decl) = symbols_arr_type; + relayout_decl (the_syms_decl); DECL_INITIAL (the_syms_decl) = table; DECL_ARTIFICIAL (the_syms_decl) = 1; DECL_IGNORED_P (the_syms_decl) = 1; @@ -3109,12 +3114,15 @@ emit_assertion_table (tree klass) null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, null_entry); + + tree type + = build_prim_array_type (assertion_entry_type, vec_safe_length (v)); - ctor = build_constructor (assertion_table_type, v); + ctor = build_constructor (type, v); table_decl = build_decl (input_location, VAR_DECL, mangled_classname ("_type_assert_", klass), - assertion_table_type); + type); TREE_STATIC (table_decl) = 1; TREE_READONLY (table_decl) = 1; Jakub