public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Christoph Bugel <cbugel@netvision.net.il> To: gcc-gnats@gcc.gnu.org Subject: c++/6048: CPLUS_INCLUDE_PATH confused by semicolons Date: Sat, 23 Mar 2002 05:46:00 -0000 [thread overview] Message-ID: <20020323134009.29496.qmail@sources.redhat.com> (raw) >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:
next reply other threads:[~2002-03-23 13:46 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-03-23 5:46 Christoph Bugel [this message] 2002-03-24 10:09 neil
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020323134009.29496.qmail@sources.redhat.com \ --to=cbugel@netvision.net.il \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).