public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/11370] New: -Wunreachable-code gives false complaints
@ 2003-06-29 10:57 debian-gcc at lists dot debian dot org
  2003-06-29 13:39 ` [Bug c/11370] [3.3/3.4 Regression] " pinskia at physics dot uc dot edu
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2003-06-29 10:57 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11370

           Summary: -Wunreachable-code gives false complaints
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-linux
  GCC host triplet: i386-linux
GCC target triplet: i386-linux

[forwarded from http://bugs.debian.org/196600]

rechecked with HEAD.

  Gcc complains that a declaration "will never be executed" for a
code path that executes, as shown below.
If I:
 . remove the exit line
 . change "int ix;" to "int ix = 0;"
or
 . move the declaration to line 2 or after line 3
the complaint go away.

$ cat -n test.c
#include <stdio.h>

int main(int argc, char *argv[]) { /* line 3 */
  if (argc != 1) exit(1);

  {
    int ix;                     /* line 7 */
    ix = printf("hello\n");
    printf("%d\n", ix);
  }

  return 0;
}

$ gcc-3.3 -Wunreachable-code test.c; ./a.out 
test.c: In function `main':
test.c:7: warning: will never be executed
hello
6


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

end of thread, other threads:[~2003-08-09  3:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-29 10:57 [Bug c/11370] New: -Wunreachable-code gives false complaints debian-gcc at lists dot debian dot org
2003-06-29 13:39 ` [Bug c/11370] [3.3/3.4 Regression] " pinskia at physics dot uc dot edu
2003-07-05 16:55 ` roger at eyesopen dot com
2003-07-06 14:32 ` pinskia at physics dot uc dot edu
2003-07-09  1:17 ` cvs-commit at gcc dot gnu dot org
2003-07-10 20:58 ` steven at gcc dot gnu dot org
2003-07-11 14:59 ` [Bug c/11370] [3.3 " pinskia at physics dot uc dot edu
2003-07-11 22:50 ` mmitchel at gcc dot gnu dot org
2003-08-09  3:50 ` [Bug other/11370] " cvs-commit at gcc dot gnu dot org
2003-08-09  3:57 ` 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).