Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / Parser / pragma-fp-contract.c
blob788fffc00d70d17737435c6f3a741f80291e736d
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 void f1(void) {
4 int x = 0;
5 /* expected-error@+1 {{'#pragma fp_contract' can only appear at file scope or at the start of a compound statement}} */
6 #pragma STDC FP_CONTRACT ON
9 void f2(void) {
10 #pragma STDC FP_CONTRACT OFF
11 #pragma STDC FP_CONTRACT ON
14 struct S1 {
15 // expected-error@+1 {{this pragma cannot appear in struct declaration}}
16 #pragma STDC FP_CONTRACT ON
17 float f1;
20 union U1 {
21 float f1;
22 float f2;
23 // expected-error@+1 {{this pragma cannot appear in union declaration}}
24 #pragma STDC FP_CONTRACT ON
27 float fp_reassoc_fail(float a, float b) {
28 // CHECK-LABEL: fp_reassoc_fail
29 // expected-error@+2{{'#pragma clang fp' can only appear at file scope or at the start of a compound statement}}
30 float c = a + b;
31 #pragma clang fp reassociate(off)
32 return c - b;
35 float fp_reassoc_no_fast(float a, float b) {
36 // CHECK-LABEL: fp_reassoc_no_fast
37 // expected-error@+1{{unexpected argument 'fast' to '#pragma clang fp reassociate'; expected 'on' or 'off'}}
38 #pragma clang fp reassociate(fast)
39 return a - b;
42 float fp_recip_fail(float a, float b) {
43 // CHECK-LABEL: fp_recip_fail
44 // expected-error@+2{{'#pragma clang fp' can only appear at file scope or at the start of a compound statement}}
45 float c = a + b;
46 #pragma clang fp reciprocal(off)
47 return c - b;
50 float fp_recip_no_fast(float a, float b) {
51 // CHECK-LABEL: fp_recip_no_fast
52 // expected-error@+1{{unexpected argument 'fast' to '#pragma clang fp reciprocal'; expected 'on' or 'off'}}
53 #pragma clang fp reciprocal(fast)
54 return a - b;