1! XFAIL: *
2! Test that Clang can forward all of the flags which are documented as
3! being supported by gfortran to GCC when falling back to GCC for
4! a fortran input file.
5!
6! RUN: %clang -no-canonical-prefixes -target i386-linux -### %s -o %t 2>&1 \
7! RUN:     -Aquestion=answer \
8! RUN:     -A-question=answer \
9! RUN:     -C \
10! RUN:     -CC \
11! RUN:     -Dmacro \
12! RUN:     -Dmacro=value \
13! RUN:     -H \
14! RUN:     -Isome/directory \
15! RUN:     -Jsome/other/directory \
16! RUN:     -P \
17! RUN:     -Umacro \
18! RUN:     -Waliasing \
19! RUN:     -Walign-commons \
20! RUN:     -Wall \
21! RUN:     -Wampersand \
22! RUN:     -Warray-bounds \
23! RUN:     -Wc-binding-type \
24! RUN:     -Wcharacter-truncation \
25! RUN:     -Wconversion \
26! RUN:     -Wfunction-elimination \
27! RUN:     -Wimplicit-interface \
28! RUN:     -Wimplicit-procedure \
29! RUN:     -Wintrinsic-shadow \
30! RUN:     -Wintrinsics-std \
31! RUN:     -Wline-truncation \
32! RUN:     -Wreal-q-constant \
33! RUN:     -Wrealloc-lhs \
34! RUN:     -Wsurprising \
35! RUN:     -Wtabs \
36! RUN:     -Wtarget-lifetime \
37! RUN:     -Wunderflow \
38! RUN:     -Wunused-parameter \
39! RUN:     -cpp \
40! RUN:     -dD \
41! RUN:     -dI \
42! RUN:     -dM \
43! RUN:     -dN \
44! RUN:     -dU \
45! RUN:     -faggressive-function-elimination \
46! RUN:     -falign-commons \
47! RUN:     -fall-intrinsics \
48! RUN:     -fautomatic \
49! RUN:     -fbackslash \
50! RUN:     -fbacktrace \
51! RUN:     -fblas-matmul-limit=42 \
52! RUN:     -fbounds-check \
53! RUN:     -fcheck-array-temporaries \
54! RUN:     -fcheck=all \
55! RUN:     -fcoarray=none \
56! RUN:     -fconvert=foobar \
57! RUN:     -fcray-pointer \
58! RUN:     -fd-lines-as-code \
59! RUN:     -fd-lines-as-comments \
60! RUN:     -fdefault-double-8 \
61! RUN:     -fdefault-integer-8 \
62! RUN:     -fdefault-real-8 \
63! RUN:     -fdollar-ok \
64! RUN:     -fdump-fortran-optimized \
65! RUN:     -fdump-fortran-original \
66! RUN:     -fdump-parse-tree \
67! RUN:     -fexternal-blas \
68! RUN:     -ff2c \
69! RUN:     -ffixed-form \
70! RUN:     -ffixed-line-length-42 \
71! RUN:     -ffpe-trap=list \
72! RUN:     -ffree-form \
73! RUN:     -ffree-line-length-42 \
74! RUN:     -ffrontend-optimize \
75! RUN:     -fimplicit-none \
76! RUN:     -finit-character=n \
77! RUN:     -finit-integer=n \
78! RUN:     -finit-local-zero \
79! RUN:     -finit-logical=false \
80! RUN:     -finit-real=zero \
81! RUN:     -finteger-4-integer-8 \
82! RUN:     -fintrinsic-modules-path \
83! RUN:     -fmax-array-constructor=42 \
84! RUN:     -fmax-errors=42 \
85! RUN:     -fmax-identifier-length \
86! RUN:     -fmax-stack-var-size=42 \
87! RUN:     -fmax-subrecord-length=42 \
88! RUN:     -fmodule-private \
89! RUN:     -fopenmp \
90! RUN:     -fpack-derived \
91! RUN:     -fprotect-parens \
92! RUN:     -frange-check \
93! RUN:     -freal-4-real-10 \
94! RUN:     -freal-4-real-16 \
95! RUN:     -freal-4-real-8 \
96! RUN:     -freal-8-real-10 \
97! RUN:     -freal-8-real-16 \
98! RUN:     -freal-8-real-4 \
99! RUN:     -frealloc-lhs \
100! RUN:     -frecord-marker=42 \
101! RUN:     -frecursive \
102! RUN:     -frepack-arrays \
103! RUN:     -fsecond-underscore \
104! RUN:     -fshort-enums \
105! RUN:     -fsign-zero \
106! RUN:     -fstack-arrays \
107! RUN:     -fsyntax-only \
108! RUN:     -funderscoring \
109! RUN:     -fwhole-file \
110! RUN:     -imultilib \
111! RUN:     -iprefix \
112! RUN:     -iquote \
113! RUN:     -isysroot \
114! RUN:     -isystem \
115! RUN:     -nocpp \
116! RUN:     -nostdinc \
117! RUN:     -pedantic \
118! RUN:     -pedantic-errors \
119! RUN:     -static-libgfortran \
120! RUN:     -std=f90 \
121! RUN:     -undef \
122! RUN:   | FileCheck %s
123!
124! FIXME: Several of these shouldn't necessarily be rendered separately
125! when passing to GCC... Hopefully their driver handles this.
126!
127! CHECK: "-Aquestion=answer"
128! CHECK: "-A-question=answer"
129! CHECK: "-C"
130! CHECK: "-CC"
131! CHECK: "-D" "macro"
132! CHECK: "-D" "macro=value"
133! CHECK: "-H"
134! CHECK: "-I" "some/directory"
135! CHECK: "-Jsome/other/directory"
136! CHECK: "-P"
137! CHECK: "-U" "macro"
138! CHECK: "-Waliasing"
139! CHECK: "-Walign-commons"
140! CHECK: "-Wall"
141! CHECK: "-Wampersand"
142! CHECK: "-Warray-bounds"
143! CHECK: "-Wc-binding-type"
144! CHECK: "-Wcharacter-truncation"
145! CHECK: "-Wconversion"
146! CHECK: "-Wfunction-elimination"
147! CHECK: "-Wimplicit-interface"
148! CHECK: "-Wimplicit-procedure"
149! CHECK: "-Wintrinsic-shadow"
150! CHECK: "-Wintrinsics-std"
151! CHECK: "-Wline-truncation"
152! CHECK: "-Wreal-q-constant"
153! CHECK: "-Wrealloc-lhs"
154! CHECK: "-Wsurprising"
155! CHECK: "-Wtabs"
156! CHECK: "-Wtarget-lifetime"
157! CHECK: "-Wunderflow"
158! CHECK: "-Wunused-parameter"
159! CHECK: "-cpp"
160! CHECK: "-dD"
161! CHECK: "-dI"
162! CHECK: "-dM"
163! CHECK: "-dN"
164! CHECK: "-dU"
165! CHECK: "-faggressive-function-elimination"
166! CHECK: "-falign-commons"
167! CHECK: "-fall-intrinsics"
168! CHECK: "-fautomatic"
169! CHECK: "-fbackslash"
170! CHECK: "-fbacktrace"
171! CHECK: "-fblas-matmul-limit=42"
172! CHECK: "-fbounds-check"
173! CHECK: "-fcheck-array-temporaries"
174! CHECK: "-fcheck=all"
175! CHECK: "-fcoarray=none"
176! CHECK: "-fconvert=foobar"
177! CHECK: "-fcray-pointer"
178! CHECK: "-fd-lines-as-code"
179! CHECK: "-fd-lines-as-comments"
180! CHECK: "-fdefault-double-8"
181! CHECK: "-fdefault-integer-8"
182! CHECK: "-fdefault-real-8"
183! CHECK: "-fdollar-ok"
184! CHECK: "-fdump-fortran-optimized"
185! CHECK: "-fdump-fortran-original"
186! CHECK: "-fdump-parse-tree"
187! CHECK: "-fexternal-blas"
188! CHECK: "-ff2c"
189! CHECK: "-ffixed-form"
190! CHECK: "-ffixed-line-length-42"
191! CHECK: "-ffpe-trap=list"
192! CHECK: "-ffree-form"
193! CHECK: "-ffree-line-length-42"
194! CHECK: "-ffrontend-optimize"
195! CHECK: "-fimplicit-none"
196! CHECK: "-finit-character=n"
197! CHECK: "-finit-integer=n"
198! CHECK: "-finit-local-zero"
199! CHECK: "-finit-logical=false"
200! CHECK: "-finit-real=zero"
201! CHECK: "-finteger-4-integer-8"
202! CHECK: "-fintrinsic-modules-path"
203! CHECK: "-fmax-array-constructor=42"
204! CHECK: "-fmax-errors=42"
205! CHECK: "-fmax-identifier-length"
206! CHECK: "-fmax-stack-var-size=42"
207! CHECK: "-fmax-subrecord-length=42"
208! CHECK: "-fmodule-private"
209! CHECK: "-fopenmp"
210! CHECK: "-fpack-derived"
211! CHECK: "-fprotect-parens"
212! CHECK: "-frange-check"
213! CHECK: "-freal-4-real-10"
214! CHECK: "-freal-4-real-16"
215! CHECK: "-freal-4-real-8"
216! CHECK: "-freal-8-real-10"
217! CHECK: "-freal-8-real-16"
218! CHECK: "-freal-8-real-4"
219! CHECK: "-frealloc-lhs"
220! CHECK: "-frecord-marker=42"
221! CHECK: "-frecursive"
222! CHECK: "-frepack-arrays"
223! CHECK: "-fsecond-underscore"
224! CHECK: "-fshort-enums"
225! CHECK: "-fsign-zero"
226! CHECK: "-fstack-arrays"
227! CHECK: "-funderscoring"
228! CHECK: "-fwhole-file"
229! CHECK: "-imultilib"
230! CHECK: "-iprefix"
231! CHECK: "-iquote"
232! CHECK: "-isysroot"
233! CHECK: "-isystem"
234! CHECK: "-nocpp"
235! CHECK: "-nostdinc"
236! CHECK: "-pedantic"
237! CHECK: "-pedantic-errors"
238! CHECK: "-static-libgfortran"
239! CHECK: "-std=f90"
240! CHECK: "-undef"
241!
242! Clang understands this one and orders it weirdly.
243! CHECK: "-fsyntax-only"
244!
245! PR22234: Ensure that -fsyntax-only doesn't complain about output types and
246!          passes along correctly.
247! RUN: %clang -no-canonical-prefixes -target i386-linux -fsyntax-only -### %s -o %t 2>&1 | \
248! grep for error message and command-line
249! RUN: grep -e error: -e -fsyntax-only | FileCheck %s --check-prefix=CHECK-PR22234
250!
251! CHECK-PR22234-NOT: clang: error: invalid output type
252! CHECK-PR22234: "-fsyntax-only"
253!
254! Regression test for the bug introduced with PR22234 fix.
255! Make sure -fsyntax-only is not passed to gfortran during normal compilation.
256!
257! RUN: %clang -no-canonical-prefixes -target i386-linux -### %s -o %t 2>&1 \
258! RUN: | FileCheck %s --check-prefix=CHECK-PR22234-R
259! CHECK-PR22234-R-NOT: "-fsyntax-only"
260