Bug 649564

Summary: app with virtual method crashes
Product: [Fedora] Fedora Reporter: David <idht4n>
Component: mingw32-gccAssignee: Kalev Lember <kalevlember>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: fedora-mingw, kalevlember, rjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mingw32-binutils-2.20.1-2.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-01 22:03:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description David 2010-11-04 00:52:24 UTC
Description of problem:
The simple test program below crashes when compiled with mingw in f14 and run with f14 wine.  It works in f12 and Ubuntu 10.10 and I was told it works in f13.

class Foo {
  virtual void bar();
};

void Foo::bar()
{
}

int main()
{
  return 0;
}

Version-Release number of selected component (if applicable):
mingw32-gcc-4.5.0-1.fc14.i686

How reproducible:
Every time

Steps to Reproduce:
1. Compile and run test program
2.
3.
  
Actual results:
Test program crashes

Expected results:
Test program doesn't crash

Additional info:
usr/bin/i686-pc-mingw32-g++ -o foo.exe /tmp/foo.cpp 
Info: resolving vtable for __cxxabiv1::__class_type_info by linking to __imp___ZTVN10__cxxabiv117__class_type_infoE (auto-import)
/usr/lib/gcc/i686-pc-mingw32/4.5.0/../../../../i686-pc-mingw32/bin/ld: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.

$ cd /usr/i686-pc-mingw32/sys-root/mingw/bin
$ /tmp/foo.exe
wine: Unhandled page fault on write access to 0x00403028 at address 0x40142f (thread 0009), starting debugger...
Unhandled exception: page fault on write access to 0x00403028 in 32-bit code (0x0040142f).
Register dump:
 CS:0073 SS:007b DS:007b ES:007b FS:0033 GS:003b
 EIP:0040142f ESP:0061fe2c EBP:0061fe30 EFLAGS:00010206(  R- --  I   - -P- )
 EAX:00403050 EBX:00400000 ECX:00000008 EDX:00403028
 ESI:7ffdf000 EDI:00401130
Stack dump:
0x0061fe2c:  6f305898 0061fe70 0040108d 00404000
0x0061fe3c:  00404004 0061fe64 ffffffff 0061fe60
0x0061fe4c:  00000000 00000000 00000000 00000000
0x0061fe5c:  00000000 00000000 00112fa8 6f305898
0x0061fe6c:  6f305898 0061fe90 00401148 00000001
0x0061fe7c:  68026b22 00000000 00000000 00000000
Backtrace:
=>0 0x0040142f in foo (+0x142f) (0x0061fe30)
  1 0x0040108d __mingw_CRTStartup+0x6c() [/builddir/build/BUILD/mingwrt-3.15.2-mingw32/crt1.c:217] in foo (0x0061fe70)
  2 0x0040108d __mingw_CRTStartup+0x6c() [/builddir/build/BUILD/mingwrt-3.15.2-mingw32/crt1.c:217] in foo (0x0061fe90)
  3 0x00401148 mainCRTStartup+0x17() [/builddir/build/BUILD/mingwrt-3.15.2-mingw32/crt1.c:257] in foo (0x0061fea8)
  4 0x6f2c8c9c call_process_entry+0xb() in kernel32 (0x0061fee8)
  5 0x68389ee0 call_thread_func+0xb() in ntdll (0x0061fef8)
  6 0x6838cb61 call_thread_entry_point+0x70() in ntdll (0x0061ffc8)
  7 0x6836223b call_dll_entry_point+0x65a() in ntdll (0x0061ffe8)
0x0040142f: addl	%ecx,0x0(%edx)
Modules:
Module	Address			Debug info	Name (17 modules)
PE	  400000-  411000	Dwarf           foo
ELF	68000000-68022000	Deferred        ld-linux.so.2
ELF	68022000-68164000	Export          libwine.so.1
ELF	68164000-68180000	Deferred        libpthread.so.0
ELF	68180000-68313000	Deferred        libc.so.6
ELF	68313000-68318000	Deferred        libdl.so.2
ELF	68318000-683e0000	Export          ntdll<elf>
  \-PE	68330000-683e0000	\               ntdll
ELF	683e0000-683ed000	Deferred        libnss_files.so.2
ELF	683ed000-6847b000	Deferred        msvcrt<elf>
  \-PE	68400000-6847b000	\               msvcrt
PE	6cec0000-6cf2c000	Deferred        libgcc_s_sjlj-1
ELF	6f272000-6f3f6000	Export          kernel32<elf>
  \-PE	6f280000-6f3f6000	\               kernel32
PE	6fc40000-7011c000	Deferred        libstdc++-6
ELF	74d91000-74dbb000	Deferred        libm.so.6
ELF	7bf00000-7bf03000	Deferred        <wine-loader>
Threads:
process  tid      prio (all id:s are in hex)
00000008 (D) Z:\tmp\foo.exe
	00000009    0 <==
0000000e services.exe
	00000018    0
	00000017    0
	00000016    0
	00000010    0
	0000000f    0
00000011 winedevice.exe
	0000001a    0
	00000019    0
	00000015    0
	00000012    0
00000013 explorer.exe
	00000014    0
Backtrace:
=>0 0x0040142f in foo (+0x142f) (0x0061fe30)
  1 0x0040108d __mingw_CRTStartup+0x6c() [/builddir/build/BUILD/mingwrt-3.15.2-mingw32/crt1.c:217] in foo (0x0061fe70)
  2 0x0040108d __mingw_CRTStartup+0x6c() [/builddir/build/BUILD/mingwrt-3.15.2-mingw32/crt1.c:217] in foo (0x0061fe90)
  3 0x00401148 mainCRTStartup+0x17() [/builddir/build/BUILD/mingwrt-3.15.2-mingw32/crt1.c:257] in foo (0x0061fea8)
  4 0x6f2c8c9c call_process_entry+0xb() in kernel32 (0x0061fee8)
  5 0x68389ee0 call_thread_func+0xb() in ntdll (0x0061fef8)
  6 0x6838cb61 call_thread_entry_point+0x70() in ntdll (0x0061ffc8)
  7 0x6836223b call_dll_entry_point+0x65a() in ntdll (0x0061ffe8)

Comment 1 Richard W.M. Jones 2010-11-04 11:15:24 UTC
Yup, I can reproduce this.

Seems like a bug in gcc.  We don't normally handle bugs in
upstream products, we just package them.  The reporter might
like to see if it has been reported upstream
(http://gcc.gnu.org/bugzilla/).

Comment 2 David 2010-11-11 18:28:06 UTC
I reported it upstream here:

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

Comment 3 Fedora Update System 2010-11-22 17:42:51 UTC
mingw32-binutils-2.20.1-2.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mingw32-binutils-2.20.1-2.fc14

Comment 4 Kalev Lember 2010-11-22 17:44:57 UTC
This should be fixed with mingw32-binutils-2.20.1-2.fc14 which enables ld's auto-import option by default. Can you confirm the fix?

Comment 5 David 2010-11-27 18:24:57 UTC
(In reply to comment #4)
> This should be fixed with mingw32-binutils-2.20.1-2.fc14 which enables ld's
> auto-import option by default. Can you confirm the fix?

Yes, that seems to have fixed my simple test app and the more complicated one that I stripped down to make the simple one.

Comment 6 Fedora Update System 2010-12-01 22:00:50 UTC
mingw32-binutils-2.20.1-2.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.