Skip Menu |

This queue is for tickets about the Win32-API CPAN distribution.

Report information
The Basics
Id: 104426
Status: resolved
Priority: 0/
Queue: Win32-API

People
Owner: Nobody in particular
Requestors: kmx [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.82



Subject: function was called with the wrong prototype and caused a C stack inconsistency
While trying to build Win32::API with gcc-4.9.2 + mingw-w64-v4.0.2 runtime (perl: 5.20.2/32bit) I got the failures like this:

https://gist.github.com/kmx/5b6577181ceecf5999b2

I have not investigated more details.

--
kmx

64 bit perl 5.20.2 built with gcc-4.9.2 + mingw-w64-v4.0.2 runtime does not fail


On Thu May 14 11:47:45 2015, KMX wrote: Show quoted text
> 64 bit perl 5.20.2 built with gcc-4.9.2 + mingw-w64-v4.0.2 runtime does not > fail
The feature that does the "Win32::API a function was called with the wrong prototype and caused a C stack inconsistency" die is not implemented on 64 bit and never will be (MS Win64 ABI doesnt supply the info). I will probably have to try to build it myself and look at the binary produced. where do I get this "gcc-4.9.2 + mingw-w64-v4.0.2" CC, the exact same one you are using? You can also try 0.80_02 https://metacpan.org/pod/release/BULKDD/Win32-API-0.80_02/API.pm and send me the *32 bit* API.dll that is compiled.
Subject: Re: [rt.cpan.org #104426] function was called with the wrong prototype and caused a C stack inconsistency
Date: Sun, 17 May 2015 10:14:30 +0200
To: bug-Win32-API [...] rt.cpan.org
From: kmx <kmx [...] cpan.org>
Show quoted text
> where do I get this "gcc-4.9.2 + mingw-w64-v4.0.2" CC, the exact same one you are using?
http://strawberryperl.com/download/5.22.0.1/strawberry-perl-5.22.0.1-beta1-32bit-portable.zip it's perl blead + gcc-4.9.2 + mingw-w64-v4.0.2 + gdb Thanks in advance for your time -- kmx
From: tfm-bitcard [...] earth.li
I suspect this is the same bug as I have been digging into. Using GCC 4.9.2 on Cygwin the tests fail with errors like: "Win32::API a function was called with the wrong prototype and caused a C stack inconsistency EBP=28c9ec ESP=28c9e0 at t/00_API.t line 51." Adding -fno-schedule-insns2 to the CFLAGS (see patch) fixes it for me (-fno-schedule-insns2 seems to be supported at least as far back as GCC 3.3.3 so I assume this should not cause any issues for older installs).
Subject: fixWin32-API-EBPErrorOnRecentGcc.patch
--- orig/Makefile.PL 2015-05-19 10:52:42.698333900 +0100 +++ Makefile.PL 2015-05-19 11:02:36.709309400 +0100 @@ -109,7 +109,7 @@ #recipe to get GCC (4.6.3 tested) to do it call_i686$(OBJ_EXT): call_i686.c API.h $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) \ --fno-defer-pop -fno-omit-frame-pointer -mno-accumulate-outgoing-args -mno-stack-arg-probe call_i686.c +-fno-defer-pop -fno-omit-frame-pointer -fno-schedule-insns2 -mno-accumulate-outgoing-args -mno-stack-arg-probe call_i686.c EOM1 } @@ -130,7 +130,7 @@ #recipe to get GCC (4.6.3 tested) to do it call_i686$(OBJ_EXT): call_i686.c API.h $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) \ --fno-defer-pop -fno-omit-frame-pointer -mno-accumulate-outgoing-args -mno-stack-arg-probe call_i686.c +-fno-defer-pop -fno-omit-frame-pointer -fno-schedule-insns2 -mno-accumulate-outgoing-args -mno-stack-arg-probe call_i686.c '; }
Subject: Re: [rt.cpan.org #104426] function was called with the wrong prototype and caused a C stack inconsistency
Date: Tue, 19 May 2015 12:41:19 +0200
To: bug-Win32-API [...] rt.cpan.org
From: kmx <kmx [...] cpan.org>
Excellent, using -fno-schedule-insns2 works! Thanks a lot. -- kmx
On Tue May 19 06:41:36 2015, KMX wrote: Show quoted text
> Excellent, using -fno-schedule-insns2 works! > > Thanks a lot. > > -- > kmx >
Instead of every new release of GCC (which happens in every release of Strawberry) breaking Win32::API for some reason or another, I changed the inline assembly to assembly code. https://github.com/bulk88/perl5-win32-api/commit/9e25c21f1eeaf2563c59f91dd30bfc47ee901813 I am going to try to stick some more improvements in before releasing a 0.81, but if you want an immediate/emergency release of stable Win32::API with the GCC fix please let me know.
On Thu May 14 08:33:51 2015, KMX wrote: Show quoted text
> While trying to build Win32::API with gcc-4.9.2 + mingw-w64-v4.0.2 runtime > (perl: 5.20.2/32bit) I got the failures like this: > > https://gist.github.com/kmx/5b6577181ceecf5999b2 > > I have not investigated more details. > > -- > kmx
Fixed in 0.82.