Bug#200140: gcc-3.3: -Wunreachable-code leads to false alarms
Package: gcc-3.3
Version: 1:3.3.1-0pre0
Severity: minor
Tags: upstream
/* this is foo.c */
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
extern const char *program_name;
static void printf_checked(const char *fmt, ...)
/*@globals fileSystem, stdout, stderr, errno; @*/
/*@modifies fileSystem, *stdout, *stderr, errno; @*/
{
va_list args;
va_start(args, fmt);
if (vfprintf(stdout, fmt, args) < 0) {
perror(program_name);
exit(EXIT_FAILURE);
}
va_end(args);
}
/* this is the end of foo.c */
$ gcc -Wunreachable-code -c foo.c
foo.c: In function `printf_checked':
foo.c:18: warning: will never be executed
This is the va_end statement, which will be executed, whenever the
vfprintf() succeeds. The documentation says that this message can appear
even if some part of the statement will not be executed, but that would
be rather strange here, as va_end() is a builtin.
-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux pc-debian 2.4.21-1-k7 #2 Mon Jun 16 22:23:16 EST 2003 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages gcc-3.3 depends on:
ii binutils 2.14.90.0.4-0.1 The GNU assembler, linker and bina
ii cpp-3.3 1:3.3.1-0pre0 The GNU C preprocessor
ii gcc-3.3-base 1:3.3.1-0pre0 The GNU Compiler Collection (base
ii libc6 2.3.1-17 GNU C Library: Shared libraries an
ii libgcc1 1:3.3.1-0pre0 GCC support library
-- no debconf information
Reply to: