Bug#595404: gcc-4.4: prefers current directory over system paths for #include <foo>
Package: gcc-4.4
Version: 4.4.4-11
Severity: important
gcc in Squeeze prefers header files from the current directory over
those in system paths for #include <foo>:
sascha.silbe@twin:/tmp/sascha_silbe/tmpbox.4Pe8smERA3$ cat > test.c
#include <stdio.h>
#include <locale.h>
int main(int argc, char **argv)
{
printf("%d\n", LC_MESSAGES);
return 0;
}
sascha.silbe@twin:/tmp/sascha_silbe/tmpbox.4Pe8smERA3$ gcc -Wall -o test test.c && ./test
5
sascha.silbe@twin:/tmp/sascha_silbe/tmpbox.4Pe8smERA3$ touch locale.h
sascha.silbe@twin:/tmp/sascha_silbe/tmpbox.4Pe8smERA3$ gcc -Wall -o test test.c && ./test
test.c: In function 'main':
test.c:6: error: 'LC_MESSAGES' undeclared (first use in this function)
test.c:6: error: (Each undeclared identifier is reported only once
test.c:6: error: for each function it appears in.)
sascha.silbe@twin:/tmp/sascha_silbe/tmpbox.4Pe8smERA3$
I would have expected this for #include "locale.h", but not #include <locale.h>.
This breaks at least ion3 (not available in Debian anymore, so I have
to build it locally).
While the C standard seems to avoid defining almost any semantics for
#include <> vs. #include "", the latter is supposed to search in the
"current directory" first, and if nothing is found it should continue
like for #include <>. [1] This rule (and the differentation between
#include "" and #include <>) only makes sense if #include <>
does NOT search the "current directory" first.
For this reason I believe that having the current directory searched
first for #include <> is not only troublesome in practice, but actually
a violation of the standard (but cannot verify the latter because I
don't own a copy of the standard).
[1] http://c-faq.com/cpp/cppsearchpath.html
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages gcc-4.4 depends on:
ii binutils 2.20.1-13 The GNU assembler, linker and bina
ii cpp-4.4 4.4.4-11 The GNU C preprocessor
ii gcc-4.4-base 4.4.4-11 The GNU Compiler Collection (base
ii libc6 2.11.2-3 Embedded GNU C Library: Shared lib
ii libgcc1 1:4.4.4-11 GCC support library
ii libgomp1 4.4.4-11 GCC OpenMP (GOMP) support library
Versions of packages gcc-4.4 recommends:
ii libc6-dev 2.11.2-3 Embedded GNU C Library: Developmen
Versions of packages gcc-4.4 suggests:
ii gcc-4.4-doc 4.4.4.nf1-1 documentation for the GNU compiler
pn gcc-4.4-locales <none> (no description available)
pn gcc-4.4-multilib <none> (no description available)
pn libcloog-ppl0 <none> (no description available)
pn libgcc1-dbg <none> (no description available)
pn libgomp1-dbg <none> (no description available)
pn libmudflap0-4.4-dev <none> (no description available)
pn libmudflap0-dbg <none> (no description available)
pn libppl-c2 <none> (no description available)
pn libppl7 <none> (no description available)
-- no debconf information
Reply to: