https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66530

            Bug ID: 66530
           Summary: libstdc++ testsuite links to incorrect shared
                    libstdc++ library
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jy38 at zips dot uakron.edu
  Target Milestone: ---
              Host: x86_64-pc-cygwin
            Target: x86_64-pc-cygwin
             Build: x86_64-pc-cygwin

While running the testsuite for libstdc++, I noticed that the generated test
programs do not appear to be linking to the "correct" libstdc++ shared library
(that is, the libstdc++ that was generated in the build tree). As a result, the
testsuite generates erroneous test results even though I have modified various
files in the local source tree so that it should not.

Here's an excerpt from libstdc++.log containing the command-line used to
generate test program "hexfloat"
(27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc) and its subsequent
failure:

extra_tool_flags are:
 -std=gnu++11
Executing on host: /cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/./gcc/xg++
-shared-libgcc -B/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/./gcc -nostdinc++
-L/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/src/.libs
-L/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/libsupc++/.libs
-B/usr/local/x86_64-pc-cygwin/bin/ -B/usr/local/x86_64-pc-cygwin/lib/ -isystem
/usr/local/x86_64-pc-cygwin/include -isystem
/usr/local/x86_64-pc-cygwin/sys-include
-B/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/./libstdc++-v3/src/.libs
-D_GLIBCXX_ASSERT -fmessage-length=0 -ffunction-sections -fdata-sections -g -O2
-DLOCALEDIR="." -nostdinc++
-I/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/include/x86_64-pc-cygwin
-I/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/include
-I/cygdrive/c/Users/yaoj3/Code/gcc/trunk/libstdc++-v3/libsupc++
-I/cygdrive/c/Users/yaoj3/Code/gcc/trunk/libstdc++-v3/include/backward
-I/cygdrive/c/Users/yaoj3/Code/gcc/trunk/libstdc++-v3/testsuite/util
/cygdrive/c/Users/yaoj3/Code/gcc/trunk/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc
  -std=gnu++11 ./libtestc++.a -Wl,--gc-sections -liconv
-L/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/src/filesystem/.libs
    -o ./hexfloat.exe    (timeout = 600)
spawn /cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/./gcc/xg++ -shared-libgcc
-B/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/./gcc -nostdinc++
-L/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/src
-L/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/src/.libs
-L/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/libsupc++/.libs
-B/usr/local/x86_64-pc-cygwin/bin/ -B/usr/local/x86_64-pc-cygwin/lib/ -isystem
/usr/local/x86_64-pc-cygwin/include -isystem
/usr/local/x86_64-pc-cygwin/sys-include
-B/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/./libstdc++-v3/src/.libs
-D_GLIBCXX_ASSERT -fmessage-length=0 -ffunction-sections -fdata-sections -g -O2
-DLOCALEDIR="." -nostdinc++
-I/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/include/x86_64-pc-cygwin
-I/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/include
-I/cygdrive/c/Users/yaoj3/Code/gcc/trunk/libstdc++-v3/libsupc++
-I/cygdrive/c/Users/yaoj3/Code/gcc/trunk/libstdc++-v3/include/backward
-I/cygdrive/c/Users/yaoj3/Code/gcc/trunk/libstdc++-v3/testsuite/util
/cygdrive/c/Users/yaoj3/Code/gcc/trunk/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc
-std=gnu++11 ./libtestc++.a -Wl,--gc-sections -liconv
-L/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/libstdc++-v3/src/filesystem/.libs
-o ./hexfloat.exe
PASS: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc (test for
excess errors)
Setting LD_LIBRARY_PATH to
:/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/gcc:/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/./libstdc++-v3/src/.libs::/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/gcc:/cygdrive/c/Users/yaoj3/Code/gcc/build/trunk/x86_64-pc-cygwin/./libstdc++-v3/src/.libs
spawn [open ...]
assertion "os && std::stod(os.str()) == d" failed: file
"/cygdrive/c/Users/yaoj3/Code/gcc/trunk/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc",
line 53, function: void test01()
FAIL: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc execution test

I've confirmed that the problem persists even with a separate test program
outside of the testsuite (compiled and run with pretty much the same flags and
LD_LIBRARY_PATH seen above). More tellingly, compiling with an additional
-static-libstdc++ flag causes the problem to vanish entirely, with the test
program exhibiting the desired behavior.

My hypothesis (and please correct me if I'm wrong) is that the libstdc++ that
is being loaded at runtime is the preexisting (unaltered/unpatched) library in
the install tree, rather than the altered/patched library in the build tree. Of
course, I could presumably install the library in order to obtain the expected
test results... however, the behavior that I've described would appear to
violate the GNU Makefile conventions for the "check" target (as described by
the manual for GNU make, which reads: "Perform self-tests (if any). The user
must build the program before running the tests, but need not install the
program; you should write the self-tests so that they work when the program is
built but not installed").

FYI, the output of xg++ -v:

Using built-in specs.
COLLECT_GCC=./gcc/build/trunk/gcc/xg++
Target: x86_64-pc-cygwin
Configured with: ../../trunk/configure --docdir=/usr/local/share/doc/gcc
--htmldir=/usr/local/share/doc/gcc/html -C --build=x86_64-pc-cygwin
--enable-shared --enable-shared-libgcc --enable-static
--enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit
--with-dwarf2 --with-tune=generic --enable-languages=c,c++ --enable-graphite
--enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm
--enable-libquadmath --enable-libquadmath-support --enable-libssp
--disable-libada --disable-libgcj --disable-libgcj-sublibs --disable-java-awt
--disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld
--with-gnu-as --with-cloog-include=/usr/include/cloog-isl
--without-libiconv-prefix --without-libintl-prefix --with-system-zlib
--enable-linker-build-id
Thread model: posix
gcc version 6.0.0 20150610 (experimental) (GCC)

Reply via email to