#277 builtins unusable under -O0, no crt apps impossible

pending-invalid
nobody
None
5
2012-03-30
2012-03-12
bulk88
No

Using mingw-w32-bin_i686-mingw_20111219.zip, mingw64 GCC can not use GCC builtins under -O0 optimization level preventing the creation of any PEs which do not link to the CRT. Under all -O flags (I tried -O1 -O2 -Ofast ) except -O0, the program will compile. A sample program is included. It is called memcpy.c. It was compiled with i686-w64-mingw32-gcc.exe memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O0" . Mingw64 GCC converted the __builtin_memcpy function to memcpy, which is a CRT function, then fail when they can't link to the CRT. Mingw.org GCC does NOT exhibit this.

I brought up the problem in these 2 places before.
https://rt.cpan.org/Public/Bug/Display.html?id=75683
http://sourceforge.net/mailarchive/message.php?msg_id=28930444

Discussion

  • bulk88
    bulk88
    2012-03-12

    CL output of mingw64 comiling attempts

     
  • bulk88
    bulk88
    2012-03-12

     
    Attachments
  • Jonathan Yong
    Jonathan Yong
    2012-03-12

    • status: open --> closed-invalid
     
  • Jonathan Yong
    Jonathan Yong
    2012-03-12

    Cygwin GCC does the same thing, so its not mingw-w64 specific. Also, <http://gcc.gnu.org/ml/gcc-help/2008-08/msg00065.html>

    So you may want to contact gcc-help instead.

     
  • bulk88
    bulk88
    2012-03-12

    Did you read the line where this is a bug specific to mingw64 gcc, and that mingw.org gcc doesn't have this bug?

     
  • bulk88
    bulk88
    2012-03-12

    • status: closed-invalid --> open-invalid
     
  • Jonathan Yong
    Jonathan Yong
    2012-03-12

    I'm saying its not a mingw-w64 bug, its a GCC behavior. So please contact gcc-help for help on forcing built-ins to be emitted.

     
  • Mark Dootson
    Mark Dootson
    2012-03-12

    This issue also raised in connection with Strawberry Perl and future use of perlmingw.sf.net

    The difference between mingw.org and mingw-w64 is that the default options output by mingw-w64 output correctly

    -mtune=generic

    whilst mingw.org outputs

    -mtune=i386

    If you explicitly pass -mtune=i386 to the 32 bit mingw-w64, that has no problem with builtins

    Likewise if you explicitly pass -mtune=generic to mingw.org, that fails too.

    There's know equivalent 'hack' for 64bit mingw-w64 where -mtune options don't help.

    Hopefully, this may point up where the actual issue is for someone - it isn't clear to me at all.

     
  • Kai Tietz
    Kai Tietz
    2012-03-30

    • status: open-invalid --> pending-invalid