public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit)
@ 2012-11-30 10:53 martin.gieseking at uos dot de
  2012-11-30 11:09 ` [Bug target/55543] " paolo.carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: martin.gieseking at uos dot de @ 2012-11-30 10:53 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55543
           Summary: diamond shaped inheritance involving strings leads to
                    crashing executables (MinGW, 32 bit)
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: martin.gieseking@uos.de


Created attachment 28837
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28837
source file to reproduce the issue

When I compile the attached code with g++, mingw32 (gcc 4.7.2), I get an
executable that crashes with the following exception:

  terminate called after throwing an instance of 'std::length_error'
    what():  basic_string::_S_create

This only happens for mingw32. A 64 bit build of the same code works correctly.
So do all 32/64 bit builds for Linux targets I've tested.

Command line:
g++ --save-temps -v -m32 inherit.cpp


Message output:

Built by Equation Solution <http://www.Equation.com>.
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-4.7.2-mingw/configure --host=x86_64-w64-mingw32
--build=x86_64-unknown-linux-gnu --target=x86_64-w64-mingw32
--prefix=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gcc/4.7.2
--with-sysroot=/home/gfortran/gcc-home/binary/mingw32/cross/x86_64/gcc/4.7.2
--with-gcc --with-gnu-ld --with-gnu-as
--with-gmp=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gmp
--with-mpfr=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpfr
--with-mpc=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpc
--with-cloog=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/cloog
--with-ppl=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/ppl
--with-host-libstdcxx='-lstdc++ -lsupc++ -lm' --enable-cloog-backend=ppl
--enable-targets=i686-w64-mingw32,x86_64-w64-mingw32 --enable-lto
--enable-languages=c,c++,fortran --enable-libgomp --enable-threads=win32
--enable-static --enable-shared=lto-plugin --enable-plugins --enable-ld=yes
--enable-libquadmath --enable-libquadmath-support --disable-nls --disable-tls
--disable-win32-registry
Thread model: win32
gcc version 4.7.2 (GCC) 
COLLECT_GCC_OPTIONS='-save-temps' '-v' '-m32' '-mtune=generic' '-march=x86-64'
 c:/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.2/cc1plus.exe -E -quiet -v
-imultilib 32 -iprefix c:\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/
-U_REENTRANT inherit.cpp -m32 -mtune=generic -march=x86-64 -fpch-preprocess -o
inherit.ii
ignoring duplicate directory
"c:/gcc/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2"
ignoring duplicate directory
"c:/gcc/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/x86_64-w64-mingw32/32"
ignoring duplicate directory
"c:/gcc/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/backward"
ignoring duplicate directory
"c:/gcc/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.7.2/include"
ignoring nonexistent directory
"/home/gfortran/gcc-home/binary/mingw32/cross/x86_64/gcc/4.7.2/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gcc/4.7.2/lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include"
ignoring duplicate directory
"c:/gcc/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.7.2/include-fixed"
ignoring duplicate directory
"c:/gcc/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory
"/home/gfortran/gcc-home/binary/mingw32/cross/x86_64/gcc/4.7.2/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2

c:\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/x86_64-w64-mingw32/32

c:\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/backward
 c:\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/include
 c:\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/include-fixed

c:\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include
End of search list.
COLLECT_GCC_OPTIONS='-save-temps' '-v' '-m32' '-mtune=generic' '-march=x86-64'
 c:/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.2/cc1plus.exe -fpreprocessed
inherit.ii -quiet -dumpbase inherit.cpp -m32 -mtune=generic -march=x86-64
-auxbase inherit -version -o inherit.s
GNU C++ (GCC) version 4.7.2 (x86_64-w64-mingw32)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.0.0, MPC
version 0.9
warning: GMP header version 5.0.5 differs from library version 5.0.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.7.2 (x86_64-w64-mingw32)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.0.0, MPC
version 0.9
warning: GMP header version 5.0.5 differs from library version 5.0.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0b3cd9e378660c38a8a80567400ff92f
COLLECT_GCC_OPTIONS='-save-temps' '-v' '-m32' '-mtune=generic' '-march=x86-64'

c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/as.exe
-v --32 -o inherit.o inherit.s
GNU assembler version 2.22.52 (x86_64-w64-mingw32) using BFD version (GNU
Binutils) 2.22.52.20120723
COMPILER_PATH=c:/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.2/;c:/gcc/bin/../libexec/gcc/;c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/
EQ_LIBRARY_PATH=c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/32/;c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/lib/../lib32/;c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../lib32/;c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/;c:/gcc/bin/../lib/gcc/;c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/lib/;c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../
COLLECT_GCC_OPTIONS='-save-temps' '-v' '-m32' '-mtune=generic' '-march=x86-64'
 c:/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.2/collect2.exe
--sysroot=/home/gfortran/gcc-home/binary/mingw32/cross/x86_64/gcc/4.7.2 -m
i386pe -Bdynamic
c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/lib/../lib32/crt2.o
c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/lib/../lib32/crtbegin.o
-Lc:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/32
-Lc:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/lib/../lib32
-Lc:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../lib32
-Lc:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2 -Lc:/gcc/bin/../lib/gcc
-Lc:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/lib
-Lc:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../.. inherit.o -lstdc++
-lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32
-lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/lib/../lib32/crtend.o


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

* [Bug target/55543] diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit)
  2012-11-30 10:53 [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit) martin.gieseking at uos dot de
@ 2012-11-30 11:09 ` paolo.carlini at oracle dot com
  2012-11-30 11:15 ` ktietz at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-30 11:09 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktietz at gcc dot gnu.org
          Component|c++                         |target

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-30 11:08:45 UTC ---
Kai, can you have a look?


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

* [Bug target/55543] diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit)
  2012-11-30 10:53 [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit) martin.gieseking at uos dot de
  2012-11-30 11:09 ` [Bug target/55543] " paolo.carlini at oracle dot com
