public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc warn unreached else {}
@ 2020-07-09  9:45 Jonny Grant
  2020-07-09 15:00 ` Xi Ruoyao
  2020-07-09 16:15 ` Martin Sebor
  0 siblings, 2 replies; 9+ messages in thread
From: Jonny Grant @ 2020-07-09  9:45 UTC (permalink / raw)
  To: gcc-help

Hello!

There is an example below, (my code is not like this example below). I'm reporting a possible issue, and asking if there is a way to detect it in code bases. If it's a real issue I can file a bug report on Bugzilla.

Can gcc warn where code will not get to the 'return 3;' below?

Cheers, Jonny


int main(void)
{
    const int i = 1;
    if(1 == i)
    {
        return 1;
    }
    else if(1 != i)
    {
        return 2;
    }
    else
    {
        return 3;
    }
}


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-07-16  0:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09  9:45 gcc warn unreached else {} Jonny Grant
2020-07-09 15:00 ` Xi Ruoyao
2020-07-09 15:15   ` Jonny Grant
     [not found]     ` <e20bf113efcb7fe3e533ac694aa4bd62519b3654.camel@mengyan1223.wang>
2020-07-09 15:46       ` Xi Ruoyao
2020-07-09 15:46       ` Xi Ruoyao
     [not found]       ` <6d61e32f-3d69-9ac9-0a7e-88daa154c578@jguk.org>
2020-07-10  8:20         ` Xi Ruoyao
2020-07-10 21:50           ` Jonny Grant
2020-07-09 16:15 ` Martin Sebor
2020-07-16  0:20   ` Jonny Grant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).