public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug
@ 2013-08-20 22:28 tammy at Cadence dot COM
  2013-08-20 22:38 ` [Bug tree-optimization/58208] " paolo.carlini at oracle dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: tammy at Cadence dot COM @ 2013-08-20 22:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

            Bug ID: 58208
           Summary: deque<std::string> 32-bit "-O3" bug
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tammy at Cadence dot COM

The following testcase works with gcc473, but crash with gcc481:
$ cat main.C
int main () {}

$ cat qt.C
#include <deque>
#include <string>

std::deque<std::string> l1;

$ cat build.orig
#!/bin/csh -fex

set GCCVER = /home/tammy/gcc481
setenv CXXFLAGS "-fpic -m32 -std=c++11 -O3"

rm -f libqt.so import main.o

${GCCVER}/bin/g++ -c $CXXFLAGS qt.C
${GCCVER}/bin/g++ -m32 -shared -o libqt.so qt.o
${GCCVER}/bin/g++ -c $CXXFLAGS main.C
${GCCVER}/bin/g++ -o import main.o -Wl,-rpath,${GCCVER}/lib -m32 -L. -lqt

$ ./build.orig
set GCCVER = /home/tammy/gcc481
setenv CXXFLAGS -fpic -m32 -std=c++11 -O3
rm -f libqt.so import main.o
/home/tammy/gcc481/bin/g++ -c -fpic -m32 -std=c++11 -O3 qt.C
/home/tammy/gcc481/bin/g++ -m32 -shared -o libqt.so qt.o
/home/tammy/gcc481/bin/g++ -c -fpic -m32 -std=c++11 -O3 main.C
/home/tammy/gcc481/bin/g++ -o import main.o -Wl,-rpath,/home/tammy/gcc481/lib
-m32 -L. -lqt
$ ./import
Segmentation fault
$ 

The 64-bit version works. If I change "-O3" to "-O2" or "-O3
-fno-tree-vectorize", it works also.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
@ 2013-08-20 22:38 ` paolo.carlini at oracle dot com
  2013-08-23 22:34 ` [Bug target/58208] " tammy at Cadence dot COM
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-20 22:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |tree-optimization

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Doesn't look like a c++ front-end bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
  2013-08-20 22:38 ` [Bug tree-optimization/58208] " paolo.carlini at oracle dot com
@ 2013-08-23 22:34 ` tammy at Cadence dot COM
  2013-08-23 23:05 ` pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tammy at Cadence dot COM @ 2013-08-23 22:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

Tammy Hsu <tammy at Cadence dot COM> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major

--- Comment #2 from Tammy Hsu <tammy at Cadence dot COM> ---
Can you assign someone to take a look this issue?


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
  2013-08-20 22:38 ` [Bug tree-optimization/58208] " paolo.carlini at oracle dot com
  2013-08-23 22:34 ` [Bug target/58208] " tammy at Cadence dot COM
@ 2013-08-23 23:05 ` pinskia at gcc dot gnu.org
  2013-08-24 12:19 ` mikpe at it dot uu.se
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-08-23 23:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Severity|major                       |normal


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (2 preceding siblings ...)
  2013-08-23 23:05 ` pinskia at gcc dot gnu.org
@ 2013-08-24 12:19 ` mikpe at it dot uu.se
  2013-08-25 10:14 ` mikpe at it dot uu.se
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mikpe at it dot uu.se @ 2013-08-24 12:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #3 from Mikael Pettersson <mikpe at it dot uu.se> ---
I can't reproduce the SEGV on Fedora 17 with gcc-4.8.1 -m32 or gcc-4.9 -m32.

However, I think the build recipe is flawed.  If I follow it to the letter
(with -Wl,-rpath pointing to where I installed gcc-4.8) the `import' binary
fails because it can't find libqt.so:

> ./import 
./import: error while loading shared libraries: libqt.so: cannot open shared
object file: No such file or directory
> ldd ./import 
        linux-gate.so.1 =>  (0xf76e4000)
        libqt.so => not found
        libstdc++.so.6 => /tmp/install/lib/libstdc++.so.6 (0xf75f1000)
        libm.so.6 => /lib/libm.so.6 (0xf75c6000)
        libgcc_s.so.1 => /tmp/install/lib/libgcc_s.so.1 (0xf75ac000)
        libc.so.6 => /lib/libc.so.6 (0xf73f9000)
        /lib/ld-linux.so.2 (0xf76e5000)

With LD_LIBARY_PATH=.: ./import runs fine w/o error with gcc-4.8.1.

