[PATCH][RFC] middle-end/46476 - resurrect -Wunreachable-code

Richard Biener rguenther@suse.de
Wed Nov 24 15:59:56 GMT 2021

On November 24, 2021 4:43:45 PM GMT+01:00, Michael Matz <matz@suse.de> wrote:
>> +/* Unreachable code in if (0) block.  */
>> +void baz(int *p)
>> +{
>> +   if (0)
>> +     {
>> +        return;  /* { dg-bogus "not reachable" } */
>Hmm?  Why are you explicitely saying that warning here would be bogus? 

Because I don't think we want to warn here. Such code is common from template instantiation or macro expansion. 


>quite clearly _is_ unreachable, so warning there makes sense.  Maybe you 
>want an XFAILed dg-warning if your current implementation fails to warn, 
>and a further XFAILed dg-bogus on the next line?
>(Or at the very least a comment in the test case that this is actually not 
>what we really want, but rather what current GCCs produce)

More information about the Gcc-patches mailing list