[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Driver / fdefault.f90
blob29c11ad78af6e097b746359b2a13d0166168f930
1 ! Ensure argument -fdefault* work as expected.
2 ! TODO: Add checks when actual codegen is possible for this family
4 !--------------------------
5 ! FLANG DRIVER (flang-new)
6 !--------------------------
7 ! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1
8 ! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOOPTION
9 ! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang-new %s 2>&1
10 ! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=REAL8
11 ! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang-new %s 2>&1
12 ! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=DOUBLE8
13 ! RUN: not %flang -fsyntax-only -fdefault-double-8 %s 2>&1 | FileCheck %s --check-prefix=ERROR
15 !-----------------------------------------
16 ! FRONTEND FLANG DRIVER (flang-new -fc1)
17 !-----------------------------------------
18 ! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1
19 ! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOOPTION
20 ! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang-new %s 2>&1
21 ! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=REAL8
22 ! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang-new %s 2>&1
23 ! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=DOUBLE8
24 ! RUN: not %flang_fc1 -fsyntax-only -fdefault-double-8 %s 2>&1 | FileCheck %s --check-prefix=ERROR
26 !-----------------------------------------
27 ! EXPECTED OUTPUT FOR NO SPECIFICATION
28 !-----------------------------------------
29 ! NOOPTION: integer(4),parameter::real_kind=4_4
30 ! NOOPTION-NEXT: intrinsic::kind
31 ! NOOPTION-NEXT: integer(4),parameter::double_kind=8_4
33 !-------------------------------------------
34 ! EXPECTED OUTPUT FOR ONLY -fdefault-real-8
35 !-------------------------------------------
36 ! REAL8: integer(4),parameter::real_kind=8_4
37 ! REAL8-NEXT: intrinsic::kind
38 ! REAL8-NEXT: integer(4),parameter::double_kind=16_4
40 !-------------------------------------------------------------
41 ! EXPECTED OUTPUT FOR -fdefault-real-8 AND -fdefault-double-8
42 !-------------------------------------------------------------
43 ! DOUBLE8: integer(4),parameter::real_kind=8_4
44 ! DOUBLE8-NEXT: intrinsic::kind
45 ! DOUBLE8-NEXT: integer(4),parameter::double_kind=8_4
47 !------------------------------------------------------
48 ! EXPECTED OUTPUT FOR PROVIDING ONLY -fdefault-double-8
49 !------------------------------------------------------
50 ! ERROR: Use of `-fdefault-double-8` requires `-fdefault-real-8`
52 module m
53 implicit none
54 real :: x
55 double precision :: y
56 integer, parameter :: real_kind = kind(x) !-fdefault-real-8
57 integer, parameter :: double_kind = kind(y) !-fdefault-double-8
58 end