1 // Test that incompatible combinations of -ffp-model= options
2 // and other floating point options get a warning diagnostic.
5 // RUN: %clang -### -ffp-model=fast -ffp-contract=off -c %s 2>&1 \
6 // RUN: | FileCheck --check-prefix=WARN %s
7 // WARN: warning: overriding '-ffp-model=fast' option with '-ffp-contract=off' [-Woverriding-t-option]
9 // RUN: %clang -### -ffp-model=fast -ffp-contract=on -c %s 2>&1 \
10 // RUN: | FileCheck --check-prefix=WARN1 %s
11 // WARN1: warning: overriding '-ffp-model=fast' option with '-ffp-contract=on' [-Woverriding-t-option]
13 // RUN: %clang -### -ffp-model=strict -fassociative-math -c %s 2>&1 \
14 // RUN: | FileCheck --check-prefix=WARN2 %s
15 // WARN2: warning: overriding '-ffp-model=strict' option with '-fassociative-math' [-Woverriding-t-option]
17 // RUN: %clang -### -ffp-model=strict -ffast-math -c %s 2>&1 \
18 // RUN: | FileCheck --check-prefix=WARN3 %s
19 // WARN3: warning: overriding '-ffp-model=strict' option with '-ffast-math' [-Woverriding-t-option]
21 // RUN: %clang -### -ffp-model=strict -ffinite-math-only -c %s 2>&1 \
22 // RUN: | FileCheck --check-prefix=WARN4 %s
23 // WARN4: warning: overriding '-ffp-model=strict' option with '-ffinite-math-only' [-Woverriding-t-option]
25 // RUN: %clang -### -ffp-model=strict -ffp-contract=fast -c %s 2>&1 \
26 // RUN: | FileCheck --check-prefix=WARN5 %s
27 // WARN5: warning: overriding '-ffp-model=strict' option with '-ffp-contract=fast' [-Woverriding-t-option]
29 // RUN: %clang -### -ffp-model=strict -ffp-contract=on -c %s 2>&1 \
30 // RUN: | FileCheck --check-prefix=WARN7 %s
31 // WARN7: warning: overriding '-ffp-model=strict' option with '-ffp-contract=on' [-Woverriding-t-option]
33 // RUN: %clang -### -ffp-model=strict -fno-honor-infinities -c %s 2>&1 \
34 // RUN: | FileCheck --check-prefix=WARN8 %s
35 // WARN8: warning: overriding '-ffp-model=strict' option with '-fno-honor-infinities' [-Woverriding-t-option]
37 // RUN: %clang -### -ffp-model=strict -fno-honor-nans -c %s 2>&1 \
38 // RUN: | FileCheck --check-prefix=WARN9 %s
39 // WARN9: warning: overriding '-ffp-model=strict' option with '-fno-honor-nans' [-Woverriding-t-option]
41 // RUN: %clang -### -ffp-model=strict -fno-rounding-math -c %s 2>&1 \
42 // RUN: | FileCheck --check-prefix=WARNa %s
43 // WARNa: warning: overriding '-ffp-model=strict' option with '-fno-rounding-math' [-Woverriding-t-option]
45 // RUN: %clang -### -ffp-model=strict -fno-signed-zeros -c %s 2>&1 \
46 // RUN: | FileCheck --check-prefix=WARNb %s
47 // WARNb: warning: overriding '-ffp-model=strict' option with '-fno-signed-zeros' [-Woverriding-t-option]
49 // RUN: %clang -### -ffp-model=strict -fno-trapping-math -c %s 2>&1 \
50 // RUN: | FileCheck --check-prefix=WARNc %s
51 // WARNc: warning: overriding '-ffp-model=strict' option with '-fno-trapping-math' [-Woverriding-t-option]
53 // RUN: %clang -### -ffp-model=strict -freciprocal-math -c %s 2>&1 \
54 // RUN: | FileCheck --check-prefix=WARNd %s
55 // WARNd: warning: overriding '-ffp-model=strict' option with '-freciprocal-math' [-Woverriding-t-option]
57 // RUN: %clang -### -ffp-model=strict -funsafe-math-optimizations -c %s 2>&1 \
58 // RUN: | FileCheck --check-prefix=WARNe %s
59 // WARNe: warning: overriding '-ffp-model=strict' option with '-funsafe-math-optimizations' [-Woverriding-t-option]
61 // RUN: %clang -### -ffp-model=strict -Ofast -c %s 2>&1 \
62 // RUN: | FileCheck --check-prefix=WARNf %s
63 // WARNf: warning: overriding '-ffp-model=strict' option with '-Ofast' [-Woverriding-t-option]
65 // RUN: %clang -### -ffp-model=strict -fdenormal-fp-math=preserve-sign,preserve-sign -c %s 2>&1 \
66 // RUN: | FileCheck --check-prefix=WARN10 %s
67 // WARN10: warning: overriding '-ffp-model=strict' option with '-fdenormal-fp-math=preserve-sign,preserve-sign' [-Woverriding-t-option]
69 // RUN: %clang -### -ffp-model=fast -ffp-model=strict -c %s 2>&1 | FileCheck \
70 // RUN: --check-prefix=WARN11 %s
71 // WARN11: warning: overriding '-ffp-model=fast' option with '-ffp-model=strict' [-Woverriding-t-option]
72 // WARN11-NOT: warning: overriding '-ffp-model=strict' option with '-ffp-model=strict' [-Woverriding-t-option]
74 // RUN: %clang -### -Ofast -ffp-model=strict -c %s 2>&1 | FileCheck \
75 // RUN: --check-prefix=WARN12 %s
76 // RUN: %clang -### -ffast-math -ffp-model=strict -c %s 2>&1 | FileCheck \
77 // RUN: --check-prefix=WARN12 %s
78 // WARN12-NOT: warning: overriding '-ffp-model=strict' option with '-ffp-model=strict' [-Woverriding-t-option]
80 // RUN: %clang -### -ffp-model=strict -fapprox-func -c %s 2>&1 \
81 // RUN: | FileCheck --check-prefix=WARN13 %s
82 // WARN13: warning: overriding '-ffp-model=strict' option with '-fapprox-func' [-Woverriding-t-option]
84 // RUN: %clang -### -c %s 2>&1 \
85 // RUN: | FileCheck --check-prefix=CHECK-NOROUND %s
86 // CHECK-NOROUND: "-cc1"
87 // CHECK-NOROUND: "-fno-rounding-math"
89 // RUN: %clang -### -frounding-math -c %s 2>&1 \
90 // RUN: | FileCheck --check-prefix=CHECK-ROUND --implicit-check-not ffp-exception-behavior=strict %s
91 // CHECK-ROUND: "-cc1"
92 // CHECK-ROUND: "-frounding-math"
94 // RUN: %clang -### -ftrapping-math -c %s 2>&1 \
95 // RUN: | FileCheck --check-prefix=CHECK-TRAP %s
97 // CHECK-TRAP: "-ffp-exception-behavior=strict"
99 // RUN: %clang -### -nostdinc -ffp-model=fast -c %s 2>&1 \
100 // RUN: | FileCheck --check-prefix=CHECK-FPM-FAST %s
101 // CHECK-FPM-FAST: "-cc1"
102 // CHECK-FPM-FAST: "-menable-no-infs"
103 // CHECK-FPM-FAST: "-menable-no-nans"
104 // CHECK-FPM-FAST: "-fapprox-func"
105 // CHECK-FPM-FAST: "-funsafe-math-optimizations"
106 // CHECK-FPM-FAST: "-fno-signed-zeros"
107 // CHECK-FPM-FAST: "-mreassociate"
108 // CHECK-FPM-FAST: "-freciprocal-math"
109 // CHECK-FPM-FAST: "-ffp-contract=fast"
110 // CHECK-FPM-FAST: "-fno-rounding-math"
111 // CHECK-FPM-FAST: "-ffast-math"
112 // CHECK-FPM-FAST: "-ffinite-math-only"
114 // RUN: %clang -### -nostdinc -ffp-model=precise -c %s 2>&1 \
115 // RUN: | FileCheck --check-prefix=CHECK-FPM-PRECISE %s
116 // CHECK-FPM-PRECISE: "-cc1"
117 // CHECK-FPM-PRECISE: "-ffp-contract=on"
118 // CHECK-FPM-PRECISE: "-fno-rounding-math"
120 // RUN: %clang -### -nostdinc -ffp-model=strict -c %s 2>&1 \
121 // RUN: | FileCheck --check-prefix=CHECK-FPM-STRICT %s
122 // CHECK-FPM-STRICT: "-cc1"
123 // CHECK-FPM-STRICT: "-frounding-math"
124 // CHECK-FPM-STRICT: "-ffp-exception-behavior=strict"
126 // RUN: %clang -### -nostdinc -ffp-model=strict -ffp-model=fast -c %s 2>&1 \
127 // RUN: | FileCheck --check-prefix=CHECK-NO-EXCEPT %s
128 // RUN: %clang -### -nostdinc -ffp-model=strict -ffast-math -c %s 2>&1 \
129 // RUN: | FileCheck --check-prefix=CHECK-NO-EXCEPT %s
130 // RUN: %clang -### -nostdinc -ffp-model=strict -Ofast -c %s 2>&1 \
131 // RUN: | FileCheck --check-prefix=CHECK-NO-EXCEPT %s
132 // CHECK-NO-EXCEPT-NOT: "-ffp-exception-behavior=strict"
134 // RUN: %clang -### -nostdinc -ffp-exception-behavior=strict -c %s 2>&1 \
135 // RUN: | FileCheck --check-prefix=CHECK-FEB-STRICT %s
136 // CHECK-FEB-STRICT: "-cc1"
137 // CHECK-FEB-STRICT: "-fno-rounding-math"
138 // CHECK-FEB-STRICT: "-ffp-exception-behavior=strict"
140 // RUN: %clang -### -nostdinc -ffp-exception-behavior=maytrap -c %s 2>&1 \
141 // RUN: | FileCheck --check-prefix=CHECK-FEB-MAYTRAP %s
142 // CHECK-FEB-MAYTRAP: "-cc1"
143 // CHECK-FEB-MAYTRAP: "-fno-rounding-math"
144 // CHECK-FEB-MAYTRAP: "-ffp-exception-behavior=maytrap"
146 // RUN: %clang -### -nostdinc -ffp-exception-behavior=ignore -c %s 2>&1 \
147 // RUN: | FileCheck --check-prefix=CHECK-FEB-IGNORE %s
148 // CHECK-FEB-IGNORE: "-cc1"
149 // CHECK-FEB-IGNORE: "-fno-rounding-math"
150 // CHECK-FEB-IGNORE: "-ffp-exception-behavior=ignore"
152 // RUN: %clang -### -nostdinc -ffast-math -ffp-model=fast -c %s 2>&1 \
153 // RUN: | FileCheck --check-prefix=CHECK-FASTMATH-FPM-FAST %s
154 // CHECK-FASTMATH-FPM-FAST: "-cc1"
155 // CHECK-FASTMATH-FPM-FAST: "-menable-no-infs"
156 // CHECK-FASTMATH-FPM-FAST: "-menable-no-nans"
157 // CHECK-FASTMATH-FPM-FAST: "-fapprox-func"
158 // CHECK-FASTMATH-FPM-FAST: "-funsafe-math-optimizations"
159 // CHECK-FASTMATH-FPM-FAST: "-fno-signed-zeros"
160 // CHECK-FASTMATH-FPM-FAST: "-mreassociate"
161 // CHECK-FASTMATH-FPM-FAST: "-freciprocal-math"
162 // CHECK-FASTMATH-FPM-FAST: "-ffp-contract=fast"
163 // CHECK-FASTMATH-FPM-FAST: "-fno-rounding-math"
164 // CHECK-FASTMATH-FPM-FAST: "-ffast-math"
165 // CHECK-FASTMATH-FPM-FAST: "-ffinite-math-only"
167 // RUN: %clang -### -nostdinc -ffast-math -ffp-model=precise -c %s 2>&1 \
168 // RUN: | FileCheck --check-prefix=CHECK-FASTMATH-FPM-PRECISE %s
169 // CHECK-FASTMATH-FPM-PRECISE: "-cc1"
170 // CHECK-FASTMATH-FPM-PRECISE-NOT: "-menable-no-infs"
171 // CHECK-FASTMATH-FPM-PRECISE-NOT: "-menable-no-nans"
172 // CHECK-FASTMATH-FPM-PRECISE-NOT: "-fapprox-func"
173 // CHECK-FASTMATH-FPM-PRECISE-NOT: "-funsafe-math-optimizations"
174 // CHECK-FASTMATH-FPM-PRECISE-NOT: "-fno-signed-zeros"
175 // CHECK-FASTMATH-FPM-PRECISE-NOT: "-mreassociate"
176 // CHECK-FASTMATH-FPM-PRECISE-NOT: "-freciprocal-math"
177 // CHECK-FASTMATH-FPM-PRECISE: "-ffp-contract=on"
178 // CHECK-FASTMATH-FPM-PRECISE: "-fno-rounding-math"
179 // CHECK-FASTMATH-FPM-PRECISE-NOT: "-ffast-math"
180 // CHECK-FASTMATH-FPM-PRECISE-NOT: "-ffinite-math-only"
182 // RUN: %clang -### -nostdinc -ffast-math -ffp-model=strict -c %s 2>&1 \
183 // RUN: | FileCheck --check-prefix=CHECK-FASTMATH-FPM-STRICT %s
184 // CHECK-FASTMATH-FPM-STRICT: "-cc1"
185 // CHECK-FASTMATH-FPM-STRICT-NOT: "-menable-no-infs"
186 // CHECK-FASTMATH-FPM-STRICT-NOT: "-menable-no-nans"
187 // CHECK-FASTMATH-FPM-STRICT-NOT: "-fapprox-func"
188 // CHECK-FASTMATH-FPM-STRICT-NOT: "-funsafe-math-optimizations"
189 // CHECK-FASTMATH-FPM-STRICT-NOT: "-fno-signed-zeros"
190 // CHECK-FASTMATH-FPM-STRICT-NOT: "-mreassociate"
191 // CHECK-FASTMATH-FPM-STRICT-NOT: "-freciprocal-math"
192 // CHECK-FASTMATH-FPM-STRICT: "-ffp-contract=off"
193 // CHECK-FASTMATH-FPM-STRICT-NOT: "-fno-rounding-math"
194 // CHECK-FASTMATH-FPM-STRICT-NOT: "-ffast-math"
195 // CHECK-FASTMATH-FPM-STRICT-NOT: "-ffinite-math-only"