code quality of 32-bit vs. 64-bit mingw output

Simson Garfinkel simsong at acm.org
Wed Nov 2 16:12:21 UTC 2011


All,

I have a program that I cross-compile for deployment on 32-bit and 64-bit windows.

The problem that we are seeing is that the exact same code is crashing when compiled for 64-bit with mingw64 but not crashing when compiled for 32-bit with mingw32. 

Here is a sample of a crash from within GDB:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 3008.0x1294]
0x00000000004c796c in PrefetchDecoder::microsoftDateToISODate (
    time=@0x37eecf0) at scan_winprefetch.cpp:122


And here is the function in question; the crash is in the call to gmtime_r():


    static string microsoftDateToISODate(const uint64_t &time) {
        /**                                                                                                 
         * See comment above for more information on                                                        
         * SECONDS_BETWEEN_WIN32_EPOCH_AND_UNIX_EPOCH                                                       
         *                                                                                                  
         * Convert UNIX time_t to ISO8601 format                                                            
         */
        time_t tmp = (time / ONE_HUNDRED_NANO_SEC_TO_SECONDS)
            - SECONDS_BETWEEN_WIN32_EPOCH_AND_UNIX_EPOCH;

        struct tm time_tm;
        gmtime_r(&tmp, &time_tm);         /* CRASH HAPPENED HERE; line 122 */
        char buf[256];
        strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", &time_tm);
        return string(buf);
    }


As you can see, there is no way that this should be able to cause a crash.

My question --- do we know that the 64-bit compiler is producing code of the same quality as the 32-bit compiler?




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/mingw/attachments/20111102/115ff00a/attachment.html 


More information about the mingw mailing list