public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/35973] New: Incorrect warning: will never be executed @ 2008-04-18 16:06 dot at dotat dot at 2008-05-05 5:39 ` [Bug middle-end/35973] " pinskia at gcc dot gnu dot org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: dot at dotat dot at @ 2008-04-18 16:06 UTC (permalink / raw) To: gcc-bugs [-- 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/35973] Incorrect warning: will never be executed 2008-04-18 16:06 [Bug c/35973] New: Incorrect warning: will never be executed dot at dotat dot at @ 2008-05-05 5:39 ` pinskia at gcc dot gnu dot org 2008-05-05 5:41 ` pinskia at gcc dot gnu dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2008-05-05 5:39 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from pinskia at gcc dot gnu dot org 2008-05-05 05:38 ------- The warning looks fine for me, it is saying selog_on(&sel) will never be executed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35973 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/35973] Incorrect warning: will never be executed 2008-04-18 16:06 [Bug c/35973] New: Incorrect warning: will never be executed dot at dotat dot at 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 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2008-05-05 5:41 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from pinskia at gcc dot gnu dot org 2008-05-05 05:40 ------- Sorry I mean: [t.c : 24] D.1191_5 = sel.enabled; [t.c : 24] iftmp.1_6 = D.1191_5 != 42; As far as I can tell this warning is correct. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35973 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/35973] Incorrect warning: will never be executed 2008-04-18 16:06 [Bug c/35973] New: Incorrect warning: will never be executed dot at dotat dot at 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 3 siblings, 0 replies; 5+ messages in thread From: dot at dotat dot at @ 2008-05-05 14:53 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from dot at dotat dot at 2008-05-05 14:52 ------- The code is executed when the function selog_on() returns true. The warning is also inconsistent, which also points to an analysis bug. -- dot at dotat dot at changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dot at dotat dot at Status|RESOLVED |UNCONFIRMED Resolution|INVALID | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35973 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/35973] Incorrect warning: will never be executed 2008-04-18 16:06 [Bug c/35973] New: Incorrect warning: will never be executed dot at dotat dot at ` (2 preceding siblings ...) 2008-05-05 14:53 ` dot at dotat dot at @ 2008-12-28 6:14 ` pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2008-12-28 6:14 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from pinskia at gcc dot gnu dot org 2008-12-28 06:13 ------- This warning depends on optimizations so what you do expect with the inconsistency. So in one case, we decide that i can alias sel which is obviously not true but what do you expect from aliasing. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35973 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-12-28 6:14 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-04-18 16:06 [Bug c/35973] New: Incorrect warning: will never be executed dot at dotat dot at 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
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).