Bug#593110: gcc-4.1: -MG suppresses error for missing headers
Package: gcc-4.1
Version: 4.1.1-21
Severity: normal
Tags: upstream
*** Please type your report below this line ***
When using "-MG", gcc doesn't give an error message, neither exits
with nonzero status when included files don't exist, even if not
only preprocessing ("-M"), but also when actually compiling ("-MD").
This can, in extreme cases, lead to miscompilation (if the included
file e.g. redefines existing macros), usually only to surprising
errors (the results of missing declarations from the include file,
without a leading hint to its absence).
% cat foo.c
#include "non-existing-file"
% gcc -MD -MG -c foo.c
% echo $?
0
I report this against gcc-4.1 as newer gcc versions fail completely
with "-MD -MG" (Debian bug #593086). These two issues might be
related.
-- System Information:
Debian Release: 4.0
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.34
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Versions of packages gcc-4.1 depends on:
ii binutils 2.18.1~cvs20080103-7 The GNU assembler, linker and bina
ii cpp-4.1 4.1.1-21 The GNU C preprocessor
ii gcc-4.1-base 4.1.1-21 The GNU Compiler Collection (base
ii libc6 2.3.6.ds1-13 GNU C Library: Shared libraries
ii libgcc1 1:4.2.3-2ubuntu7 GCC support library
ii libssp0 4.1.1-21 GCC stack smashing protection libr
Versions of packages gcc-4.1 recommends:
ii libc6-dev 2.3.6.ds1-13 GNU C Library: Development Librari
pn libmudflap0-dev <none> (no description available)
-- no debconf information
Reply to: