Tue May 19 06:22:34 2015: Request 104426 was acted upon.
Transaction: Correspondence added by tfmtfm
       Queue: Win32-API
     Subject: function was called with the wrong prototype and caused a C stack 
inconsistency
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: k...@cpan.org
      Status: open
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104426 >


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).
--- 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
 
 ';
 }

Reply via email to