<URL: https://rt.cpan.org/Ticket/Display.html?id=80322 >
On Sun Nov 11 17:13:54 2012, JDHEDDEN wrote: > It is possible this has anything to do with the compiler flags I use: > > -march=pentium4 -mfpmath=sse -mieee-fp -mmmx -msse -msse2 > Maybe it does. I compared x87 control word, x87 status word, and sse mxcsr. No FP exceptions are allowed to fire on yours or mine (so it is not a cygwin or GCC FP exception handler, I don't think it is). Basically everything is identical (i had a inexact flag on and condition bit C3 was on for me, yours didn't have either on, some other small differences might exist but they weren't signifigant for me to remember). Below is what I used to look at the data. The Reini data is broken (wrong length). Basically, the bug is, your platform fails on division after 7 "return *(float *)"\x01\x00\x00\x00";". What OS/CPU are you using (are you using YMM registers?)? A random fact, x87 has only FP 8 registers. I wonder, if the asm code that is loading the float into the register, is "corrupting" the other 7 registers? I'll have to check another day. I might also try to write a pure C/XS example with the unusual float and a eval_pv with a division operation and see if I trigger it that way. The opcode I used is the same Visual C used when Visual C compiled the following ______________________________________________________ ////the template used in the MakeCB for x86 double CALLBACK CallbackTemplateD() { void (*PerlCallback)(SV *, void *, unsigned __int64 *, FuncRtnCxt *) = 0xC0DE0001; FuncRtnCxt FuncRtnCxtVar; FDUNION retval; PerlCallback((SV *)0xC0DE0002, (void*)0xC0DE0003, (unsigned __int64 *)&retval, &FuncRtnCxtVar); if(FuncRtnCxtVar.F_Or_D){ return (double) retval.f; } else{ return retval.d; } } _____________________________________________________ void SC(cxts1, cxts2, cxts3) char * cxts1 char * cxts2 char * cxts3 PREINIT: struct FXSAVE { UINT16 _fcw; UINT16 _fsw; UINT8 _ftw; UINT8 _pad1; UINT16 _fop; UINT32 _fpuip; UINT16 _cs; UINT16 _pad2; UINT32 _fpudp; UINT16 _ds; UINT16 _pad3; UINT32 _mxcsr; UINT32 _mxcsrmask; UINT8 _st[8 * 16]; UINT8 _xmm[8 * 16]; UINT8 _pad4[56 * 4]; }; struct _CONTEXT * cxt1 = (struct _CONTEXT *)cxts1; struct _CONTEXT * cxt2 = (struct _CONTEXT *)cxts2; struct _CONTEXT * cxt3 = (struct _CONTEXT *)cxts3; PFLOATING_SAVE_AREA fp1 = &cxt1->FloatSave; PFLOATING_SAVE_AREA fp2 = &cxt2->FloatSave; PFLOATING_SAVE_AREA fp3 = &cxt3->FloatSave; struct FXSAVE * fxs1 = &cxt1->ExtendedRegisters; struct FXSAVE * fxs2 = &cxt2->ExtendedRegisters; struct FXSAVE * fxs3 = &cxt3->ExtendedRegisters; CODE: DebugBreak(); printf("hw\n"); ________________________________________________ #Jerry $cxt1 = "?\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\177\2\377\377 \0\377\377\377\377\377\377\360\234\bX\e\0]\5\270\244\"\0#\0\377\377\0\0\0\0\$\272\224\250\234\372\1\0\0\0\0\0\0\0\0\0\235\377O\200\0\r\333\272\324\271h\\\253\0\274\271\224\250x\240\200f2\213\355\266T\200\31\0\4\e\0\200\300\273\224\250d\275\0h\254\375\235\355Q\240\1\@\0\0\0\0\0\0\0\240\1\@\0\0\0\0\0\0\0\0;\0\0\0#\0\0\0#\0\0\0\4\0\0\0\0\0\0\0h\252\"\0\377\377\377\377\251*\201|\230\250\"\0\350\250\"\0\373*\201|\e\0\0\0F\2\0\0\224\250\"\0#\0\0\0\177\2 \0\0\0]\5\360\234\bX\e\0\0\0\270\244\"\0#\0\0\0\240\37\0\0\377\377\0\0\0\0\0\0\$\272\224\250\234\372\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\235\377O\200\0\r\333\272\324\271\0\0\0\0\0\0h\\\253\0\274\271\224\250x\240\0\0\0\0\0\0\200f2\213\355\266T\200\31\0\0\0\0\0\0\0\4\e\0\200\300\273\224\250d\275\0\0\0\0\0\0\0h\254\375\235\355Q\240\1\@\0\0\0\0\0\0\0\0\0\0\0\0\0\240\1\@\0\0\0\0\0\0X\354\$\0\0\0\0\0\0\0\0\0\0\0\0\0\260\256\n\324b\20\24\@\0\0\0\0\0\0\0\0\0\0\0\0\0\210\303\@\0\0\0\0\0\0\0\0\0\0\0\0\320\273\224\250rG\205\277\0\0\0\0\325\221\0\0\320\273\224\250\255G\205\277\30\222\301\351\$\272\224\250\35H\205\277\0\0\0\1\200\b\22\347\30\222\301\351\b\0\n\0\0\273\224\250p\241M\200x\1\346\271\0\0\2\0\0\340\375\177\@\272\224\250\1\0\0\0\0\1\0\0\20\202\2 \350\227\"\0\20\225\"\0001\234\na#\0;\0\0\0#\0D\377\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\16\0\0\0\1\0\0\0\2\0\0\0\1\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0"; #Reini $cxt2 = "?\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\177\2\377\377\0\377\377\377\377\377\377\177\377\24X\e\0\0\0pe-X#\0\377\377\210\225\"\0x\227\"\0\0\0\1\0\0\0(\233\nax\227\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\254\201\1\25\0\0\0\0\0\0\0\0\0\0\0\0\200\377?\0\0\0\0\374\377\377\377\34\@\0\0\0\0\0\0\0\0;\0\0\0#\0\0\0#\0\0\0_\36\32a\0\0\0\0\300\246\"\0\4\0\0\0\0\0\0\0\270\245\"\0\b\246\"\0\373*\201|\e\0\0\0F\2\0\0\264\245\"\0#\0\0\0\177\2\0\0\0\0\0\177\377\24X\e\0\0\0pe-X#\0\0\0\200\37\0\0\377\377\0\0\210\225\"\0x\227\"\0\0\0\0\0\0\0\0\0\1\0\0\0(\233\nax\227\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\254\201\1\25\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\200\377?\0\0\0\0\0\0\0\0\0\0\374\377\377\377\34\@\0\0\0\0\0\0\200\251\"\0_\300\16a#\0;\0\0\0#\0\200\251\"\0_\300\16a#\0;\0\0\0#\0D\377\"\0`\16\240_\0\0__register_frame_info\0\0\252\"\0\0\0\0\0\0\0\0\0\260_'a\0\0\0\0000\0<\0\310\222'a\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\344}\310\16\267_\315\1qG\"\302A\271\315\1>\340\312\16\267_\315\1>\340\312\16\267_\315\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\nA\202\0\0\0\0\0\0\0\0\0\0\0\0\0\224\32a\303\0\0\0\224\32a\343z\0a\0\0\0\0\0\0\0\0<\246\"\0\234\226\"\0x\227\"\0\1\0\0\0\1\0\0\0\0\1\0\0\270\201\2\30\230\"\0\@\225\"\0q\230\na#\0;\0\0\0#\0D\377\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; #Daniel $cxt3 = "?\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\177\2\377\377 \@\377\377\377\377\377\377\252U\5(\e\0\330\5\0\0\0\0#\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n\330\220|\21\264\27\0\0\0L\365\23\0\$\0\1\0\0\0008:\25\0a\264\0\0\3\0\0\0\0\0\0\0\0\0\0\0\0\0D\234\f\@\0\0\0\0\0\0\0\200\377?\0\0\0\0\374\377\377\377\34\@\0\0\0\0\0\0\0\0;\0\0\0#\0\0\0#\0\0\0004B4\0\0\0\0\0\313*\1(\377\377\377\377\@\372\22\0\270\371\22\0\b\372\22\0\373*\201|\e\0\0\0F\2\0\0\264\371\22\0#\0\0\0\177\2 \@\0\0\330\5\252U\5(\e\0\0\0\0\0\0\0#\0\0\0\240\37\0\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n\330\220|\21\264\0\0\0\0\0\0\27\0\0\0L\365\23\0\$\0\0\0\0\0\0\0\1\0\0\0008:\25\0a\264\0\0\0\0\0\0\0\0\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0D\234\f\@\0\0\0\0\0\0\0\0\0\0\0\0\0\200\377?\0\0\0\0\0\0\0\0\0\0\374\377\377\377\34\@\0\0\0\0\0\0\0\0\0\0\0\0\20\@\0\0\0\0\0\0\0\0\325x\351&1\b\24\@\0\0\0\0\0\0\0\0*\32k\177g{\204?\0\0\0\0\0\0\0\0\0\0\0\0\0\0\$\@\0\0\0\0\0\0\0\0\215\265\277\263=\n\24\@\0\0\0\0\0\0\0\0^\324\301w\265\1\0\0\t\0\0\0\237\370\23\0\1\0\0\0P\366\23\0\1\0\0\0\237\370\23\0\237\370\23\0\210\366\23\0%\20\304w\243\324\301w\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ 0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; $cxt2 = "\x00" x 716; die "bad len".length($cxt1) if length($cxt1) != 716; die "bad len".length($cxt2) if length($cxt2) != 716; die "bad len".length($cxt3) if length($cxt3) != 716; Local::XS::SC($cxt1, $cxt2, $cxt3);