On 06/19/2018 03:37 PM, Jan Hubicka wrote:
>> Hello.
>>
>> ICEs on:
>>
>> $ cat ice.ii
>> #pragma GCC optimize 0
>> int main() {}
>>
>> $ ./xgcc -B. -O2 ice.ii
>> during IPA pass: cp
>> ice.ii:2:13: internal compiler error: Segmentation fault
>>  int main() {}
>>              ^
>> 0xdbb6bf crash_signal
>>      /home/marxin/Programming/gcc/gcc/toplev.c:324
>> 0x7ffff6d8ba6f ???
>>      
>> /usr/src/debug/glibc-2.27-5.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
>> 0x15edd82 ipcp_propagate_stage
>>      /home/marxin/Programming/gcc/gcc/ipa-cp.c:3292
>> 0x15f049a ipcp_driver
>>      /home/marxin/Programming/gcc/gcc/ipa-cp.c:5081
>> 0x15f049a execute
>>      /home/marxin/Programming/gcc/gcc/ipa-cp.c:5172
> 
> I see, it would be cleaner to simply skip !optimize functions in this loop
> (and not try to allocate lattices for them), but that is definitly something
> for followup.

Martin can you please prepare patch for that?

> 
>>>> @@ -1199,7 +1199,8 @@ sem_function::merge (sem_item *alias_item)
>>>>                 "can not create wrapper of stdarg function.\n");
>>>>    }
>>>>        else if (ipa_fn_summaries
>>>> -         && ipa_fn_summaries->get_create (alias)->self_size <= 2)
>>>> +         && ipa_fn_summaries->get (alias) != NULL
>>>> +         && ipa_fn_summaries->get (alias)->self_size <= 2)
>>>
>>> Alias is the target we merge to. In what sictuation it can be unanalyzed?
>>
>> Can't that also ICE for similar reason as IPA CP?
> 
> Hmm, I do not think we should try to merge -O0 functions :)
> But again, if you have testcase that triggers this path, we could
> handle it later.

This is valid:

./xgcc -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/ipa/pr64146.C 
-fipa-icf
during IPA pass: icf
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/ipa/pr64146.C:36:1: internal 
compiler error: Segmentation fault
 }
 ^
0xdbb6bf crash_signal
        /home/marxin/Programming/gcc/gcc/toplev.c:324
0x7ffff6d8ba6f ???
        
/usr/src/debug/glibc-2.27-5.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x162186f ipa_icf::sem_function::merge(ipa_icf::sem_item*)
        /home/marxin/Programming/gcc/gcc/ipa-icf.c:1202
0x161c0b4 ipa_icf::sem_item_optimizer::merge_classes(unsigned int)
        /home/marxin/Programming/gcc/gcc/ipa-icf.c:3562
0x1626756 ipa_icf::sem_item_optimizer::execute()
        /home/marxin/Programming/gcc/gcc/ipa-icf.c:2641
0x1628d76 ipa_icf_driver
        /home/marxin/Programming/gcc/gcc/ipa-icf.c:3726
0x1628d76 ipa_icf::pass_ipa_icf::execute(function*)
        /home/marxin/Programming/gcc/gcc/ipa-icf.c:3773

Looks reasonable to not rely on ipa_fn_summaries here.

> 
> Thanks! Patch is OK with keeping those two hunks after the
> remaining few changes.
> Honza
> 

I'm going to install patch with 2 comments added as you requested.

Martin

Reply via email to