Perhaps your `import' is picking up another libqt.so from a system directory,
and there's a C++ ABI incompatibility between that one and 4.8.1?


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (3 preceding siblings ...)
  2013-08-24 12:19 ` mikpe at it dot uu.se
@ 2013-08-25 10:14 ` mikpe at it dot uu.se
  2013-08-25 18:12 ` mikpe at it dot uu.se
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mikpe at it dot uu.se @ 2013-08-25 10:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #5 from Mikael Pettersson <mikpe at it dot uu.se> ---
Unmodified FSF gcc-4.8.1 configured as follows:

/tmp/gcc-4.8.1/configure --prefix=/tmp/install --with-gmp=/path/to/my/gmp-5.1.2
--with-mpfr=/path/to/my/mpfr-3.1.2 --with-mpc=/path/to/my/mpc-1.0.1
--enable-multilib --enable-checking=release --enable-languages=c,c++


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (4 preceding siblings ...)
  2013-08-25 10:14 ` mikpe at it dot uu.se
@ 2013-08-25 18:12 ` mikpe at it dot uu.se
  2013-08-25 20:02 ` mikpe at it dot uu.se
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mikpe at it dot uu.se @ 2013-08-25 18:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #6 from Mikael Pettersson <mikpe at it dot uu.se> ---
I've just bootstrapped gcc-4.8.1 on CentOS 5.8 (the closest I have to the OP's
RHEL 5.5), and LD_LIBRARY_PATH=. ./import does indeed SEGV there.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (5 preceding siblings ...)
  2013-08-25 18:12 ` mikpe at it dot uu.se
@ 2013-08-25 20:02 ` mikpe at it dot uu.se
  2013-08-26  3:07 ` tammy at Cadence dot COM
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mikpe at it dot uu.se @ 2013-08-25 20:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #7 from Mikael Pettersson <mikpe at it dot uu.se> ---
CentOS 5.8 has an old binutils-2.17.50.0.6-20.el5_8.3.  Building and installing
binutils-2.23.2 and rebuilding gcc-4.8.1 against that makes no difference,
./import still SEGVs.  I'm beginning to suspect a glibc-2.5 compatibility
issue.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (6 preceding siblings ...)
  2013-08-25 20:02 ` mikpe at it dot uu.se
@ 2013-08-26  3:07 ` tammy at Cadence dot COM
  2013-08-26 17:08 ` tammy at Cadence dot COM
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tammy at Cadence dot COM @ 2013-08-26  3:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #8 from Tammy Hsu <tammy at Cadence dot COM> ---
Thanks a lot for trying rebuilding twice!!
you don't think it is caused by optimization code? if we use "-O2" or "-O3
-fno-tree-vectorize" then it won't seg fault....


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (7 preceding siblings ...)
  2013-08-26  3:07 ` tammy at Cadence dot COM
@ 2013-08-26 17:08 ` tammy at Cadence dot COM
  2013-08-26 19:43 ` tammy at Cadence dot COM
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tammy at Cadence dot COM @ 2013-08-26 17:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #9 from Tammy Hsu <tammy at Cadence dot COM> ---
I tried to run the g++ build on RHEL 5.5 on a RHEL 6.3 system, import seg
fault.

I then tried to rebuild gcc481 on RHEL 6.3 and rerun the testcase, it still
crash.

The glibc on RHEL 6.3 is glibc-2.12-1.80.el6.x86_64 and the kernel is
2.6.32-279.el6.

Also I tried to use the /bin/g++ on fedora 19 (gcc4.8.1). It misses
/usr/include/gnu/stubs.h and fails at compilation.
$ /bin/g++ -c  -fpic -m32 -std=c++11 -O3 qt.C
In file included from /usr/include/features.h:399:0,
                 from
/usr/include/c++/4.8.1/x86_64-redhat-linux/32/bits/os_defines.h:39,
                 from
/usr/include/c++/4.8.1/x86_64-redhat-linux/32/bits/c++config.h:420,
                 from /usr/include/c++/4.8.1/bits/stl_algobase.h:59,
                 from /usr/include/c++/4.8.1/deque:60,
                 from qt.C:1:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or
directory
 # include <gnu/stubs-32.h>
                           ^
