Hacker News new | ask | show | jobs
by moyix 1387 days ago
Nope, it still links in crtfastmath:

    $ gcc -Ofast -fno-unsafe-math-optimizations -fpic -shared foo.c -o foo.so
    $ objdump -j .text --disassemble=set_fast_math foo.so

    foo.so:     file format elf64-x86-64


    Disassembly of section .text:

    0000000000001040 <set_fast_math>:
        1040: f3 0f 1e fa           endbr64 
        1044: 0f ae 5c 24 fc        stmxcsr -0x4(%rsp)
        1049: 81 4c 24 fc 40 80 00  orl    $0x8040,-0x4(%rsp)
        1050: 00 
        1051: 0f ae 54 24 fc        ldmxcsr -0x4(%rsp)
        1056: c3                    retq
2 comments

Ouch. Two flags that should reasonably stop this, and neither do. This feels a bit like the time I was told "No, -wAll does not in fact add all warnings".
Wait, it doesn't? O.o
Nope. clang has "-Weverything", and gcc has "-Wextra", both of which go beyond "-Wall".

https://stackoverflow.com/questions/11714827/how-can-i-turn-...

-Wextra is also in Clang and is definitely not everything in either compiler.

-Weverything is everything but that is only really useful to discover new warning flags (in combination with lots of -Wno...) for which you are better off reading GCC/Clang's release notes and/or documentation.

Wait that other python package besides gevent you linked the according issue/pr "fixed" it by adding that flag. So I assumed "ok, -fno-fast-math doesn't override -Ofast, but then -fno-unsafe-math-optimizations surely does if they use this. No way they also just randomly add a flag and hope for the best"

Do people ever actually test their fixes?

Edit: right, via btrees:

https://github.com/zopefoundation/BTrees/pull/179/files

https://github.com/zopefoundation/meta/commit/2a33089508792e...