Clang does not undefine __FAST_MATH__

Originator:dairgrant
Number:rdar://12299433 Date Originated:2012/09/14
Status:Open Resolved:
Product:Developer Tools Product Version:4.4.1
Classification:Other Bug Reproducible:Always
 
Clang supports the -ffast-math flag from gcc, and as per gcc will define __FAST_MATH__ when it is set. Unlike gcc, a subsequent -fno-fast-math does not undefine the __FAST_MATH__ macro.

Most of our config options are set in .xcconfig files, where we turn on fast math by default. For some source files we need to lower this, so provide a per-file compiler flag to turn it off.

This produces a command line which contains both flags (first turning it on, then turning it off): under gcc the code can test for the current mode using __FAST_MATH__, under clang it always appears to be on.

Seen in Xcode 4.4.1, clang version 4.0:

  Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
  Target: x86_64-apple-darwin12.1.0
  Thread model: posix

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!