@ 2012-11-30 11:15 ` ktietz at gcc dot gnu.org
  2012-11-30 12:31 ` martin.gieseking at uos dot de
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-11-30 11:15 UTC (permalink / raw)
  To: gcc-bugs


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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-11-30
     Ever Confirmed|0                           |1

--- Comment #2 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-11-30 11:14:45 UTC ---
Yes, I noticed this regression recently on 4.8 too.  There is already a smaller
testcase and it has to do with SjLj exception-mechanism.
Does the testcase g++.old-deja/g++.eh/catch7p.C fail for you on 4.7.2, too?

The issue - as far as I could test it - is that catch-blocks are executed in
none-source order.  This seems to happen only for SjLj.


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

* [Bug target/55543] diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit)
  2012-11-30 10:53 [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit) martin.gieseking at uos dot de
  2012-11-30 11:09 ` [Bug target/55543] " paolo.carlini at oracle dot com
  2012-11-30 11:15 ` ktietz at gcc dot gnu.org
@ 2012-11-30 12:31 ` martin.gieseking at uos dot de
  2012-11-30 15:56 ` martin.gieseking at uos dot de
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: martin.gieseking at uos dot de @ 2012-11-30 12:31 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Martin Gieseking <martin.gieseking at uos dot de> 2012-11-30 12:30:39 UTC ---
(In reply to comment #2)
> Yes, I noticed this regression recently on 4.8 too.  There is already a smaller
> testcase and it has to do with SjLj exception-mechanism.
> Does the testcase g++.old-deja/g++.eh/catch7p.C fail for you on 4.7.2, too?

Thanks for the information. The mentioned test catch7p.C passes properly. So
maybe the it's a different problem here?


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

* [Bug target/55543] diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit)
  2012-11-30 10:53 [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit) martin.gieseking at uos dot de
                   ` (2 preceding siblings ...)
  2012-11-30 12:31 ` martin.gieseking at uos dot de