compilation terminated.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (8 preceding siblings ...)
  2013-08-26 17:08 ` tammy at Cadence dot COM
@ 2013-08-26 19:43 ` tammy at Cadence dot COM
  2013-08-28 23:02 ` tammy at Cadence dot COM
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tammy at Cadence dot COM @ 2013-08-26 19:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #11 from Tammy Hsu <tammy at Cadence dot COM> ---
Thank you. Yes, on the fedora 19 systems, I don't have these 3 i686 rpms
installed. I will add them. 

Do you have any comments on the crash issue we have on CentOS 5.8 or RHEL
5.5/RHEL 6.3 after building gcc481 on them?


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (9 preceding siblings ...)
  2013-08-26 19:43 ` tammy at Cadence dot COM
@ 2013-08-28 23:02 ` tammy at Cadence dot COM
  2023-06-07  2:03 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tammy at Cadence dot COM @ 2013-08-28 23:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58208

--- Comment #12 from Tammy Hsu <tammy at Cadence dot COM> ---
I installed the required i686 rpms on the Fedora 19 system, and the testcase
works without crash (using the /bin/g++).

I then built gcc481 on the Fedora 19 system, the testcase also works fine when
I compile/link it with my own build gcc481.

So it may really be a glibc compatibility issue (as Mikael said in comment 7).
>From Mikael and I have done:

Not working if build gcc481 on:
RHEL 5.5 - glibc 2.5
CentOS 5.8 - glibc 2.5 (done by Mikael)
RHEL 6.3 - glibc 2.12

Working if build gcc481 on
Fedora 17 - glibc 2.15 (done by Mikael)
Fedora 19 - glibc-2.17

Also if I use the gcc481 built on RHEL 5.5 or RHEL 6.3, and run on Fedora 19,
the testcase works also. So something changed between gcc4.7.3 and gcc 4.8.1
that causes "-ftree-vectorize" optimization not work well (32bit only) with
older glibc.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (10 preceding siblings ...)
  2013-08-28 23:02 ` tammy at Cadence dot COM
@ 2023-06-07  2:03 ` pinskia at gcc dot gnu.org
  2023-06-07  2:05 ` pinskia at gcc dot gnu.org
  2023-06-07  2:06 ` pinskia at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-07  2:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
        movdqa  %xmm1, 16(%esp)
        movdqa  %xmm0, 32(%esp)

Maybe stack alignment for deconstructors.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (11 preceding siblings ...)
  2023-06-07  2:03 ` pinskia at gcc dot gnu.org
@ 2023-06-07  2:05 ` pinskia at gcc dot gnu.org
  2023-06-07  2:06 ` pinskia at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-07  2:05 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |MOVED

--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was a glibc issue.

Fixed by glibc commit 5e49c52efdb37eb0aa315156f39056f25ff9ddaa (
https://sourceware.org/git/?p=glibc.git;a=commit;h=5e49c52efdb37eb0aa315156f39056f25ff9ddaa
)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/58208] deque<std::string> 32-bit "-O3" bug
  2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
                   ` (12 preceding siblings ...)
  2023-06-07  2:05 ` pinskia at gcc dot gnu.org
@ 2023-06-07  2:06 ` pinskia at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-07  2:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #15)
> This was a glibc issue.
> 
> Fixed by glibc commit 5e49c52efdb37eb0aa315156f39056f25ff9ddaa (
> https://sourceware.org/git/?p=glibc.git;a=commit;
> h=5e49c52efdb37eb0aa315156f39056f25ff9ddaa )

Which was included in glibc-2.13 (and above).

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-06-07  2:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-20 22:28 [Bug c++/58208] New: deque<std::string> 32-bit "-O3" bug tammy at Cadence dot COM
2013-08-20 22:38 ` [Bug tree-optimization/58208] " paolo.carlini at oracle dot com
2013-08-23 22:34 ` [Bug target/58208] " tammy at Cadence dot COM
2013-08-23 23:05 ` pinskia at gcc dot gnu.org
2013-08-24 12:19 ` mikpe at it dot uu.se
2013-08-25 10:14 ` mikpe at it dot uu.se
2013-08-25 18:12 ` mikpe at it dot uu.se
2013-08-25 20:02 ` mikpe at it dot uu.se
2013-08-26  3:07 ` tammy at Cadence dot COM
2013-08-26 17:08 ` tammy at Cadence dot COM
2013-08-26 19:43 ` tammy at Cadence dot COM
2013-08-28 23:02 ` tammy at Cadence dot COM
2023-06-07  2:03 ` pinskia at gcc dot gnu.org
2023-06-07  2:05 ` pinskia at gcc dot gnu.org
2023-06-07  2:06 ` pinskia at gcc dot gnu.org

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).