[PATCH, pretty-ipa] Fix wave ICE in SRA
Richard Guenther
richard.guenther@gmail.com
Fri May 1 20:24:00 GMT 2009
2009/4/30 Martin Jambor <mjambor@suse.cz>:
> Hi,
>
> On Wed, Apr 29, 2009 at 03:05:51PM +0200, Richard Guenther wrote:
>> 2009/4/29 Martin Jambor <mjambor@suse.cz>:
>> > Hi,
>> >
>> > the patch below fixes an ICE on assert in intra-SRA when compiling
>> > boost (this issue is already fixed in the trunk patch).
>> >
>> > The problem is that I wrongly assumed that in an assignment in between
>> > types conforming to useless_type_conversion_p() the sizes of both
>> > sides would be the same. Obviously they need not to be. In fact the
>>
>> Err ...
>>
>> > RHS was substantially bigger in this case, which might confuse
>> > propagating accesses.
>>
>> ... can you share this case? It looks bogus.
>>
>
> I would be glad if that turned out to be indeed bogus.
>
> This happens when compiling the wave boost benchmark from frescobaldi,
> specifically when compiling file instantiate_cpp_exprgrammar.cpp
> (preprocessed source attached), function
>
> phoenix::actor<phoenix::logical_or_composite<phoenix::actor<BaseT>, phoenix::actor<BaseT> > > phoenix::operator||(const phoenix::actor<BaseT>&, const phoenix::actor<BaseT>&) [with BaseT0 = phoenix::closure_member<0, phoenix::closure<boost::wave::grammars::closures::closure_value> >, BaseT1 = phoenix::argument<0>]
>
> I have modified the source to print the statement, its LHS, type of
> the LHS and RHS. The left access size was reported to be 72, the
> right one 128. The result was:
>
> Statement (72, 128):
> # .MEM_9 = VDEF <.MEM_8>
> D.139123.D.105085 = D.139113;
So ...
> LHS:
> <component_ref 0x7f3f3fee0d70
> type <record_type 0x7f3f3c0c5780 logical_or_composite asm_written needs-constructing type_1 type_5 type_6 BLK
> size <integer_cst 0x7f3f41ed6db0 constant 128>
the type size is 128, but get_ref_base_and_extent looks at ...
> unit size <integer_cst 0x7f3f41ed6de0 constant 16>
> align 64 symtab 1007472928 alias set 403 canonical type 0x7f3f3c0c5780
> fields <template_decl 0x7f3f3c0ce3c0 result type <record_type 0x7f3f3c0ce540 result>
> ignored decl_1 VOID file /localhome/jamborm/gcc/test/boost/tmp/boost_1_33_1/boost/spirit/phoenix/operators.hpp line 2146 col 12
> align 1 context <record_type 0x7f3f3c0c5780 logical_or_composite>
> arguments <tree_list 0x7f3f3c0cbc00
> purpose <integer_cst 0x7f3f41ed67e0 constant 1>
> value <tree_vec 0x7f3f3c0cbba0 type <template_decl 0x7f3f3c0ce3c0 result>
>
> elt 0 <tree_list 0x7f3f3c0cbbd0>>> result <type_decl 0x7f3f3c0ce600 result>
> full-name "template<class TupleT> struct phoenix::logical_or_composite<phoenix::actor<phoenix::closure_member<0, phoenix::closure<boost::wave::grammars::closures::closure_value> > >, phoenix::actor<phoenix::argument<0> > >::result"
> chain <field_decl 0x7f3f3c0c9460 a0>> context <namespace_decl 0x7f3f3ded0180 phoenix>
> full-name "struct phoenix::logical_or_composite<phoenix::actor<phoenix::closure_member<0, phoenix::closure<boost::wave::grammars::closures::closure_value> > >, phoenix::actor<phoenix::argument<0> > >"
> needs-constructor X(constX&) this=(X&) n_parents=0 use_template=1 interface-unknown
> pointer_to_this <pointer_type 0x7f3f3c0ce840> reference_to_this <reference_type 0x7f3f3c0e93c0> chain <type_decl 0x7f3f3c0c5840 logical_or_composite>>
>
> arg 0 <var_decl 0x7f3f3cda70a0 D.139123
> type <record_type 0x7f3f3c0c5900 actor asm_written needs-constructing type_1 type_5 type_6 BLK size <integer_cst 0x7f3f41ed6db0 128> unit size <integer_cst 0x7f3f41ed6de0 16>
> align 64 symtab 1007476576 alias set 402 canonical type 0x7f3f3c0c5900 fields <field_decl 0x7f3f3c0c9aa0 D.105085> context <namespace_decl 0x7f3f3ded0180 phoenix>
> full-name "struct phoenix::actor<phoenix::logical_or_composite<phoenix::actor<phoenix::closure_member<0, phoenix::closure<boost::wave::grammars::closures::closure_value> > >, phoenix::actor<phoenix::argument<0> > > >"
> needs-constructor X() X(constX&) this=(X&) n_parents=1 use_template=1 interface-unknown
> pointer_to_this <pointer_type 0x7f3f3c0d0c00> reference_to_this <reference_type 0x7f3f3c1156c0> chain <type_decl 0x7f3f3c0c59c0 actor>>
> used ignored BLK file /localhome/jamborm/gcc/test/boost/tmp/boost_1_33_1/boost/spirit/phoenix/operators.hpp line 2197 col 16 size <integer_cst 0x7f3f41ed6db0 128> unit size <integer_cst 0x7f3f41ed6de0 16>
> align 64 context <function_decl 0x7f3f3c0bed00 operator||>
> chain <var_decl 0x7f3f3cd9ae60 D.139113 type <record_type 0x7f3f3c0c5780 logical_or_composite>
> used ignored BLK file /localhome/jamborm/gcc/test/boost/tmp/boost_1_33_1/boost/spirit/phoenix/operators.hpp line 2197 col 16 size <integer_cst 0x7f3f41ed6db0 128> unit size <integer_cst 0x7f3f41ed6de0 16>
> align 64 context <function_decl 0x7f3f3c0bed00 operator||>>>
> arg 1 <field_decl 0x7f3f3c0c9aa0 D.105085 type <record_type 0x7f3f3c0c5780 logical_or_composite>
> ignored decl_6 BLK file /localhome/jamborm/gcc/test/boost/tmp/boost_1_33_1/boost/spirit/phoenix/actor.hpp line 129 col 29
> size <integer_cst 0x7f3f3fb1bfc0 constant 72>
... this, the FIELD_DECLs DECL_SIZE which is 72.
> unit size <integer_cst 0x7f3f3fb2a090 constant 9>
> align 64 offset_align 128
> offset <integer_cst 0x7f3f41ed66f0 constant 0>
> bit offset <integer_cst 0x7f3f41efa330 constant 0> context <record_type 0x7f3f3c0c5900 actor>
> chain <type_decl 0x7f3f3c0d0b40 actor type <record_type 0x7f3f3c0c5900 actor>
> external nonlocal suppress-debug decl_4 VOID file /localhome/jamborm/gcc/test/boost/tmp/boost_1_33_1/boost/spirit/phoenix/actor.hpp line 129 col 29
> align 8 context <record_type 0x7f3f3c0c5900 actor>
> >>>
>
>
> LHS op 1 type:
this is the field decls DECL_CONTEXT
> <record_type 0x7ff7c0be0900 actor asm_written needs-constructing type_1 type_5 type_6 BLK
> size <integer_cst 0x7ff7c69f1db0 type <integer_type 0x7ff7c6a050c0 bit_size_type> constant 128>
> unit size <integer_cst 0x7ff7c69f1de0 type <integer_type 0x7ff7c6a05000 long unsigned int> constant 16>
> align 64 symtab -1061253280 alias set 402 canonical type 0x7ff7c0be0900
and here's the full field decl again.
> fields <field_decl 0x7ff7c0be4aa0 D.105085
> type <record_type 0x7ff7c0be0780 logical_or_composite asm_written needs-constructing type_1 type_5 type_6 BLK size <integer_cst 0x7ff7c69f1db0 128> unit size <integer_cst 0x7ff7c69f1de0 16>
type size 128
> align 64 symtab -1061256928 alias set 403 canonical type 0x7ff7c0be0780 fields <template_decl 0x7ff7c0be93c0 result> context <namespace_decl 0x7ff7c29eb180 phoenix>
> full-name "struct phoenix::logical_or_composite<phoenix::actor<phoenix::closure_member<0, phoenix::closure<boost::wave::grammars::closures::closure_value> > >, phoenix::actor<phoenix::argument<0> > >"
> needs-constructor X(constX&) this=(X&) n_parents=0 use_template=1 interface-unknown
> pointer_to_this <pointer_type 0x7ff7c0be9840> reference_to_this <reference_type 0x7ff7c0c043c0> chain <type_decl 0x7ff7c0be0840 logical_or_composite>>
> ignored decl_6 BLK file /localhome/jamborm/gcc/test/boost/tmp/boost_1_33_1/boost/spirit/phoenix/actor.hpp line 129 col 29
> size <integer_cst 0x7ff7c4636fc0 constant 72>
decl size 72
odd and bogus(?). Does one maybe include padding and the other not?
> unit size <integer_cst 0x7ff7c4645090 constant 9>
> align 64 offset_align 128
> offset <integer_cst 0x7ff7c69f16f0 constant 0>
> bit offset <integer_cst 0x7ff7c6a15330 constant 0> context <record_type 0x7ff7c0be0900 actor>
> chain <type_decl 0x7ff7c0bebb40 actor type <record_type 0x7ff7c0be0900 actor>
> external nonlocal suppress-debug decl_4 VOID file /localhome/jamborm/gcc/test/boost/tmp/boost_1_33_1/boost/spirit/phoenix/actor.hpp line 129 col 29
> align 8 context <record_type 0x7ff7c0be0900 actor>
> >> context <namespace_decl 0x7ff7c29eb180 phoenix>
> full-name "struct phoenix::actor<phoenix::logical_or_composite<phoenix::actor<phoenix::closure_member<0, phoenix::closure<boost::wave::grammars::closures::closure_value> > >, phoenix::actor<phoenix::argument<0> > > >"
> needs-constructor X() X(constX&) this=(X&) n_parents=1 use_template=1 interface-unknown
> pointer_to_this <pointer_type 0x7ff7c0bebc00> reference_to_this <reference_type 0x7ff7c0c306c0> chain <type_decl 0x7ff7c0be09c0 actor>>
>
>
>
> RHS:
> <var_decl 0x7f0e4a30be60 D.139113
> type <record_type 0x7f0e49636780 logical_or_composite asm_written needs-constructing type_1 type_5 type_6 BLK
> size <integer_cst 0x7f0e4f447db0 constant 128>
> unit size <integer_cst 0x7f0e4f447de0 constant 16>
> align 64 symtab 1231282464 alias set 403 canonical type 0x7f0e49636780
> fields <template_decl 0x7f0e4963f3c0 result type <record_type 0x7f0e4963f540 result>
> ignored decl_1 VOID file /localhome/jamborm/gcc/test/boost/tmp/boost_1_33_1/boost/spirit/phoenix/operators.hpp line 2146 col 12
> align 1 context <record_type 0x7f0e49636780 logical_or_composite>
> arguments <tree_list 0x7f0e4963cc00
> purpose <integer_cst 0x7f0e4f4477e0 constant 1>
> value <tree_vec 0x7f0e4963cba0 type <template_decl 0x7f0e4963f3c0 result>
> elt 0 <tree_list 0x7f0e4963cbd0>>> result <type_decl 0x7f0e4963f600 result>
> full-name "template<class TupleT> struct phoenix::logical_or_composite<phoenix::actor<phoenix::closure_member<0, phoenix::closure<boost::wave::grammars::closures::closure_value> > >, phoenix::actor<phoenix::argument<0> > >::result"
> chain <field_decl 0x7f0e4963a460 a0>> context <namespace_decl 0x7f0e4b441180 phoenix>
> full-name "struct phoenix::logical_or_composite<phoenix::actor<phoenix::closure_member<0, phoenix::closure<boost::wave::grammars::closures::closure_value> > >, phoenix::actor<phoenix::argument<0> > >"
> needs-constructor X(constX&) this=(X&) n_parents=0 use_template=1 interface-unknown
> pointer_to_this <pointer_type 0x7f0e4963f840> reference_to_this <reference_type 0x7f0e4965a3c0> chain <type_decl 0x7f0e49636840 logical_or_composite>>
> used ignored BLK file /localhome/jamborm/gcc/test/boost/tmp/boost_1_33_1/boost/spirit/phoenix/operators.hpp line 2197 col 16 size <integer_cst 0x7f0e4f447db0 128> unit size <integer_cst 0x7f0e4f447de0 16>
> align 64 context <function_decl 0x7f0e4962fd00 operator||>>
>
>
> Note that the size of the declaration size of declaration in arg 1 is
> different from the size of its type (which is also the type of the
> COMPONENT_REF). An that is where get_ref_base_and_extent gets the
> size from (in fact it's even special-cased).
>
> Note that these dumps are from the pretty-ipa branch but I had the
> same problem on the mainline a few days ago so I believe they do not
> differ.
>
> Do you have any idea where this can come from? Or where I should look
> next?
If the above is indeed valid, then get_ref_base_and_extent should IMHO
be changed to be consistent here by simply always looking at the types
size (I wonder why we do not special case for ARRAY_REFs operand 4
if present).
Maybe someone can explain the difference between a field decls
DECL_SIZE and its type TYPE_SIZE?
Thanks,
Richard.
> Thanks a lot for your interest,
>
> Martin
>
More information about the Gcc-patches
mailing list