public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6048: CPLUS_INCLUDE_PATH confused by semicolons
@ 2002-03-24 10:09 neil
0 siblings, 0 replies; 2+ messages in thread
From: neil @ 2002-03-24 10:09 UTC (permalink / raw)
To: cbugel, gcc-bugs, gcc-prs, nobody
Synopsis: CPLUS_INCLUDE_PATH confused by semicolons
State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Sun Mar 24 10:09:33 2002
State-Changed-Why:
This is a "feature" with historical precedent.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6048
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/6048: CPLUS_INCLUDE_PATH confused by semicolons
@ 2002-03-23 5:46 Christoph Bugel
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Bugel @ 2002-03-23 5:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 6048
>Category: c++
>Synopsis: CPLUS_INCLUDE_PATH confused by semicolons
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 23 05:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Christoph Bugel <cbugel@netvision.net.il>
>Release: gcc 3.0.4
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
I have a weird case where a file called 'new',
accidentally left in my current directory, would confuse
g++: #include <string> would load my local 'new' instead
of looking in the system directories first.
This is very confusing to a nonsuspecting user.
Eventually I noticed that CPLUS_INCLUDE_PATH gets
defined in /etc/profile.d/qt.sh. After reading PR 5997,
I suspect that using CPATH would have been a more
sensible choice (should I report this to QT?), but it
still looks like a g++ bug to me:
Most interestingly, I noticed that the bug triggers only
when the path ends with a semicolon:
CPLUS_INCLUDE_PATH=/usr/lib/qt/include = OK
CPLUS_INCLUDE_PATH=/usr/lib/qt/include: = BUG
In the second case the '.' directory is added to the
searchpath, as evident from the g++ -v output below.
$ export CPLUS_INCLUDE_PATH=/usr/lib/qt/include: && g++ -v hw.cc
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/specs
Configured with: ../gcc-3.0.4/configure --prefix=/usr/local --enable-threads --enable-languages=c++,java
Thread model: posix
gcc version 3.0.4
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ hw.cc -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase hw.cc -version -o /tmp/ccnJDaiN.s
GNU CPP version 3.0.4 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.4 (i686-pc-linux-gnu)
compiled by GNU C version 3.0.4.
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/qt/include
.
/usr/local/include/g++-v3
/usr/local/include/g++-v3/i686-pc-linux-gnu
/usr/local/include/g++-v3/backward
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/include
/usr/include
End of search list.
<internal>: In static member function `static std::basic_string<_CharT,
_Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits,
_Alloc>::_Rep::_S_create(unsigned int, const _Alloc&) [with _CharT = char,
_Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/usr/local/include/g++-v3/bits/basic_string.tcc:392: instantiated from `_CharT* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_clone(const _Alloc&, typename _Alloc::size_type) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]'
For comparison: without semicolon it works fine:
$ export CPLUS_INCLUDE_PATH=/usr/lib/qt/include && g++ -v hw.cc
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/specs
Configured with: ../gcc-3.0.4/configure --prefix=/usr/local --enable-threads --enable-languages=c++,java
Thread model: posix
gcc version 3.0.4
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ hw.cc -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase hw.cc -version -o /tmp/ccoFItg7.s
GNU CPP version 3.0.4 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.4 (i686-pc-linux-gnu)
compiled by GNU C version 3.0.4.
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/qt/include
/usr/local/include/g++-v3
/usr/local/include/g++-v3/i686-pc-linux-gnu
/usr/local/include/g++-v3/backward
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/include
/usr/include
End of search list.
as -V -Qy -o /tmp/ccBFKG8H.o /tmp/ccoFItg7.s
GNU assembler version 2.11.90.0.19 (i386-slackware-linux) using BFD version 2.11.90.0.19
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/crtbegin.o -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4 -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/../../.. /tmp/ccBFKG8H.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/crtend.o /usr/lib/crtn.o
>How-To-Repeat:
$ hw.cc:
-------------------------------
#include <string>
#include <iostream>
int main()
{
std::string a = "hello";
std::cout << a << std::endl;
return 0;
}
-------------------------------
$ touch new
$ export CPLUS_INCLUDE_PATH=/usr/lib/qt/include: && g++ -v hw.cc
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-03-24 18:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-24 10:09 c++/6048: CPLUS_INCLUDE_PATH confused by semicolons neil
-- strict thread matches above, loose matches on Subject: below --
2002-03-23 5:46 Christoph Bugel
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).