This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71260] New: Crash in DLL compiled with -fipa-pure-const and -flto [mingw32]
- From: "slawomir.czarko at dev dot policat.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 May 2016 15:08:38 +0000
- Subject: [Bug c++/71260] New: Crash in DLL compiled with -fipa-pure-const and -flto [mingw32]
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71260
Bug ID: 71260
Summary: Crash in DLL compiled with -fipa-pure-const and -flto
[mingw32]
Product: gcc
Version: 4.9.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: slawomir.czarko at dev dot policat.net
Target Milestone: ---
Created attachment 38553
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38553&action=edit
DLL code
Description of problem:
Function in DLL compiled with -O3 and -flto crashes due to page fault.
Crash does not happen in either of these cases:
* -fno-ipa-pure-const is added to compiler options,
* inlining is disabled,
* optimization level is reduced to O2,
* various changes are made to the code, for example member variable dummy is
removed from struct E
During debugging I saw that call to a.c1.at( 0 ) uses invalid address of
variable a and that causes the crash.
Options -Wall -Wextra do not show any problems.
Adding -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations has no
effect.
Version-Release number of selected component (if applicable):
mingw32-gcc-c++-4.9.3-1.el7.x86_64
How reproducible:
100%
Steps to Reproduce:
1. Compile and link DLL:
i686-w64-mingw32-g++ -std=c++11 -O3 -pipe -m32 -flto -fpreprocessed -c crash.ii
-o dll.o
i686-w64-mingw32-g++ -std=c++11 -O3 -pipe -m32 -flto -static
-Wl,--out-implib,libdll.lib dll.o -Wl,-Bstatic -shared -o dll.dll
2. Compile and link program:
i686-w64-mingw32-g++ -std=c++11 -fpreprocessed -o a32.o -c a.ii
i686-w64-mingw32-g++ -std=c++11 -static -Wl,-Bdynamic -L. -ldll -o a32.exe
a32.o -Wl,-Bstatic
3. Run program (wine on Fedora):
WINEDEBUG=fixme-all wine32 a32.exe
Actual results:
Program crashes due to page fault.
Expected results:
No crash.
Additional info:
64-bit build does not have this problem.