]> granicus.if.org Git - clang/commit
Fix a logic bug in the handling of -fmath-errno in the driver. We would
authorChandler Carruth <chandlerc@gmail.com>
Sat, 18 May 2013 20:47:36 +0000 (20:47 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 18 May 2013 20:47:36 +0000 (20:47 +0000)
commitb69557ed6f6d5063705e60f771a612aa62ec6b22
treeba52442763ed6a4f43444054b1ca22523488557a
parentedc313343dc64c3113f01ea7cf902465e7c1da55
Fix a logic bug in the handling of -fmath-errno in the driver. We would
imply -fno-math-errno if the user passed -fno-fast-math OR -ffast-math,
regardless of in which order and regardless of the tool chain default.

I've fixed this to follow the logic:

1) If the last dominating flag is -fno-math-errno, -ffast-math, or
   -Ofast, then do not use math-errno.
2) If the last dominating flag is an explicit -fmath-errno, do use
   math-errno.
3) Otherwise, use the toolchain default.

This, for example, allows the flag sequence
'-ffast-math ... -fno-fast-math' with no mention of '-fmath-errno' or
'-fno-math-errno' to preserve the toolchain default. Most notably, this
should prevent users trying to disable fast-math optimizations on Darwin
and BSD platforms from simultaneously enabling (pointless) -fmath-errno.

I've enhanced the tests (after more reorganization) to cover this and
other weird permutations of flags and targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182203 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Driver/Tools.cpp
test/Driver/fast-math.c