1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -DCHECK_ERROR %s -verify
3 float function_scope(float a
) {
4 #pragma float_control(precise, on) junk // expected-warning {{extra tokens at end of '#pragma float_control' - ignored}}
8 // Ok, at namespace scope.
10 #pragma float_control(push)
11 #pragma float_control(pop)
14 // Ok, within a language linkage specification.
16 #pragma float_control(push)
17 #pragma float_control(pop)
22 #pragma float_control(push)
23 #pragma float_control(pop)
28 #pragma float_control(push)
29 #pragma float_control(pop)
30 #pragma float_control(precise, on, push)
32 // Not okay within a function declaration.
33 #pragma float_control(push) // expected-error {{can only appear at file or namespace scope or within a language linkage specification}}
34 #pragma float_control(pop) // expected-error {{can only appear at file or namespace scope or within a language linkage specification}}
35 #pragma float_control(precise, on, push) // expected-error {{can only appear at file or namespace scope or within a language linkage specification}}
36 #pragma float_control(except, on, push) // expected-error {{can only appear at file or namespace scope or within a language linkage specification}}
37 #pragma float_control(except, on, push, junk) // expected-error {{float_control is malformed}}
42 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fdenormal-fp-math=preserve-sign,preserve-sign -fsyntax-only %s -DDEFAULT -verify
43 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only %s -ffp-contract=fast -DPRECISE -verify
44 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only %s -ffp-contract=off -frounding-math -ffp-exception-behavior=strict -DSTRICT -verify
45 // RUN: %clang_cc1 -triple x86_64-linux-gnu -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -ffp-contract=fast -ffast-math -ffinite-math-only -fsyntax-only %s -DFAST -verify
50 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
53 #pragma STDC FENV_ACCESS ON
54 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
58 #pragma float_control(precise, on)
59 #pragma float_control(except, on) // OK
61 #pragma float_control(except, on)
62 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
66 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
68 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
70 #pragma float_control(except, on)
71 // error: '#pragma float_control(except, on)' is illegal when precise is disabled
72 double x
= b
/ a
; // only used for fp flag setting
73 if (a
== a
) // only used for fp flag setting