public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dot at dotat dot at" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/35973] New: Incorrect warning: will never be executed Date: Fri, 18 Apr 2008 16:06:00 -0000 [thread overview] Message-ID: <bug-35973-16079@http.gcc.gnu.org/bugzilla/> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2127 bytes --] This bug exists in various forms in multiple versions of gcc: $ cat gccbug.c struct sel { const char *name; unsigned int enabled; }; int selog_on(struct sel *); #define selog_on(sel) \ (sel.enabled == 0 \ ? selog_on(&sel) \ : sel.enabled != 42) void dostuff(int *); void gccbug1(void) { struct sel sel = { "test", 0 }; if(selog_on(sel)) { dostuff(0); } } void gccbug2(void) { struct sel sel = { "test", 0 }; if(selog_on(sel)) { int i; dostuff(&i); } } $ gcc -O -Wunreachable-code -c gccbug.c gccbug.c: In function `gccbug2': gccbug.c:25: warning: will never be executed $ gcc --version gcc --version gcc (GCC) 3.4.4 [FreeBSD] 20050518 $ gcc -O -Wunreachable-code -c gccbug.c gccbug.c: In function âgccbug2â: gccbug.c:24: warning: will never be executed gccbug.c: In function âgccbug1â: gccbug.c:17: warning: will never be executed $ gcc -O -Werror -Wunreachable-code -c gccbug.c cc1: warnings being treated as errors gccbug.c: In function âgccbug2â: gccbug.c:24: warning: will never be executed $ gcc --version gcc (GCC) 4.1.2 20070115 (prerelease) (SUSE Linux) $ gcc -O -Wunreachable-code -c gccbug.c gccbug.c: In function 'gccbug2': gccbug.c:24: warning: will never be executed gccbug.c: In function 'gccbug1': gccbug.c:17: warning: will never be executed $ gcc -O -Werror -Wunreachable-code -c gccbug.c cc1: warnings being treated as errors gccbug.c: In function 'gccbug2': gccbug.c:24: warning: will never be executed $ gcc --version gcc (GCC) 4.2.1 20070719 [FreeBSD] -- Summary: Incorrect warning: will never be executed Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dot at dotat dot at GCC host triplet: i386-undermydesk-freebsd GCC target triplet: i386-undermydesk-freebsd http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35973
next reply other threads:[~2008-04-18 16:06 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-04-18 16:06 dot at dotat dot at [this message] 2008-05-05 5:39 ` [Bug middle-end/35973] " pinskia at gcc dot gnu dot org 2008-05-05 5:41 ` pinskia at gcc dot gnu dot org 2008-05-05 14:53 ` dot at dotat dot at 2008-12-28 6:14 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-35973-16079@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).