@ 2012-11-30 15:56 ` martin.gieseking at uos dot de
  2012-11-30 16:56 ` ktietz at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: martin.gieseking at uos dot de @ 2012-11-30 15:56 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Martin Gieseking <martin.gieseking at uos dot de> 2012-11-30 15:56:00 UTC ---
Created attachment 28839
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28839
simplified sample code

I simplified the sample code a little bit by removing the static method. The
bug seems to occur only in conjunction with polymorphism and multiple
inheritance. At least, I wasn't able to provoke it with some simpler construct.
So I'm not sure if the failure is actually related to the exception handling
model implemented in the compiler, as the code is supposed to not throw any
exceptions.

As far as I know, mingw64 also uses SjLj, doesn't it? When creating a 64 bit
executable with it, it runs correctly. Only the 32 bit binaries show this
issue.


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

* [Bug target/55543] diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit)
  2012-11-30 10:53 [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit) martin.gieseking at uos dot de
                   ` (3 preceding siblings ...)
  2012-11-30 15:56 ` martin.gieseking at uos dot de
@ 2012-11-30 16:56 ` ktietz at gcc dot gnu.org
  2013-09-10 11:14 ` ktietz at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-11-30 16:56 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-11-30 16:56:10 UTC ---
(In reply to comment #4)
> As far as I know, mingw64 also uses SjLj, doesn't it? When creating a 64 bit
> executable with it, it runs correctly. Only the 32 bit binaries show this
> issue.

Well, x64 uses for 4.8 SEH.  Just 32-bit uses SjLj.  Nevertheless there might
be two different issues.


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

* [Bug target/55543] diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit)
  2012-11-30 10:53 [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit) martin.gieseking at uos dot de
                   ` (4 preceding siblings ...)
  2012-11-30 16:56 ` ktietz at gcc dot gnu.org
@ 2013-09-10 11:14 ` ktietz at gcc dot gnu.org
  2013-09-11  8:21 ` martin.gieseking at uos dot de
  2013-09-11  8:24 ` ktietz at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ktietz at gcc dot gnu.org @ 2013-09-10 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #6 from Kai Tietz <ktietz at gcc dot gnu.org> ---
I tested 4.8 and here this issue seems to be solved.
Does the issue still exists for more recent 4.7 version?


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

* [Bug target/55543] diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit)
  2012-11-30 10:53 [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit) martin.gieseking at uos dot de
                   ` (5 preceding siblings ...)
  2013-09-10 11:14 ` ktietz at gcc dot gnu.org
@ 2013-09-11  8:21 ` martin.gieseking at uos dot de
  2013-09-11  8:24 ` ktietz at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: martin.gieseking at uos dot de @ 2013-09-11  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Martin Gieseking <martin.gieseking at uos dot de> ---
I can confirm that the issue seems to be gone in 4.8, and I can't reproduce it
with 4.7.3 either. So it's probably fixed in the recent releases.


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

* [Bug target/55543] diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit)
  2012-11-30 10:53 [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit) martin.gieseking at uos dot de
                   ` (6 preceding siblings ...)
  2013-09-11  8:21 ` martin.gieseking at uos dot de
@ 2013-09-11  8:24 ` ktietz at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ktietz at gcc dot gnu.org @ 2013-09-11  8:24 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Ok, so it is fixed for all maintained version.  I close this bug.


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

end of thread, other threads:[~2013-09-11  8:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30 10:53 [Bug c++/55543] New: diamond shaped inheritance involving strings leads to crashing executables (MinGW, 32 bit) martin.gieseking at uos dot de
2012-11-30 11:09 ` [Bug target/55543] " paolo.carlini at oracle dot com
2012-11-30 11:15 ` ktietz at gcc dot gnu.org
2012-11-30 12:31 ` martin.gieseking at uos dot de
2012-11-30 15:56 ` martin.gieseking at uos dot de
2012-11-30 16:56 ` ktietz at gcc dot gnu.org
2013-09-10 11:14 ` ktietz at gcc dot gnu.org
2013-09-11  8:21 ` martin.gieseking at uos dot de
2013-09-11  8:24 ` ktietz 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).