]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/fortran/gfortran.h
ipa-fnsummary: Remove inconsistent bp_pack_value
[thirdparty/gcc.git] / gcc / fortran / gfortran.h
CommitLineData
6de9cd9a 1/* gfortran header file
99dee823 2 Copyright (C) 2000-2021 Free Software Foundation, Inc.
6de9cd9a
DN
3 Contributed by Andy Vaught
4
9fc4d79b 5This file is part of GCC.
6de9cd9a 6
9fc4d79b
TS
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
d234d788 9Software Foundation; either version 3, or (at your option) any later
9fc4d79b 10version.
6de9cd9a 11
9fc4d79b
TS
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
6de9cd9a
DN
16
17You should have received a copy of the GNU General Public License
d234d788
NC
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
6de9cd9a
DN
20
21#ifndef GCC_GFORTRAN_H
22#define GCC_GFORTRAN_H
23
24/* It's probably insane to have this large of a header file, but it
25 seemed like everything had to be recompiled anyway when a change
26 was made to a header file, and there were ordering issues with
27 multiple header files. Besides, Microsoft's winnt.h was 250k last
28 time I looked, so by comparison this is perfectly reasonable. */
29
953bee7c
SB
30#ifndef GCC_CORETYPES_H
31#error "gfortran.h must be included after coretypes.h"
32#endif
33
8e54f6d3
MLI
34/* In order for the format checking to accept the Fortran front end
35 diagnostic framework extensions, you must include this file before
36 diagnostic-core.h, not after. We override the definition of GCC_DIAG_STYLE
37 in c-common.h. */
38#undef GCC_DIAG_STYLE
39#define GCC_DIAG_STYLE __gcc_gfc__
40#if defined(GCC_DIAGNOSTIC_CORE_H)
41#error \
42In order for the format checking to accept the Fortran front end diagnostic \
43framework extensions, you must include this file before diagnostic-core.h, \
44not after.
45#endif
46
d74b97cc
FXC
47/* Declarations common to the front-end and library are put in
48 libgfortran/libgfortran_frontend.h */
49#include "libgfortran.h"
50
51
31043f6c 52#include "intl.h"
5868cbf9 53#include "splay-tree.h"
6de9cd9a 54
6de9cd9a
DN
55/* Major control parameters. */
56
1dde8683 57#define GFC_MAX_SYMBOL_LEN 63 /* Must be at least 63 for F2003. */
6de9cd9a 58#define GFC_LETTERS 26 /* Number of letters in the alphabet. */
6de9cd9a 59
07b3bbf2
TK
60#define MAX_SUBRECORD_LENGTH 2147483639 /* 2**31-9 */
61
62
ef144767 63#define gfc_is_whitespace(c) ((c==' ') || (c=='\t') || (c=='\f'))
6de9cd9a 64
f6288c24
FR
65/* Macros to check for groups of structure-like types and flavors since
66 derived types, structures, maps, unions are often treated similarly. */
67#define gfc_bt_struct(t) \
68 ((t) == BT_DERIVED || (t) == BT_UNION)
69#define gfc_fl_struct(f) \
70 ((f) == FL_DERIVED || (f) == FL_UNION || (f) == FL_STRUCT)
71#define case_bt_struct case BT_DERIVED: case BT_UNION
72#define case_fl_struct case FL_DERIVED: case FL_UNION: case FL_STRUCT
73
6de9cd9a
DN
74/* Stringization. */
75#define stringize(x) expand_macro(x)
76#define expand_macro(x) # x
77
df2fba9e 78/* For the runtime library, a standard prefix is a requirement to
6de9cd9a
DN
79 avoid cluttering the namespace with things nobody asked for. It's
80 ugly to look at and a pain to type when you add the prefix by hand,
81 so we hide it behind a macro. */
82#define PREFIX(x) "_gfortran_" x
5b200ac2 83#define PREFIX_LEN 10
6de9cd9a 84
36085529
TB
85/* A prefix for internal variables, which are not user-visible. */
86#if !defined (NO_DOT_IN_LABEL)
87# define GFC_PREFIX(x) "_F." x
88#elif !defined (NO_DOLLAR_IN_LABEL)
89# define GFC_PREFIX(x) "_F$" x
90#else
91# define GFC_PREFIX(x) "_F_" x
92#endif
93
30aabb86
PT
94#define BLANK_COMMON_NAME "__BLNK__"
95
6de9cd9a
DN
96/* Macro to initialize an mstring structure. */
97#define minit(s, t) { s, NULL, t }
98
99/* Structure for storing strings to be matched by gfc_match_string. */
100typedef struct
101{
102 const char *string;
103 const char *mp;
104 int tag;
105}
106mstring;
107
108
944b8b35 109
6de9cd9a
DN
110/*************************** Enums *****************************/
111
ad7ee6f8
JD
112/* Used when matching and resolving data I/O transfer statements. */
113
a79683d5
TS
114enum io_kind
115{ M_READ, M_WRITE, M_PRINT, M_INQUIRE };
ad7ee6f8 116
6de9cd9a 117
696abb30
JD
118/* These are flags for identifying whether we are reading a character literal
119 between quotes or normal source code. */
4d382327 120
a79683d5
TS
121enum gfc_instring
122{ NONSTRING = 0, INSTRING_WARN, INSTRING_NOWARN };
696abb30 123
8f0d39a8
FXC
124/* This is returned by gfc_notification_std to know if, given the flags
125 that were given (-std=, -pedantic) we should issue an error, a warning
126 or nothing. */
127
a79683d5
TS
128enum notification
129{ SILENT, WARNING, ERROR };
8f0d39a8 130
6de9cd9a
DN
131/* Matchers return one of these three values. The difference between
132 MATCH_NO and MATCH_ERROR is that MATCH_ERROR means that a match was
133 successful, but that something non-syntactic is wrong and an error
134 has already been issued. */
135
a79683d5
TS
136enum match
137{ MATCH_NO = 1, MATCH_YES, MATCH_ERROR };
6de9cd9a 138
696abb30 139/* Used for different Fortran source forms in places like scanner.c. */
a79683d5
TS
140enum gfc_source_form
141{ FORM_FREE, FORM_FIXED, FORM_UNKNOWN };
6de9cd9a 142
6de9cd9a 143/* Expression node types. */
a79683d5 144enum expr_t
7e703f01 145 { EXPR_UNKNOWN = 0, EXPR_OP = 1, EXPR_FUNCTION, EXPR_CONSTANT, EXPR_VARIABLE,
713485cc 146 EXPR_SUBSTRING, EXPR_STRUCTURE, EXPR_ARRAY, EXPR_NULL, EXPR_COMPCALL, EXPR_PPC
a79683d5 147};
6de9cd9a
DN
148
149/* Array types. */
a79683d5 150enum array_type
6de9cd9a 151{ AS_EXPLICIT = 1, AS_ASSUMED_SHAPE, AS_DEFERRED,
c62c6622
TB
152 AS_ASSUMED_SIZE, AS_IMPLIED_SHAPE, AS_ASSUMED_RANK,
153 AS_UNKNOWN
a79683d5 154};
6de9cd9a 155
a79683d5
TS
156enum ar_type
157{ AR_FULL = 1, AR_ELEMENT, AR_SECTION, AR_UNKNOWN };
6de9cd9a 158
f3e7b9d6
TB
159/* Statement label types. ST_LABEL_DO_TARGET is used for obsolescent warnings
160 related to shared DO terminations and DO targets which are neither END DO
161 nor CONTINUE; otherwise it is identical to ST_LABEL_TARGET. */
a79683d5 162enum gfc_sl_type
f3e7b9d6 163{ ST_LABEL_UNKNOWN = 1, ST_LABEL_TARGET, ST_LABEL_DO_TARGET,
6de9cd9a 164 ST_LABEL_BAD_TARGET, ST_LABEL_FORMAT
a79683d5 165};
6de9cd9a
DN
166
167/* Intrinsic operators. */
a79683d5 168enum gfc_intrinsic_op
6de9cd9a
DN
169{ GFC_INTRINSIC_BEGIN = 0,
170 INTRINSIC_NONE = -1, INTRINSIC_UPLUS = GFC_INTRINSIC_BEGIN,
171 INTRINSIC_UMINUS, INTRINSIC_PLUS, INTRINSIC_MINUS, INTRINSIC_TIMES,
172 INTRINSIC_DIVIDE, INTRINSIC_POWER, INTRINSIC_CONCAT,
173 INTRINSIC_AND, INTRINSIC_OR, INTRINSIC_EQV, INTRINSIC_NEQV,
3bed9dd0 174 /* ==, /=, >, >=, <, <= */
6de9cd9a 175 INTRINSIC_EQ, INTRINSIC_NE, INTRINSIC_GT, INTRINSIC_GE,
4d382327 176 INTRINSIC_LT, INTRINSIC_LE,
3bed9dd0
DF
177 /* .EQ., .NE., .GT., .GE., .LT., .LE. (OS = Old-Style) */
178 INTRINSIC_EQ_OS, INTRINSIC_NE_OS, INTRINSIC_GT_OS, INTRINSIC_GE_OS,
4d382327 179 INTRINSIC_LT_OS, INTRINSIC_LE_OS,
e73d3ca6 180 INTRINSIC_NOT, INTRINSIC_USER, INTRINSIC_ASSIGN, INTRINSIC_PARENTHESES,
195d1431
PT
181 GFC_INTRINSIC_END, /* Sentinel */
182 /* User defined derived type pseudo operators. These are set beyond the
183 sentinel so that they are excluded from module_read and module_write. */
184 INTRINSIC_FORMATTED, INTRINSIC_UNFORMATTED
a79683d5 185};
6de9cd9a 186
6de9cd9a
DN
187/* This macro is the number of intrinsic operators that exist.
188 Assumptions are made about the numbering of the interface_op enums. */
189#define GFC_INTRINSIC_OPS GFC_INTRINSIC_END
190
191/* Arithmetic results. */
a79683d5 192enum arith
f8e566e5 193{ ARITH_OK = 1, ARITH_OVERFLOW, ARITH_UNDERFLOW, ARITH_NAN,
7318fdca
TK
194 ARITH_DIV0, ARITH_INCOMMENSURATE, ARITH_ASYMMETRIC, ARITH_PROHIBIT,
195 ARITH_WRONGCONCAT
a79683d5 196};
6de9cd9a
DN
197
198/* Statements. */
a79683d5 199enum gfc_statement
6de9cd9a 200{
03af1e4c
DK
201 ST_ARITHMETIC_IF, ST_ALLOCATE, ST_ATTR_DECL, ST_ASSOCIATE,
202 ST_BACKSPACE, ST_BLOCK, ST_BLOCK_DATA,
6de9cd9a
DN
203 ST_CALL, ST_CASE, ST_CLOSE, ST_COMMON, ST_CONTINUE, ST_CONTAINS, ST_CYCLE,
204 ST_DATA, ST_DATA_DECL, ST_DEALLOCATE, ST_DO, ST_ELSE, ST_ELSEIF,
03af1e4c 205 ST_ELSEWHERE, ST_END_ASSOCIATE, ST_END_BLOCK, ST_END_BLOCK_DATA,
4668d6f9
PT
206 ST_ENDDO, ST_IMPLIED_ENDDO, ST_END_FILE, ST_FINAL, ST_FLUSH, ST_END_FORALL,
207 ST_END_FUNCTION, ST_ENDIF, ST_END_INTERFACE, ST_END_MODULE, ST_END_SUBMODULE,
208 ST_END_PROGRAM, ST_END_SELECT, ST_END_SUBROUTINE, ST_END_WHERE, ST_END_TYPE,
209 ST_ENTRY, ST_EQUIVALENCE, ST_ERROR_STOP, ST_EXIT, ST_FORALL, ST_FORALL_BLOCK,
210 ST_FORMAT, ST_FUNCTION, ST_GOTO, ST_IF_BLOCK, ST_IMPLICIT, ST_IMPLICIT_NONE,
211 ST_IMPORT, ST_INQUIRE, ST_INTERFACE, ST_SYNC_ALL, ST_SYNC_MEMORY,
212 ST_SYNC_IMAGES, ST_PARAMETER, ST_MODULE, ST_SUBMODULE, ST_MODULE_PROC,
213 ST_NAMELIST, ST_NULLIFY, ST_OPEN, ST_PAUSE, ST_PRIVATE, ST_PROGRAM, ST_PUBLIC,
214 ST_READ, ST_RETURN, ST_REWIND, ST_STOP, ST_SUBROUTINE, ST_TYPE, ST_USE,
215 ST_WHERE_BLOCK, ST_WHERE, ST_WAIT, ST_WRITE, ST_ASSIGNMENT,
216 ST_POINTER_ASSIGNMENT, ST_SELECT_CASE, ST_SEQUENCE, ST_SIMPLE_IF,
217 ST_STATEMENT_FUNCTION, ST_DERIVED_DECL, ST_LABEL_ASSIGNMENT, ST_ENUM,
218 ST_ENUMERATOR, ST_END_ENUM, ST_SELECT_TYPE, ST_TYPE_IS, ST_CLASS_IS,
70570ec1 219 ST_SELECT_RANK, ST_RANK, ST_STRUCTURE_DECL, ST_END_STRUCTURE,
f6288c24 220 ST_UNION, ST_END_UNION, ST_MAP, ST_END_MAP,
41dbbb37
TS
221 ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL,
222 ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA,
223 ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP,
224 ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT,
225 ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP,
62aee289
MR
226 ST_OACC_SERIAL_LOOP, ST_OACC_END_SERIAL_LOOP, ST_OACC_SERIAL,
227 ST_OACC_END_SERIAL, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE,
4bf9e5a8 228 ST_OACC_ATOMIC, ST_OACC_END_ATOMIC,
20906c66
JJ
229 ST_OMP_ATOMIC, ST_OMP_BARRIER, ST_OMP_CRITICAL, ST_OMP_END_ATOMIC,
230 ST_OMP_END_CRITICAL, ST_OMP_END_DO, ST_OMP_END_MASTER, ST_OMP_END_ORDERED,
231 ST_OMP_END_PARALLEL, ST_OMP_END_PARALLEL_DO, ST_OMP_END_PARALLEL_SECTIONS,
6c7a4dfd
JJ
232 ST_OMP_END_PARALLEL_WORKSHARE, ST_OMP_END_SECTIONS, ST_OMP_END_SINGLE,
233 ST_OMP_END_WORKSHARE, ST_OMP_DO, ST_OMP_FLUSH, ST_OMP_MASTER, ST_OMP_ORDERED,
234 ST_OMP_PARALLEL, ST_OMP_PARALLEL_DO, ST_OMP_PARALLEL_SECTIONS,
235 ST_OMP_PARALLEL_WORKSHARE, ST_OMP_SECTIONS, ST_OMP_SECTION, ST_OMP_SINGLE,
a68ab351 236 ST_OMP_THREADPRIVATE, ST_OMP_WORKSHARE, ST_OMP_TASK, ST_OMP_END_TASK,
dd2fc525
JJ
237 ST_OMP_TASKWAIT, ST_OMP_TASKYIELD, ST_OMP_CANCEL, ST_OMP_CANCELLATION_POINT,
238 ST_OMP_TASKGROUP, ST_OMP_END_TASKGROUP, ST_OMP_SIMD, ST_OMP_END_SIMD,
239 ST_OMP_DO_SIMD, ST_OMP_END_DO_SIMD, ST_OMP_PARALLEL_DO_SIMD,
5f23671d 240 ST_OMP_END_PARALLEL_DO_SIMD, ST_OMP_DECLARE_SIMD, ST_OMP_DECLARE_REDUCTION,
f014c653
JJ
241 ST_OMP_TARGET, ST_OMP_END_TARGET, ST_OMP_TARGET_DATA, ST_OMP_END_TARGET_DATA,
242 ST_OMP_TARGET_UPDATE, ST_OMP_DECLARE_TARGET,
243 ST_OMP_TEAMS, ST_OMP_END_TEAMS, ST_OMP_DISTRIBUTE, ST_OMP_END_DISTRIBUTE,
244 ST_OMP_DISTRIBUTE_SIMD, ST_OMP_END_DISTRIBUTE_SIMD,
245 ST_OMP_DISTRIBUTE_PARALLEL_DO, ST_OMP_END_DISTRIBUTE_PARALLEL_DO,
246 ST_OMP_DISTRIBUTE_PARALLEL_DO_SIMD, ST_OMP_END_DISTRIBUTE_PARALLEL_DO_SIMD,
247 ST_OMP_TARGET_TEAMS, ST_OMP_END_TARGET_TEAMS, ST_OMP_TEAMS_DISTRIBUTE,
248 ST_OMP_END_TEAMS_DISTRIBUTE, ST_OMP_TEAMS_DISTRIBUTE_SIMD,
249 ST_OMP_END_TEAMS_DISTRIBUTE_SIMD, ST_OMP_TARGET_TEAMS_DISTRIBUTE,
250 ST_OMP_END_TARGET_TEAMS_DISTRIBUTE, ST_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD,
251 ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_SIMD, ST_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO,
252 ST_OMP_END_TEAMS_DISTRIBUTE_PARALLEL_DO,
253 ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
254 ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
255 ST_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
256 ST_OMP_END_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
257 ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
258 ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
b4c3a85b
JJ
259 ST_OMP_TARGET_PARALLEL, ST_OMP_END_TARGET_PARALLEL,
260 ST_OMP_TARGET_PARALLEL_DO, ST_OMP_END_TARGET_PARALLEL_DO,
261 ST_OMP_TARGET_PARALLEL_DO_SIMD, ST_OMP_END_TARGET_PARALLEL_DO_SIMD,
262 ST_OMP_TARGET_ENTER_DATA, ST_OMP_TARGET_EXIT_DATA,
263 ST_OMP_TARGET_SIMD, ST_OMP_END_TARGET_SIMD,
a61c4964 264 ST_OMP_TASKLOOP, ST_OMP_END_TASKLOOP, ST_OMP_SCAN, ST_OMP_DEPOBJ,
b4c3a85b 265 ST_OMP_TASKLOOP_SIMD, ST_OMP_END_TASKLOOP_SIMD, ST_OMP_ORDERED_DEPEND,
269322ec 266 ST_OMP_REQUIRES, ST_PROCEDURE, ST_GENERIC, ST_CRITICAL, ST_END_CRITICAL,
5df445a2 267 ST_GET_FCN_CHARACTERISTICS, ST_LOCK, ST_UNLOCK, ST_EVENT_POST,
f8862a1b 268 ST_EVENT_WAIT, ST_FAIL_IMAGE, ST_FORM_TEAM, ST_CHANGE_TEAM,
0e3702f8 269 ST_END_TEAM, ST_SYNC_TEAM, ST_OMP_PARALLEL_MASTER,
f6bf436d
TB
270 ST_OMP_END_PARALLEL_MASTER, ST_OMP_PARALLEL_MASTER_TASKLOOP,
271 ST_OMP_END_PARALLEL_MASTER_TASKLOOP, ST_OMP_PARALLEL_MASTER_TASKLOOP_SIMD,
272 ST_OMP_END_PARALLEL_MASTER_TASKLOOP_SIMD, ST_OMP_MASTER_TASKLOOP,
273 ST_OMP_END_MASTER_TASKLOOP, ST_OMP_MASTER_TASKLOOP_SIMD,
178191e1
TB
274 ST_OMP_END_MASTER_TASKLOOP_SIMD, ST_OMP_LOOP, ST_OMP_END_LOOP,
275 ST_OMP_PARALLEL_LOOP, ST_OMP_END_PARALLEL_LOOP, ST_OMP_TEAMS_LOOP,
276 ST_OMP_END_TEAMS_LOOP, ST_OMP_TARGET_PARALLEL_LOOP,
277 ST_OMP_END_TARGET_PARALLEL_LOOP, ST_OMP_TARGET_TEAMS_LOOP,
53d5b59c
TB
278 ST_OMP_END_TARGET_TEAMS_LOOP, ST_OMP_MASKED, ST_OMP_END_MASKED,
279 ST_OMP_PARALLEL_MASKED, ST_OMP_END_PARALLEL_MASKED,
280 ST_OMP_PARALLEL_MASKED_TASKLOOP, ST_OMP_END_PARALLEL_MASKED_TASKLOOP,
281 ST_OMP_PARALLEL_MASKED_TASKLOOP_SIMD,
282 ST_OMP_END_PARALLEL_MASKED_TASKLOOP_SIMD, ST_OMP_MASKED_TASKLOOP,
283 ST_OMP_END_MASKED_TASKLOOP, ST_OMP_MASKED_TASKLOOP_SIMD,
77167196
TB
284 ST_OMP_END_MASKED_TASKLOOP_SIMD, ST_OMP_SCOPE, ST_OMP_END_SCOPE,
285 ST_OMP_ERROR, ST_NONE
a79683d5 286};
6de9cd9a 287
6de9cd9a
DN
288/* Types of interfaces that we can have. Assignment interfaces are
289 considered to be intrinsic operators. */
a79683d5 290enum interface_type
6de9cd9a
DN
291{
292 INTERFACE_NAMELESS = 1, INTERFACE_GENERIC,
e73d3ca6
PT
293 INTERFACE_INTRINSIC_OP, INTERFACE_USER_OP, INTERFACE_ABSTRACT,
294 INTERFACE_DTIO
a79683d5 295};
6de9cd9a
DN
296
297/* Symbol flavors: these are all mutually exclusive.
f6288c24 298 12 elements = 4 bits. */
a79683d5 299enum sym_flavor
6de9cd9a
DN
300{
301 FL_UNKNOWN = 0, FL_PROGRAM, FL_BLOCK_DATA, FL_MODULE, FL_VARIABLE,
a8b3b0b6 302 FL_PARAMETER, FL_LABEL, FL_PROCEDURE, FL_DERIVED, FL_NAMELIST,
f6288c24 303 FL_UNION, FL_STRUCT, FL_VOID
a79683d5 304};
6de9cd9a
DN
305
306/* Procedure types. 7 elements = 3 bits. */
a79683d5 307enum procedure_type
6de9cd9a
DN
308{ PROC_UNKNOWN, PROC_MODULE, PROC_INTERNAL, PROC_DUMMY,
309 PROC_INTRINSIC, PROC_ST_FUNCTION, PROC_EXTERNAL
a79683d5 310};
6de9cd9a 311
ea20e8be
JW
312/* Intent types. Note that these values are also used in another enum in
313 decl.c (match_attr_spec). */
a79683d5 314enum sym_intent
6de9cd9a 315{ INTENT_UNKNOWN = 0, INTENT_IN, INTENT_OUT, INTENT_INOUT
a79683d5 316};
6de9cd9a
DN
317
318/* Access types. */
a79683d5 319enum gfc_access
5f42ddb0 320{ ACCESS_UNKNOWN = 0, ACCESS_PUBLIC, ACCESS_PRIVATE
a79683d5 321};
6de9cd9a
DN
322
323/* Flags to keep track of where an interface came from.
c73b6478 324 3 elements = 2 bits. */
a79683d5 325enum ifsrc
c73b6478
JW
326{ IFSRC_UNKNOWN = 0, /* Interface unknown, only return type may be known. */
327 IFSRC_DECL, /* FUNCTION or SUBROUTINE declaration. */
328 IFSRC_IFBODY /* INTERFACE statement or PROCEDURE statement
329 with explicit interface. */
a79683d5 330};
6de9cd9a 331
86bf520d 332/* Whether a SAVE attribute was set explicitly or implicitly. */
a79683d5 333enum save_state
5349080d 334{ SAVE_NONE = 0, SAVE_EXPLICIT, SAVE_IMPLICIT
a79683d5 335};
5349080d 336
68034b1b
TS
337/* OpenACC 'routine' directive's level of parallelism. */
338enum oacc_routine_lop
339{ OACC_ROUTINE_LOP_NONE = 0,
340 OACC_ROUTINE_LOP_GANG,
341 OACC_ROUTINE_LOP_WORKER,
342 OACC_ROUTINE_LOP_VECTOR,
e5fd6684
TS
343 OACC_ROUTINE_LOP_SEQ,
344 OACC_ROUTINE_LOP_ERROR
68034b1b
TS
345};
346
6de9cd9a
DN
347/* Strings for all symbol attributes. We use these for dumping the
348 parse tree, in error messages, and also when reading and writing
349 modules. In symbol.c. */
350extern const mstring flavors[];
351extern const mstring procedures[];
352extern const mstring intents[];
353extern const mstring access_types[];
354extern const mstring ifsrc_types[];
ef7236d2 355extern const mstring save_status[];
6de9cd9a 356
e73d3ca6
PT
357/* Strings for DTIO procedure names. In symbol.c. */
358extern const mstring dtio_procs[];
359
360enum dtio_codes
361{ DTIO_RF = 0, DTIO_WF, DTIO_RUF, DTIO_WUF };
362
6de9cd9a
DN
363/* Enumeration of all the generic intrinsic functions. Used by the
364 backend for identification of a function. */
365
cd5ecab6 366enum gfc_isym_id
6de9cd9a
DN
367{
368 /* GFC_ISYM_NONE is used for intrinsics which will never be seen by
df2fba9e 369 the backend (e.g. KIND). */
6de9cd9a 370 GFC_ISYM_NONE = 0,
cd5ecab6 371 GFC_ISYM_ABORT,
6de9cd9a 372 GFC_ISYM_ABS,
a119fc1c 373 GFC_ISYM_ACCESS,
6de9cd9a
DN
374 GFC_ISYM_ACHAR,
375 GFC_ISYM_ACOS,
57391dda 376 GFC_ISYM_ACOSD,
1e399e23 377 GFC_ISYM_ACOSH,
6de9cd9a
DN
378 GFC_ISYM_ADJUSTL,
379 GFC_ISYM_ADJUSTR,
380 GFC_ISYM_AIMAG,
381 GFC_ISYM_AINT,
cd5ecab6 382 GFC_ISYM_ALARM,
6de9cd9a
DN
383 GFC_ISYM_ALL,
384 GFC_ISYM_ALLOCATED,
5d723e54 385 GFC_ISYM_AND,
cd5ecab6 386 GFC_ISYM_ANINT,
6de9cd9a
DN
387 GFC_ISYM_ANY,
388 GFC_ISYM_ASIN,
57391dda 389 GFC_ISYM_ASIND,
1e399e23 390 GFC_ISYM_ASINH,
6de9cd9a
DN
391 GFC_ISYM_ASSOCIATED,
392 GFC_ISYM_ATAN,
393 GFC_ISYM_ATAN2,
57391dda
FR
394 GFC_ISYM_ATAN2D,
395 GFC_ISYM_ATAND,
cd5ecab6 396 GFC_ISYM_ATANH,
7f4aaf91
TB
397 GFC_ISYM_ATOMIC_ADD,
398 GFC_ISYM_ATOMIC_AND,
399 GFC_ISYM_ATOMIC_CAS,
da661a58 400 GFC_ISYM_ATOMIC_DEF,
7f4aaf91
TB
401 GFC_ISYM_ATOMIC_FETCH_ADD,
402 GFC_ISYM_ATOMIC_FETCH_AND,
403 GFC_ISYM_ATOMIC_FETCH_OR,
404 GFC_ISYM_ATOMIC_FETCH_XOR,
405 GFC_ISYM_ATOMIC_OR,
da661a58 406 GFC_ISYM_ATOMIC_REF,
7f4aaf91 407 GFC_ISYM_ATOMIC_XOR,
88a95a11
FXC
408 GFC_ISYM_BGE,
409 GFC_ISYM_BGT,
cd5ecab6 410 GFC_ISYM_BIT_SIZE,
88a95a11
FXC
411 GFC_ISYM_BLE,
412 GFC_ISYM_BLT,
6de9cd9a 413 GFC_ISYM_BTEST,
8a8d1a16
TB
414 GFC_ISYM_CAF_GET,
415 GFC_ISYM_CAF_SEND,
6de9cd9a
DN
416 GFC_ISYM_CEILING,
417 GFC_ISYM_CHAR,
f77b6ca3 418 GFC_ISYM_CHDIR,
a119fc1c 419 GFC_ISYM_CHMOD,
6de9cd9a 420 GFC_ISYM_CMPLX,
a16ee379 421 GFC_ISYM_CO_BROADCAST,
d62cf3df
TB
422 GFC_ISYM_CO_MAX,
423 GFC_ISYM_CO_MIN,
a16ee379 424 GFC_ISYM_CO_REDUCE,
d62cf3df 425 GFC_ISYM_CO_SUM,
b41b2534 426 GFC_ISYM_COMMAND_ARGUMENT_COUNT,
d000aa67
TB
427 GFC_ISYM_COMPILER_OPTIONS,
428 GFC_ISYM_COMPILER_VERSION,
5d723e54 429 GFC_ISYM_COMPLEX,
6de9cd9a 430 GFC_ISYM_CONJG,
cd5ecab6 431 GFC_ISYM_CONVERSION,
6de9cd9a 432 GFC_ISYM_COS,
57391dda 433 GFC_ISYM_COSD,
6de9cd9a 434 GFC_ISYM_COSH,
8e8c2744 435 GFC_ISYM_COTAN,
57391dda 436 GFC_ISYM_COTAND,
6de9cd9a 437 GFC_ISYM_COUNT,
cd5ecab6 438 GFC_ISYM_CPU_TIME,
6de9cd9a 439 GFC_ISYM_CSHIFT,
35059811 440 GFC_ISYM_CTIME,
cadddfdd
TB
441 GFC_ISYM_C_ASSOCIATED,
442 GFC_ISYM_C_F_POINTER,
443 GFC_ISYM_C_F_PROCPOINTER,
444 GFC_ISYM_C_FUNLOC,
445 GFC_ISYM_C_LOC,
048510c8 446 GFC_ISYM_C_SIZEOF,
cd5ecab6 447 GFC_ISYM_DATE_AND_TIME,
6de9cd9a 448 GFC_ISYM_DBLE,
878f88b7 449 GFC_ISYM_DFLOAT,
cd5ecab6 450 GFC_ISYM_DIGITS,
6de9cd9a
DN
451 GFC_ISYM_DIM,
452 GFC_ISYM_DOT_PRODUCT,
453 GFC_ISYM_DPROD,
88a95a11
FXC
454 GFC_ISYM_DSHIFTL,
455 GFC_ISYM_DSHIFTR,
cd5ecab6 456 GFC_ISYM_DTIME,
6de9cd9a 457 GFC_ISYM_EOSHIFT,
cd5ecab6 458 GFC_ISYM_EPSILON,
e8525382
SK
459 GFC_ISYM_ERF,
460 GFC_ISYM_ERFC,
f489fba1 461 GFC_ISYM_ERFC_SCALED,
2bd74949 462 GFC_ISYM_ETIME,
5df445a2 463 GFC_ISYM_EVENT_QUERY,
c14c8155 464 GFC_ISYM_EXECUTE_COMMAND_LINE,
cd5ecab6 465 GFC_ISYM_EXIT,
6de9cd9a
DN
466 GFC_ISYM_EXP,
467 GFC_ISYM_EXPONENT,
cf2b3c22 468 GFC_ISYM_EXTENDS_TYPE_OF,
ef78bc3c 469 GFC_ISYM_FAILED_IMAGES,
35059811 470 GFC_ISYM_FDATE,
f1abbf69 471 GFC_ISYM_FE_RUNTIME_ERROR,
5d723e54
FXC
472 GFC_ISYM_FGET,
473 GFC_ISYM_FGETC,
01ce9e31 474 GFC_ISYM_FINDLOC,
878f88b7 475 GFC_ISYM_FLOAT,
6de9cd9a 476 GFC_ISYM_FLOOR,
cd5ecab6 477 GFC_ISYM_FLUSH,
df65f093 478 GFC_ISYM_FNUM,
5d723e54
FXC
479 GFC_ISYM_FPUT,
480 GFC_ISYM_FPUTC,
6de9cd9a 481 GFC_ISYM_FRACTION,
cd5ecab6
DF
482 GFC_ISYM_FREE,
483 GFC_ISYM_FSEEK,
df65f093 484 GFC_ISYM_FSTAT,
5d723e54 485 GFC_ISYM_FTELL,
7bc19392 486 GFC_ISYM_TGAMMA,
cd5ecab6
DF
487 GFC_ISYM_GERROR,
488 GFC_ISYM_GETARG,
489 GFC_ISYM_GET_COMMAND,
490 GFC_ISYM_GET_COMMAND_ARGUMENT,
a8c60d7f 491 GFC_ISYM_GETCWD,
cd5ecab6
DF
492 GFC_ISYM_GETENV,
493 GFC_ISYM_GET_ENVIRONMENT_VARIABLE,
4c0c6b9f 494 GFC_ISYM_GETGID,
cd5ecab6 495 GFC_ISYM_GETLOG,
4c0c6b9f 496 GFC_ISYM_GETPID,
f8862a1b 497 GFC_ISYM_GET_TEAM,
4c0c6b9f 498 GFC_ISYM_GETUID,
cd5ecab6 499 GFC_ISYM_GMTIME,
f77b6ca3 500 GFC_ISYM_HOSTNM,
cd5ecab6 501 GFC_ISYM_HUGE,
f489fba1 502 GFC_ISYM_HYPOT,
6de9cd9a 503 GFC_ISYM_IACHAR,
195a95c4 504 GFC_ISYM_IALL,
6de9cd9a 505 GFC_ISYM_IAND,
195a95c4 506 GFC_ISYM_IANY,
b41b2534 507 GFC_ISYM_IARGC,
6de9cd9a
DN
508 GFC_ISYM_IBCLR,
509 GFC_ISYM_IBITS,
510 GFC_ISYM_IBSET,
511 GFC_ISYM_ICHAR,
cd5ecab6 512 GFC_ISYM_IDATE,
6de9cd9a 513 GFC_ISYM_IEOR,
f77b6ca3 514 GFC_ISYM_IERRNO,
64f002ed 515 GFC_ISYM_IMAGE_INDEX,
ef78bc3c 516 GFC_ISYM_IMAGE_STATUS,
6de9cd9a
DN
517 GFC_ISYM_INDEX,
518 GFC_ISYM_INT,
bf3fb7e4
FXC
519 GFC_ISYM_INT2,
520 GFC_ISYM_INT8,
6de9cd9a 521 GFC_ISYM_IOR,
195a95c4 522 GFC_ISYM_IPARITY,
2bd74949 523 GFC_ISYM_IRAND,
ae8b8789 524 GFC_ISYM_ISATTY,
419af57c 525 GFC_ISYM_IS_CONTIGUOUS,
bae89173
FXC
526 GFC_ISYM_IS_IOSTAT_END,
527 GFC_ISYM_IS_IOSTAT_EOR,
3d97b1af 528 GFC_ISYM_ISNAN,
6de9cd9a
DN
529 GFC_ISYM_ISHFT,
530 GFC_ISYM_ISHFTC,
cd5ecab6
DF
531 GFC_ISYM_ITIME,
532 GFC_ISYM_J0,
533 GFC_ISYM_J1,
534 GFC_ISYM_JN,
29698e0f 535 GFC_ISYM_JN2,
f77b6ca3 536 GFC_ISYM_KILL,
cd5ecab6 537 GFC_ISYM_KIND,
6de9cd9a 538 GFC_ISYM_LBOUND,
64f002ed 539 GFC_ISYM_LCOBOUND,
414f00e9 540 GFC_ISYM_LEADZ,
6de9cd9a
DN
541 GFC_ISYM_LEN,
542 GFC_ISYM_LEN_TRIM,
88607a9a 543 GFC_ISYM_LGAMMA,
6de9cd9a
DN
544 GFC_ISYM_LGE,
545 GFC_ISYM_LGT,
cd5ecab6 546 GFC_ISYM_LINK,
6de9cd9a
DN
547 GFC_ISYM_LLE,
548 GFC_ISYM_LLT,
83d890b9 549 GFC_ISYM_LOC,
bf3fb7e4 550 GFC_ISYM_LOG,
6de9cd9a
DN
551 GFC_ISYM_LOG10,
552 GFC_ISYM_LOGICAL,
bf3fb7e4 553 GFC_ISYM_LONG,
a119fc1c 554 GFC_ISYM_LSHIFT,
bf3fb7e4 555 GFC_ISYM_LSTAT,
cd5ecab6 556 GFC_ISYM_LTIME,
0d519038 557 GFC_ISYM_MALLOC,
88a95a11
FXC
558 GFC_ISYM_MASKL,
559 GFC_ISYM_MASKR,
6de9cd9a
DN
560 GFC_ISYM_MATMUL,
561 GFC_ISYM_MAX,
cd5ecab6 562 GFC_ISYM_MAXEXPONENT,
6de9cd9a
DN
563 GFC_ISYM_MAXLOC,
564 GFC_ISYM_MAXVAL,
bf3fb7e4
FXC
565 GFC_ISYM_MCLOCK,
566 GFC_ISYM_MCLOCK8,
6de9cd9a 567 GFC_ISYM_MERGE,
88a95a11 568 GFC_ISYM_MERGE_BITS,
6de9cd9a 569 GFC_ISYM_MIN,
cd5ecab6 570 GFC_ISYM_MINEXPONENT,
6de9cd9a
DN
571 GFC_ISYM_MINLOC,
572 GFC_ISYM_MINVAL,
573 GFC_ISYM_MOD,
574 GFC_ISYM_MODULO,
cd5ecab6
DF
575 GFC_ISYM_MOVE_ALLOC,
576 GFC_ISYM_MVBITS,
6de9cd9a 577 GFC_ISYM_NEAREST,
cd5ecab6 578 GFC_ISYM_NEW_LINE,
6de9cd9a 579 GFC_ISYM_NINT,
0cd0559e 580 GFC_ISYM_NORM2,
6de9cd9a 581 GFC_ISYM_NOT,
cd5ecab6 582 GFC_ISYM_NULL,
60386f50 583 GFC_ISYM_NUM_IMAGES,
5d723e54 584 GFC_ISYM_OR,
6de9cd9a 585 GFC_ISYM_PACK,
0cd0559e 586 GFC_ISYM_PARITY,
cd5ecab6 587 GFC_ISYM_PERROR,
ad5f4de2
FXC
588 GFC_ISYM_POPCNT,
589 GFC_ISYM_POPPAR,
cd5ecab6 590 GFC_ISYM_PRECISION,
6de9cd9a
DN
591 GFC_ISYM_PRESENT,
592 GFC_ISYM_PRODUCT,
cd5ecab6 593 GFC_ISYM_RADIX,
2bd74949 594 GFC_ISYM_RAND,
ddd3e26e 595 GFC_ISYM_RANDOM_INIT,
cd5ecab6
DF
596 GFC_ISYM_RANDOM_NUMBER,
597 GFC_ISYM_RANDOM_SEED,
598 GFC_ISYM_RANGE,
2514987f 599 GFC_ISYM_RANK,
6de9cd9a 600 GFC_ISYM_REAL,
878f88b7 601 GFC_ISYM_REALPART,
f77b6ca3 602 GFC_ISYM_RENAME,
6de9cd9a
DN
603 GFC_ISYM_REPEAT,
604 GFC_ISYM_RESHAPE,
605 GFC_ISYM_RRSPACING,
cd5ecab6 606 GFC_ISYM_RSHIFT,
cf2b3c22 607 GFC_ISYM_SAME_TYPE_AS,
a39fafac 608 GFC_ISYM_SC_KIND,
6de9cd9a
DN
609 GFC_ISYM_SCALE,
610 GFC_ISYM_SCAN,
53096259 611 GFC_ISYM_SECNDS,
cd5ecab6 612 GFC_ISYM_SECOND,
6de9cd9a
DN
613 GFC_ISYM_SET_EXPONENT,
614 GFC_ISYM_SHAPE,
88a95a11
FXC
615 GFC_ISYM_SHIFTA,
616 GFC_ISYM_SHIFTL,
617 GFC_ISYM_SHIFTR,
f0f67c96 618 GFC_ISYM_BACKTRACE,
6de9cd9a 619 GFC_ISYM_SIGN,
185d7d97 620 GFC_ISYM_SIGNAL,
cd5ecab6 621 GFC_ISYM_SI_KIND,
6de9cd9a 622 GFC_ISYM_SIN,
57391dda 623 GFC_ISYM_SIND,
6de9cd9a
DN
624 GFC_ISYM_SINH,
625 GFC_ISYM_SIZE,
cd5ecab6 626 GFC_ISYM_SLEEP,
fd2157ce 627 GFC_ISYM_SIZEOF,
878f88b7 628 GFC_ISYM_SNGL,
6de9cd9a
DN
629 GFC_ISYM_SPACING,
630 GFC_ISYM_SPREAD,
631 GFC_ISYM_SQRT,
cd5ecab6 632 GFC_ISYM_SRAND,
6de9cd9a 633 GFC_ISYM_SR_KIND,
df65f093 634 GFC_ISYM_STAT,
ef78bc3c 635 GFC_ISYM_STOPPED_IMAGES,
048510c8 636 GFC_ISYM_STORAGE_SIZE,
0881224e 637 GFC_ISYM_STRIDE,
6de9cd9a 638 GFC_ISYM_SUM,
cd5ecab6 639 GFC_ISYM_SYMLINK,
f77b6ca3 640 GFC_ISYM_SYMLNK,
5b1374e9 641 GFC_ISYM_SYSTEM,
cd5ecab6 642 GFC_ISYM_SYSTEM_CLOCK,
6de9cd9a 643 GFC_ISYM_TAN,
57391dda 644 GFC_ISYM_TAND,
6de9cd9a 645 GFC_ISYM_TANH,
f8862a1b 646 GFC_ISYM_TEAM_NUMBER,
64f002ed 647 GFC_ISYM_THIS_IMAGE,
f77b6ca3
FXC
648 GFC_ISYM_TIME,
649 GFC_ISYM_TIME8,
cd5ecab6 650 GFC_ISYM_TINY,
414f00e9 651 GFC_ISYM_TRAILZ,
6de9cd9a
DN
652 GFC_ISYM_TRANSFER,
653 GFC_ISYM_TRANSPOSE,
654 GFC_ISYM_TRIM,
25fc05eb 655 GFC_ISYM_TTYNAM,
6de9cd9a 656 GFC_ISYM_UBOUND,
64f002ed 657 GFC_ISYM_UCOBOUND,
d8fe26b2
SK
658 GFC_ISYM_UMASK,
659 GFC_ISYM_UNLINK,
6de9cd9a
DN
660 GFC_ISYM_UNPACK,
661 GFC_ISYM_VERIFY,
5d723e54 662 GFC_ISYM_XOR,
cd5ecab6
DF
663 GFC_ISYM_Y0,
664 GFC_ISYM_Y1,
29698e0f
TB
665 GFC_ISYM_YN,
666 GFC_ISYM_YN2
6de9cd9a 667};
6de9cd9a 668
a79683d5 669enum init_local_logical
51b09ce3
AL
670{
671 GFC_INIT_LOGICAL_OFF = 0,
672 GFC_INIT_LOGICAL_FALSE,
673 GFC_INIT_LOGICAL_TRUE
a79683d5 674};
51b09ce3 675
a79683d5 676enum init_local_character
51b09ce3
AL
677{
678 GFC_INIT_CHARACTER_OFF = 0,
679 GFC_INIT_CHARACTER_ON
a79683d5 680};
51b09ce3 681
a79683d5 682enum init_local_integer
51b09ce3
AL
683{
684 GFC_INIT_INTEGER_OFF = 0,
685 GFC_INIT_INTEGER_ON
a79683d5 686};
51b09ce3 687
a79683d5 688enum gfc_reverse
3d03ead0 689{
aed5574e
PT
690 GFC_ENABLE_REVERSE,
691 GFC_FORWARD_SET,
3d03ead0 692 GFC_REVERSE_SET,
aed5574e 693 GFC_INHIBIT_REVERSE
a79683d5 694};
3d03ead0 695
5bab4c96
PT
696enum gfc_param_spec_type
697{
698 SPEC_EXPLICIT,
699 SPEC_ASSUMED,
700 SPEC_DEFERRED
701};
702
6de9cd9a
DN
703/************************* Structures *****************************/
704
5cf54585
TS
705/* Used for keeping things in balanced binary trees. */
706#define BBT_HEADER(self) int priority; struct self *left, *right
707
7306b628 708#define NAMED_INTCST(a,b,c,d) a,
be1f1ed9 709#define NAMED_KINDARRAY(a,b,c,d) a,
d000aa67 710#define NAMED_FUNCTION(a,b,c,d) a,
cadddfdd 711#define NAMED_SUBROUTINE(a,b,c,d) a,
fea54935 712#define NAMED_DERIVED_TYPE(a,b,c,d) a,
a79683d5 713enum iso_fortran_env_symbol
a8b3b0b6
CR
714{
715 ISOFORTRANENV_INVALID = -1,
716#include "iso-fortran-env.def"
717 ISOFORTRANENV_LAST, ISOFORTRANENV_NUMBER = ISOFORTRANENV_LAST
a79683d5 718};
d000aa67 719#undef NAMED_INTCST
be1f1ed9 720#undef NAMED_KINDARRAY
d000aa67 721#undef NAMED_FUNCTION
cadddfdd 722#undef NAMED_SUBROUTINE
fea54935 723#undef NAMED_DERIVED_TYPE
a8b3b0b6 724
7306b628 725#define NAMED_INTCST(a,b,c,d) a,
28d0b595
TB
726#define NAMED_REALCST(a,b,c,d) a,
727#define NAMED_CMPXCST(a,b,c,d) a,
a8b3b0b6
CR
728#define NAMED_LOGCST(a,b,c) a,
729#define NAMED_CHARKNDCST(a,b,c) a,
730#define NAMED_CHARCST(a,b,c) a,
731#define DERIVED_TYPE(a,b,c) a,
d000aa67 732#define NAMED_FUNCTION(a,b,c,d) a,
cadddfdd 733#define NAMED_SUBROUTINE(a,b,c,d) a,
a79683d5 734enum iso_c_binding_symbol
a8b3b0b6 735{
4d382327 736 ISOCBINDING_INVALID = -1,
a8b3b0b6
CR
737#include "iso-c-binding.def"
738 ISOCBINDING_LAST,
739 ISOCBINDING_NUMBER = ISOCBINDING_LAST
a79683d5 740};
a8b3b0b6
CR
741#undef NAMED_INTCST
742#undef NAMED_REALCST
743#undef NAMED_CMPXCST
744#undef NAMED_LOGCST
745#undef NAMED_CHARKNDCST
746#undef NAMED_CHARCST
747#undef DERIVED_TYPE
d000aa67 748#undef NAMED_FUNCTION
cadddfdd 749#undef NAMED_SUBROUTINE
a8b3b0b6 750
a79683d5 751enum intmod_id
a8b3b0b6 752{
8b198102
FXC
753 INTMOD_NONE = 0, INTMOD_ISO_FORTRAN_ENV, INTMOD_ISO_C_BINDING,
754 INTMOD_IEEE_FEATURES, INTMOD_IEEE_EXCEPTIONS, INTMOD_IEEE_ARITHMETIC
a79683d5 755};
a8b3b0b6
CR
756
757typedef struct
758{
759 char name[GFC_MAX_SYMBOL_LEN + 1];
760 int value; /* Used for both integer and character values. */
761 bt f90_type;
762}
763CInteropKind_t;
764
765/* Array of structs, where the structs represent the C interop kinds.
766 The list will be implemented based on a hash of the kind name since
767 these could be accessed multiple times.
768 Declared in trans-types.c as a global, since it's in that file
769 that the list is initialized. */
770extern CInteropKind_t c_interop_kinds_table[];
771
d58e7173
TB
772enum gfc_omp_device_type
773{
774 OMP_DEVICE_TYPE_UNSET,
775 OMP_DEVICE_TYPE_HOST,
776 OMP_DEVICE_TYPE_NOHOST,
777 OMP_DEVICE_TYPE_ANY
778};
08a6b8e0 779
77167196
TB
780enum gfc_omp_severity_type
781{
782 OMP_SEVERITY_UNSET,
783 OMP_SEVERITY_WARNING,
784 OMP_SEVERITY_FATAL
785};
786
787enum gfc_omp_at_type
788{
789 OMP_AT_UNSET,
790 OMP_AT_COMPILATION,
791 OMP_AT_EXECUTION
792};
793
08a6b8e0 794/* Structure and list of supported extension attributes. */
2b374f55 795typedef enum
08a6b8e0
TB
796{
797 EXT_ATTR_DLLIMPORT = 0,
798 EXT_ATTR_DLLEXPORT,
799 EXT_ATTR_STDCALL,
800 EXT_ATTR_CDECL,
801 EXT_ATTR_FASTCALL,
e7ac6a7c 802 EXT_ATTR_NO_ARG_CHECK,
0caf400a 803 EXT_ATTR_DEPRECATED,
08a6b8e0 804 EXT_ATTR_LAST, EXT_ATTR_NUM = EXT_ATTR_LAST
2b374f55
TB
805}
806ext_attr_id_t;
08a6b8e0
TB
807
808typedef struct
809{
810 const char *name;
811 unsigned id;
812 const char *middle_end_name;
813}
814ext_attr_t;
815
816extern const ext_attr_t ext_attr_list[];
817
6de9cd9a
DN
818/* Symbol attribute structure. */
819typedef struct
820{
821 /* Variable attributes. */
be59db2d 822 unsigned allocatable:1, dimension:1, codimension:1, external:1, intrinsic:1,
59e36b72 823 optional:1, pointer:1, target:1, value:1, volatile_:1, temporary:1,
e9bd9f7d 824 dummy:1, result:1, assign:1, threadprivate:1, not_always_present:1,
fe4e525c 825 implied_index:1, subref_array_pointer:1, proc_pointer:1, asynchronous:1,
34d567d1 826 contiguous:1, fe_temp: 1, automatic: 1;
6de9cd9a 827
41a394bb
DK
828 /* For CLASS containers, the pointer attribute is sometimes set internally
829 even though it was not directly specified. In this case, keep the
830 "real" (original) value here. */
831 unsigned class_pointer:1;
832
5349080d
TB
833 ENUM_BITFIELD (save_state) save:2;
834
6de9cd9a 835 unsigned data:1, /* Symbol is named in a DATA statement. */
8b11b59f 836 is_protected:1, /* Symbol has been marked as protected. */
993ef28f 837 use_assoc:1, /* Symbol has been use-associated. */
4668d6f9
PT
838 used_in_submodule:1, /* Symbol has been use-associated in a
839 submodule. Needed since these entities must
840 be set host associated to be compliant. */
5a8af0b4 841 use_only:1, /* Symbol has been use-associated, with ONLY. */
0e5a218b 842 use_rename:1, /* Symbol has been use-associated and renamed. */
022e30c0 843 imported:1, /* Symbol has been associated by IMPORT. */
4d382327 844 host_assoc:1; /* Symbol has been host associated. */
6de9cd9a 845
30aabb86 846 unsigned in_namelist:1, in_common:1, in_equivalence:1;
69773742
JW
847 unsigned function:1, subroutine:1, procedure:1;
848 unsigned generic:1, generic_copy:1;
d1303acd 849 unsigned implicit_type:1; /* Type defined via implicit rules. */
ebb479cd 850 unsigned untyped:1; /* No implicit type could be found. */
6de9cd9a 851
ebb479cd 852 unsigned is_bind_c:1; /* say if is bound to C. */
7c1dab0d 853 unsigned extension:8; /* extension level of a derived type. */
cf2b3c22 854 unsigned is_class:1; /* is a CLASS container. */
2e23972e 855 unsigned class_ok:1; /* is a CLASS object with correct attributes. */
eece1eb9
PT
856 unsigned vtab:1; /* is a derived type vtab, pointed to by CLASS objects. */
857 unsigned vtype:1; /* is a derived type of a vtab. */
a8b3b0b6
CR
858
859 /* These flags are both in the typespec and attribute. The attribute
860 list is what gets read from/written to a module file. The typespec
861 is created from a decl being processed. */
862 unsigned is_c_interop:1; /* It's c interoperable. */
863 unsigned is_iso_c:1; /* Symbol is from iso_c_binding. */
864
6de9cd9a
DN
865 /* Function/subroutine attributes */
866 unsigned sequence:1, elemental:1, pure:1, recursive:1;
9e1d712c 867 unsigned unmaskable:1, masked:1, contained:1, mod_proc:1, abstract:1;
6de9cd9a 868
4668d6f9
PT
869 /* Set if this is a module function or subroutine. Note that it is an
870 attribute because it appears as a prefix in the declaration like
871 PURE, etc.. */
872 unsigned module_procedure:1;
873
cdd244b8
TB
874 /* Set if a (public) symbol [e.g. generic name] exposes this symbol,
875 which is relevant for private module procedures. */
876 unsigned public_used:1;
877
f1f39033
PT
878 /* This is set if a contained procedure could be declared pure. This is
879 used for certain optimizations that require the result or arguments
880 cannot alias. Note that this is zero for PURE procedures. */
881 unsigned implicit_pure:1;
882
30c931de 883 /* This is set for a procedure that contains expressions referencing
e73d3ca6 884 arrays coming from outside its namespace.
30c931de
PT
885 This is used to force the creation of a temporary when the LHS of
886 an array assignment may be used by an elemental procedure appearing
887 on the RHS. */
888 unsigned array_outer_dependency:1;
889
fe58e076
TK
890 /* This is set if the subroutine doesn't return. Currently, this
891 is only possible for intrinsic subroutines. */
892 unsigned noreturn:1;
893
3d79abbd
PB
894 /* Set if this procedure is an alternate entry point. These procedures
895 don't have any code associated, and the backend will turn them into
896 thunks to the master function. */
897 unsigned entry:1;
8b67b708 898
3d79abbd
PB
899 /* Set if this is the master function for a procedure with multiple
900 entry points. */
901 unsigned entry_master:1;
8b67b708 902
d198b59a
JJ
903 /* Set if this is the master function for a function with multiple
904 entry points where characteristics of the entry points differ. */
905 unsigned mixed_entry_master:1;
3d79abbd 906
6de9cd9a
DN
907 /* Set if a function must always be referenced by an explicit interface. */
908 unsigned always_explicit:1;
909
8e54f139
TB
910 /* Set if the symbol is generated and, hence, standard violations
911 shouldn't be flaged. */
912 unsigned artificial:1;
913
6de9cd9a
DN
914 /* Set if the symbol has been referenced in an expression. No further
915 modification of type or type parameters is permitted. */
916 unsigned referenced:1;
917
ecf24057 918 /* Set if this is the symbol for the main program. */
8b67b708
FXC
919 unsigned is_main_program:1;
920
6de9cd9a 921 /* Mutually exclusive multibit attributes. */
5f42ddb0
KG
922 ENUM_BITFIELD (gfc_access) access:2;
923 ENUM_BITFIELD (sym_intent) intent:2;
924 ENUM_BITFIELD (sym_flavor) flavor:4;
925 ENUM_BITFIELD (ifsrc) if_source:2;
6de9cd9a 926
5f42ddb0 927 ENUM_BITFIELD (procedure_type) proc:3;
949446f5 928
83d890b9 929 /* Special attributes for Cray pointers, pointees. */
949446f5 930 unsigned cray_pointer:1, cray_pointee:1;
6de9cd9a 931
4d382327 932 /* The symbol is a derived type with allocatable components, pointer
713485cc
JW
933 components or private components, procedure pointer components,
934 possibly nested. zero_comp is true if the derived type has no
4d382327 935 component at all. defined_assign_comp is true if the derived
8b704316
PT
936 type or a (sub-)component has a typebound defined assignment.
937 unlimited_polymorphic flags the type of the container for these
938 entities. */
713485cc 939 unsigned alloc_comp:1, pointer_comp:1, proc_pointer_comp:1,
4d382327 940 private_comp:1, zero_comp:1, coarray_comp:1, lock_comp:1,
e73d3ca6 941 event_comp:1, defined_assign_comp:1, unlimited_polymorphic:1,
f549bfb3 942 has_dtio_procs:1, caf_token:1;
77bb16aa 943
70570ec1
PT
944 /* This is a temporary selector for SELECT TYPE/RANK or an associate
945 variable for SELECT TYPE/RANK or ASSOCIATE. */
946 unsigned select_type_temporary:1, select_rank_temporary:1, associate_var:1;
8c91ab34 947
5bab4c96
PT
948 /* These are the attributes required for parameterized derived
949 types. */
950 unsigned pdt_kind:1, pdt_len:1, pdt_type:1, pdt_template:1,
951 pdt_array:1, pdt_string:1;
952
5f23671d
JJ
953 /* This is omp_{out,in,priv,orig} artificial variable in
954 !$OMP DECLARE REDUCTION. */
955 unsigned omp_udr_artificial_var:1;
956
f014c653
JJ
957 /* Mentioned in OMP DECLARE TARGET. */
958 unsigned omp_declare_target:1;
b4c3a85b 959 unsigned omp_declare_target_link:1;
d58e7173 960 ENUM_BITFIELD (gfc_omp_device_type) omp_device_type:2;
f014c653 961
dc7a8b4b
JN
962 /* Mentioned in OACC DECLARE. */
963 unsigned oacc_declare_create:1;
964 unsigned oacc_declare_copyin:1;
965 unsigned oacc_declare_deviceptr:1;
966 unsigned oacc_declare_device_resident:1;
967 unsigned oacc_declare_link:1;
968
68034b1b
TS
969 /* OpenACC 'routine' directive's level of parallelism. */
970 ENUM_BITFIELD (oacc_routine_lop) oacc_routine_lop:3;
a61f6afb 971 unsigned oacc_routine_nohost:1;
db941d7e 972
08a6b8e0
TB
973 /* Attributes set by compiler extensions (!GCC$ ATTRIBUTES). */
974 unsigned ext_attr:EXT_ATTR_NUM;
975
1eee5628
TB
976 /* The namespace where the attribute has been set. */
977 struct gfc_namespace *volatile_ns, *asynchronous_ns;
6de9cd9a
DN
978}
979symbol_attribute;
980
981
8fc541d3
FXC
982/* We need to store source lines as sequences of multibyte source
983 characters. We define here a type wide enough to hold any multibyte
984 source character, just like libcpp does. A 32-bit type is enough. */
985
986#if HOST_BITS_PER_INT >= 32
987typedef unsigned int gfc_char_t;
988#elif HOST_BITS_PER_LONG >= 32
989typedef unsigned long gfc_char_t;
990#elif defined(HAVE_LONG_LONG) && (HOST_BITS_PER_LONGLONG >= 32)
991typedef unsigned long long gfc_char_t;
992#else
993# error "Cannot find an integer type with at least 32 bits"
994#endif
995
996
d4fa05b9 997/* The following three structures are used to identify a location in
949446f5
BF
998 the sources.
999
d4fa05b9
TS
1000 gfc_file is used to maintain a tree of the source files and how
1001 they include each other
6de9cd9a 1002
d4fa05b9
TS
1003 gfc_linebuf holds a single line of source code and information
1004 which file it resides in
6de9cd9a 1005
d4fa05b9 1006 locus point to the sourceline and the character in the source
949446f5 1007 line.
d4fa05b9 1008*/
6de9cd9a 1009
949446f5 1010typedef struct gfc_file
6de9cd9a 1011{
1b271c9b 1012 struct gfc_file *next, *up;
d4fa05b9
TS
1013 int inclusion_line, line;
1014 char *filename;
1015} gfc_file;
1016
949446f5 1017typedef struct gfc_linebuf
d4fa05b9 1018{
620e594b 1019 location_t location;
d4fa05b9
TS
1020 struct gfc_file *file;
1021 struct gfc_linebuf *next;
1022
ba1defa5 1023 int truncated;
9e8a6720 1024 bool dbg_emitted;
ba1defa5 1025
8fc541d3 1026 gfc_char_t line[1];
d4fa05b9 1027} gfc_linebuf;
4cdf7223
PB
1028
1029#define gfc_linebuf_header_size (offsetof (gfc_linebuf, line))
1030
5ffeb913 1031#define gfc_linebuf_linenum(LBUF) (LOCATION_LINE ((LBUF)->location))
5ffeb913 1032
949446f5 1033typedef struct
d4fa05b9 1034{
8fc541d3 1035 gfc_char_t *nextc;
d4fa05b9
TS
1036 gfc_linebuf *lb;
1037} locus;
6de9cd9a 1038
0ce0154c
KG
1039/* In order for the "gfc" format checking to work correctly, you must
1040 have declared a typedef locus first. */
1041#if GCC_VERSION >= 4001
1042#define ATTRIBUTE_GCC_GFC(m, n) __attribute__ ((__format__ (__gcc_gfc__, m, n))) ATTRIBUTE_NONNULL(m)
1043#else
1044#define ATTRIBUTE_GCC_GFC(m, n) ATTRIBUTE_NONNULL(m)
1045#endif
1046
6de9cd9a 1047
a3d3c0f5
DK
1048/* Suppress error messages or re-enable them. */
1049
1050void gfc_push_suppress_errors (void);
1051void gfc_pop_suppress_errors (void);
6de9cd9a
DN
1052
1053
1054/* Character length structures hold the expression that gives the
1055 length of a character variable. We avoid putting these into
1056 gfc_typespec because doing so prevents us from doing structure
1057 copies and forces us to deallocate any typespecs we create, as well
1058 as structures that contain typespecs. They also can have multiple
1059 character typespecs pointing to them.
1060
1061 These structures form a singly linked list within the current
1062 namespace and are deallocated with the namespace. It is possible to
1063 end up with gfc_charlen structures that have nothing pointing to them. */
1064
1065typedef struct gfc_charlen
1066{
1067 struct gfc_expr *length;
1068 struct gfc_charlen *next;
c03fc95d 1069 bool length_from_typespec; /* Length from explicit array ctor typespec? */
6de9cd9a 1070 tree backend_decl;
e69afb29 1071 tree passed_length; /* Length argument explicitly passed. */
110eec24
TS
1072
1073 int resolved;
6de9cd9a
DN
1074}
1075gfc_charlen;
1076
ece3f663 1077#define gfc_get_charlen() XCNEW (gfc_charlen)
6de9cd9a 1078
bc21d315 1079/* Type specification structure. */
6de9cd9a
DN
1080typedef struct
1081{
1082 bt type;
1083 int kind;
bc21d315
JW
1084
1085 union
1086 {
1087 struct gfc_symbol *derived; /* For derived types only. */
1088 gfc_charlen *cl; /* For character types only. */
401fcd3b 1089 int pad; /* For hollerith types only. */
bc21d315
JW
1090 }
1091 u;
1092
32d99e68 1093 struct gfc_symbol *interface; /* For PROCEDURE declarations. */
a8b3b0b6
CR
1094 int is_c_interop;
1095 int is_iso_c;
e69afb29
SK
1096 bt f90_type;
1097 bool deferred;
e655a6cc 1098 gfc_symbol *interop_kind;
6de9cd9a
DN
1099}
1100gfc_typespec;
1101
1102/* Array specification. */
1103typedef struct
1104{
c62c6622 1105 int rank; /* A scalar has a rank of 0, an assumed-rank array has -1. */
be59db2d 1106 int corank;
178f9aa1 1107 array_type type, cotype;
6de9cd9a 1108 struct gfc_expr *lower[GFC_MAX_DIMENSIONS], *upper[GFC_MAX_DIMENSIONS];
83d890b9
AL
1109
1110 /* These two fields are used with the Cray Pointer extension. */
1111 bool cray_pointee; /* True iff this spec belongs to a cray pointee. */
1112 bool cp_was_assumed; /* AS_ASSUMED_SIZE cp arrays are converted to
1113 AS_EXPLICIT, but we want to remember that we
1114 did this. */
9b7df66f
TK
1115
1116 bool resolved;
6de9cd9a
DN
1117}
1118gfc_array_spec;
1119
ece3f663 1120#define gfc_get_array_spec() XCNEW (gfc_array_spec)
6de9cd9a
DN
1121
1122
1123/* Components of derived types. */
1124typedef struct gfc_component
1125{
cb9e4f55 1126 const char *name;
6de9cd9a
DN
1127 gfc_typespec ts;
1128
d4b7d0f0 1129 symbol_attribute attr;
6de9cd9a
DN
1130 gfc_array_spec *as;
1131
1132 tree backend_decl;
b3c1b8a1
MM
1133 /* Used to cache a FIELD_DECL matching this same component
1134 but applied to a different backend containing type that was
1135 generated by gfc_nonrestricted_type. */
1136 tree norestrict_decl;
6de9cd9a
DN
1137 locus loc;
1138 struct gfc_expr *initializer;
5bab4c96
PT
1139 /* Used in parameterized derived type declarations to store parameterized
1140 kind expressions. */
1141 struct gfc_expr *kind_expr;
1142 struct gfc_actual_arglist *param_list;
1143
6de9cd9a 1144 struct gfc_component *next;
713485cc 1145
90661f26 1146 /* Needed for procedure pointer components. */
90661f26 1147 struct gfc_typebound_proc *tb;
3c9f5092
AV
1148 /* When allocatable/pointer and in a coarray the associated token. */
1149 tree caf_token;
6de9cd9a
DN
1150}
1151gfc_component;
1152
ece3f663 1153#define gfc_get_component() XCNEW (gfc_component)
6de9cd9a
DN
1154
1155/* Formal argument lists are lists of symbols. */
1156typedef struct gfc_formal_arglist
1157{
4f613946 1158 /* Symbol representing the argument at this position in the arglist. */
6de9cd9a 1159 struct gfc_symbol *sym;
4f613946 1160 /* Points to the next formal argument. */
6de9cd9a
DN
1161 struct gfc_formal_arglist *next;
1162}
1163gfc_formal_arglist;
1164
ece3f663 1165#define gfc_get_formal_arglist() XCNEW (gfc_formal_arglist)
6de9cd9a
DN
1166
1167
5bab4c96
PT
1168/* The gfc_actual_arglist structure is for actual arguments and
1169 for type parameter specification lists. */
6de9cd9a
DN
1170typedef struct gfc_actual_arglist
1171{
cb9e4f55 1172 const char *name;
6de9cd9a
DN
1173 /* Alternate return label when the expr member is null. */
1174 struct gfc_st_label *label;
1175
1600fe22
TS
1176 /* This is set to the type of an eventual omitted optional
1177 argument. This is used to determine if a hidden string length
1178 argument has to be added to a function call. */
1179 bt missing_arg_type;
1180
5bab4c96
PT
1181 gfc_param_spec_type spec_type;
1182
6de9cd9a
DN
1183 struct gfc_expr *expr;
1184 struct gfc_actual_arglist *next;
1185}
1186gfc_actual_arglist;
1187
ece3f663 1188#define gfc_get_actual_arglist() XCNEW (gfc_actual_arglist)
6de9cd9a
DN
1189
1190
1191/* Because a symbol can belong to multiple namelists, they must be
1192 linked externally to the symbol itself. */
1193typedef struct gfc_namelist
1194{
1195 struct gfc_symbol *sym;
1196 struct gfc_namelist *next;
1197}
1198gfc_namelist;
1199
ece3f663 1200#define gfc_get_namelist() XCNEW (gfc_namelist)
6de9cd9a 1201
41dbbb37
TS
1202/* Likewise to gfc_namelist, but contains expressions. */
1203typedef struct gfc_expr_list
1204{
1205 struct gfc_expr *expr;
1206 struct gfc_expr_list *next;
1207}
1208gfc_expr_list;
1209
1210#define gfc_get_expr_list() XCNEW (gfc_expr_list)
1211
a79683d5 1212enum gfc_omp_reduction_op
5f23671d
JJ
1213{
1214 OMP_REDUCTION_NONE = -1,
1215 OMP_REDUCTION_PLUS = INTRINSIC_PLUS,
1216 OMP_REDUCTION_MINUS = INTRINSIC_MINUS,
1217 OMP_REDUCTION_TIMES = INTRINSIC_TIMES,
1218 OMP_REDUCTION_AND = INTRINSIC_AND,
1219 OMP_REDUCTION_OR = INTRINSIC_OR,
1220 OMP_REDUCTION_EQV = INTRINSIC_EQV,
1221 OMP_REDUCTION_NEQV = INTRINSIC_NEQV,
1222 OMP_REDUCTION_MAX = GFC_INTRINSIC_END,
1223 OMP_REDUCTION_MIN,
1224 OMP_REDUCTION_IAND,
1225 OMP_REDUCTION_IOR,
1226 OMP_REDUCTION_IEOR,
1227 OMP_REDUCTION_USER
a79683d5 1228};
5f23671d 1229
a79683d5 1230enum gfc_omp_depend_op
f014c653 1231{
a61c4964 1232 OMP_DEPEND_UNSET,
f014c653
JJ
1233 OMP_DEPEND_IN,
1234 OMP_DEPEND_OUT,
b4c3a85b 1235 OMP_DEPEND_INOUT,
a61c4964
TB
1236 OMP_DEPEND_MUTEXINOUTSET,
1237 OMP_DEPEND_DEPOBJ,
b4c3a85b
JJ
1238 OMP_DEPEND_SINK_FIRST,
1239 OMP_DEPEND_SINK
a79683d5 1240};
f014c653 1241
a79683d5 1242enum gfc_omp_map_op
f014c653
JJ
1243{
1244 OMP_MAP_ALLOC,
a6163563 1245 OMP_MAP_IF_PRESENT,
549188ea 1246 OMP_MAP_ATTACH,
f014c653
JJ
1247 OMP_MAP_TO,
1248 OMP_MAP_FROM,
41dbbb37 1249 OMP_MAP_TOFROM,
91106e84 1250 OMP_MAP_DELETE,
549188ea 1251 OMP_MAP_DETACH,
41dbbb37 1252 OMP_MAP_FORCE_ALLOC,
41dbbb37
TS
1253 OMP_MAP_FORCE_TO,
1254 OMP_MAP_FORCE_FROM,
1255 OMP_MAP_FORCE_TOFROM,
1256 OMP_MAP_FORCE_PRESENT,
dc7a8b4b
JN
1257 OMP_MAP_FORCE_DEVICEPTR,
1258 OMP_MAP_DEVICE_RESIDENT,
b4c3a85b
JJ
1259 OMP_MAP_LINK,
1260 OMP_MAP_RELEASE,
1261 OMP_MAP_ALWAYS_TO,
1262 OMP_MAP_ALWAYS_FROM,
1263 OMP_MAP_ALWAYS_TOFROM
1264};
1265
1de31913
TB
1266enum gfc_omp_defaultmap
1267{
1268 OMP_DEFAULTMAP_UNSET,
1269 OMP_DEFAULTMAP_ALLOC,
1270 OMP_DEFAULTMAP_TO,
1271 OMP_DEFAULTMAP_FROM,
1272 OMP_DEFAULTMAP_TOFROM,
1273 OMP_DEFAULTMAP_FIRSTPRIVATE,
1274 OMP_DEFAULTMAP_NONE,
1275 OMP_DEFAULTMAP_DEFAULT,
1276 OMP_DEFAULTMAP_PRESENT
1277};
1278
1279enum gfc_omp_defaultmap_category
1280{
1281 OMP_DEFAULTMAP_CAT_UNCATEGORIZED,
1282 OMP_DEFAULTMAP_CAT_SCALAR,
1283 OMP_DEFAULTMAP_CAT_AGGREGATE,
1284 OMP_DEFAULTMAP_CAT_ALLOCATABLE,
1285 OMP_DEFAULTMAP_CAT_POINTER,
1286 OMP_DEFAULTMAP_CAT_NUM
1287};
1288
b4c3a85b
JJ
1289enum gfc_omp_linear_op
1290{
1291 OMP_LINEAR_DEFAULT,
1292 OMP_LINEAR_REF,
1293 OMP_LINEAR_VAL,
1294 OMP_LINEAR_UVAL
a79683d5 1295};
f014c653 1296
dd2fc525
JJ
1297/* For use in OpenMP clauses in case we need extra information
1298 (aligned clause alignment, linear clause step, etc.). */
1299
1300typedef struct gfc_omp_namelist
1301{
1302 struct gfc_symbol *sym;
1303 struct gfc_expr *expr;
f014c653
JJ
1304 union
1305 {
1306 gfc_omp_reduction_op reduction_op;
1307 gfc_omp_depend_op depend_op;
1308 gfc_omp_map_op map_op;
b4c3a85b
JJ
1309 gfc_omp_linear_op linear_op;
1310 struct gfc_common_head *common;
084dc63a 1311 bool lastprivate_conditional;
f014c653 1312 } u;
9a5de4d5
TB
1313 union
1314 {
1315 struct gfc_omp_namelist_udr *udr;
1316 gfc_namespace *ns;
1317 } u2;
dd2fc525 1318 struct gfc_omp_namelist *next;
2ac33bca 1319 locus where;
dd2fc525
JJ
1320}
1321gfc_omp_namelist;
1322
1323#define gfc_get_omp_namelist() XCNEW (gfc_omp_namelist)
1324
6c7a4dfd
JJ
1325enum
1326{
41dbbb37
TS
1327 OMP_LIST_FIRST,
1328 OMP_LIST_PRIVATE = OMP_LIST_FIRST,
6c7a4dfd
JJ
1329 OMP_LIST_FIRSTPRIVATE,
1330 OMP_LIST_LASTPRIVATE,
1331 OMP_LIST_COPYPRIVATE,
1332 OMP_LIST_SHARED,
1333 OMP_LIST_COPYIN,
dd2fc525 1334 OMP_LIST_UNIFORM,
9a5de4d5 1335 OMP_LIST_AFFINITY,
dd2fc525
JJ
1336 OMP_LIST_ALIGNED,
1337 OMP_LIST_LINEAR,
f014c653
JJ
1338 OMP_LIST_DEPEND,
1339 OMP_LIST_MAP,
1340 OMP_LIST_TO,
1341 OMP_LIST_FROM,
005cff4e
TB
1342 OMP_LIST_SCAN_IN,
1343 OMP_LIST_SCAN_EX,
5f23671d 1344 OMP_LIST_REDUCTION,
e929ef53
TB
1345 OMP_LIST_REDUCTION_INSCAN,
1346 OMP_LIST_REDUCTION_TASK,
1347 OMP_LIST_IN_REDUCTION,
1348 OMP_LIST_TASK_REDUCTION,
41dbbb37 1349 OMP_LIST_DEVICE_RESIDENT,
dc7a8b4b 1350 OMP_LIST_LINK,
41dbbb37
TS
1351 OMP_LIST_USE_DEVICE,
1352 OMP_LIST_CACHE,
b4c3a85b
JJ
1353 OMP_LIST_IS_DEVICE_PTR,
1354 OMP_LIST_USE_DEVICE_PTR,
ef4add8e 1355 OMP_LIST_USE_DEVICE_ADDR,
21cfe724 1356 OMP_LIST_NONTEMPORAL,
6c7a4dfd
JJ
1357 OMP_LIST_NUM
1358};
1359
1360/* Because a symbol can belong to multiple namelists, they must be
1361 linked externally to the symbol itself. */
24b97832
ILT
1362
1363enum gfc_omp_sched_kind
1364{
1365 OMP_SCHED_NONE,
1366 OMP_SCHED_STATIC,
1367 OMP_SCHED_DYNAMIC,
1368 OMP_SCHED_GUIDED,
1369 OMP_SCHED_RUNTIME,
1370 OMP_SCHED_AUTO
1371};
1372
1373enum gfc_omp_default_sharing
1374{
1375 OMP_DEFAULT_UNKNOWN,
1376 OMP_DEFAULT_NONE,
1377 OMP_DEFAULT_PRIVATE,
1378 OMP_DEFAULT_SHARED,
7fd549d2
TS
1379 OMP_DEFAULT_FIRSTPRIVATE,
1380 OMP_DEFAULT_PRESENT
24b97832
ILT
1381};
1382
dd2fc525
JJ
1383enum gfc_omp_proc_bind_kind
1384{
1385 OMP_PROC_BIND_UNKNOWN,
432de084 1386 OMP_PROC_BIND_PRIMARY,
dd2fc525
JJ
1387 OMP_PROC_BIND_MASTER,
1388 OMP_PROC_BIND_SPREAD,
1389 OMP_PROC_BIND_CLOSE
1390};
1391
1392enum gfc_omp_cancel_kind
1393{
1394 OMP_CANCEL_UNKNOWN,
1395 OMP_CANCEL_PARALLEL,
1396 OMP_CANCEL_SECTIONS,
1397 OMP_CANCEL_DO,
1398 OMP_CANCEL_TASKGROUP
1399};
1400
b4c3a85b
JJ
1401enum gfc_omp_if_kind
1402{
e55ba804 1403 OMP_IF_CANCEL,
b4c3a85b 1404 OMP_IF_PARALLEL,
e55ba804 1405 OMP_IF_SIMD,
b4c3a85b
JJ
1406 OMP_IF_TASK,
1407 OMP_IF_TASKLOOP,
1408 OMP_IF_TARGET,
1409 OMP_IF_TARGET_DATA,
1410 OMP_IF_TARGET_UPDATE,
1411 OMP_IF_TARGET_ENTER_DATA,
1412 OMP_IF_TARGET_EXIT_DATA,
1413 OMP_IF_LAST
1414};
1415
1fc5e7ef
TB
1416enum gfc_omp_atomic_op
1417{
1418 GFC_OMP_ATOMIC_UNSET = 0,
1419 GFC_OMP_ATOMIC_UPDATE = 1,
1420 GFC_OMP_ATOMIC_READ = 2,
1421 GFC_OMP_ATOMIC_WRITE = 3,
1422 GFC_OMP_ATOMIC_MASK = 3,
1423 GFC_OMP_ATOMIC_SWAP = 16
1424};
1425
269322ec
TB
1426enum gfc_omp_requires_kind
1427{
1428 /* Keep in sync with gfc_namespace, esp. with omp_req_mem_order. */
1429 OMP_REQ_ATOMIC_MEM_ORDER_SEQ_CST = 1, /* 01 */
1430 OMP_REQ_ATOMIC_MEM_ORDER_ACQ_REL = 2, /* 10 */
1431 OMP_REQ_ATOMIC_MEM_ORDER_RELAXED = 3, /* 11 */
1432 OMP_REQ_REVERSE_OFFLOAD = (1 << 2),
1433 OMP_REQ_UNIFIED_ADDRESS = (1 << 3),
1434 OMP_REQ_UNIFIED_SHARED_MEMORY = (1 << 4),
1435 OMP_REQ_DYNAMIC_ALLOCATORS = (1 << 5),
1436 OMP_REQ_TARGET_MASK = (OMP_REQ_REVERSE_OFFLOAD
1437 | OMP_REQ_UNIFIED_ADDRESS
1438 | OMP_REQ_UNIFIED_SHARED_MEMORY),
1439 OMP_REQ_ATOMIC_MEM_ORDER_MASK = (OMP_REQ_ATOMIC_MEM_ORDER_SEQ_CST
1440 | OMP_REQ_ATOMIC_MEM_ORDER_ACQ_REL
1441 | OMP_REQ_ATOMIC_MEM_ORDER_RELAXED)
1442};
1443
c26d7df1
TB
1444enum gfc_omp_memorder
1445{
1fc5e7ef
TB
1446 OMP_MEMORDER_UNSET,
1447 OMP_MEMORDER_SEQ_CST,
c26d7df1
TB
1448 OMP_MEMORDER_ACQ_REL,
1449 OMP_MEMORDER_RELEASE,
1450 OMP_MEMORDER_ACQUIRE,
1fc5e7ef 1451 OMP_MEMORDER_RELAXED
c26d7df1
TB
1452};
1453
178191e1
TB
1454enum gfc_omp_bind_type
1455{
1456 OMP_BIND_UNSET,
1457 OMP_BIND_TEAMS,
1458 OMP_BIND_PARALLEL,
1459 OMP_BIND_THREAD
1460};
1461
6c7a4dfd
JJ
1462typedef struct gfc_omp_clauses
1463{
77167196 1464 gfc_omp_namelist *lists[OMP_LIST_NUM];
6c7a4dfd 1465 struct gfc_expr *if_expr;
20906c66 1466 struct gfc_expr *final_expr;
6c7a4dfd 1467 struct gfc_expr *num_threads;
6c7a4dfd 1468 struct gfc_expr *chunk_size;
dd2fc525
JJ
1469 struct gfc_expr *safelen_expr;
1470 struct gfc_expr *simdlen_expr;
f014c653
JJ
1471 struct gfc_expr *num_teams;
1472 struct gfc_expr *device;
1473 struct gfc_expr *thread_limit;
b4c3a85b 1474 struct gfc_expr *grainsize;
53d5b59c 1475 struct gfc_expr *filter;
b4c3a85b
JJ
1476 struct gfc_expr *hint;
1477 struct gfc_expr *num_tasks;
1478 struct gfc_expr *priority;
a6d22fb2 1479 struct gfc_expr *detach;
a61c4964 1480 struct gfc_expr *depobj;
b4c3a85b 1481 struct gfc_expr *if_exprs[OMP_IF_LAST];
f014c653 1482 struct gfc_expr *dist_chunk_size;
77167196 1483 struct gfc_expr *message;
b4c3a85b 1484 const char *critical_name;
03be3cfe 1485 bool ancestor;
77167196
TB
1486 enum gfc_omp_default_sharing default_sharing;
1487 enum gfc_omp_atomic_op atomic_op;
1488 enum gfc_omp_defaultmap defaultmap[OMP_DEFAULTMAP_CAT_NUM];
1489 int collapse, orderedc;
1490 unsigned nowait:1, ordered:1, untied:1, mergeable:1;
1491 unsigned inbranch:1, notinbranch:1, nogroup:1;
1492 unsigned sched_simd:1, sched_monotonic:1, sched_nonmonotonic:1;
1493 unsigned simd:1, threads:1, depend_source:1, destroy:1, order_concurrent:1;
0de4184b
TB
1494 unsigned order_unconstrained:1, capture:1, grainsize_strict:1;
1495 unsigned num_tasks_strict:1;
77167196
TB
1496 ENUM_BITFIELD (gfc_omp_sched_kind) sched_kind:3;
1497 ENUM_BITFIELD (gfc_omp_device_type) device_type:2;
1498 ENUM_BITFIELD (gfc_omp_memorder) memorder:3;
1499 ENUM_BITFIELD (gfc_omp_cancel_kind) cancel:3;
1500 ENUM_BITFIELD (gfc_omp_proc_bind_kind) proc_bind:3;
1501 ENUM_BITFIELD (gfc_omp_depend_op) depobj_update:3;
1502 ENUM_BITFIELD (gfc_omp_bind_type) bind:2;
1503 ENUM_BITFIELD (gfc_omp_at_type) at:2;
1504 ENUM_BITFIELD (gfc_omp_severity_type) severity:2;
1505 ENUM_BITFIELD (gfc_omp_sched_kind) dist_sched_kind:3;
41dbbb37
TS
1506
1507 /* OpenACC. */
1508 struct gfc_expr *async_expr;
2a70708e
CP
1509 struct gfc_expr *gang_static_expr;
1510 struct gfc_expr *gang_num_expr;
41dbbb37
TS
1511 struct gfc_expr *worker_expr;
1512 struct gfc_expr *vector_expr;
1513 struct gfc_expr *num_gangs_expr;
1514 struct gfc_expr *num_workers_expr;
1515 struct gfc_expr *vector_length_expr;
1516 gfc_expr_list *wait_list;
1517 gfc_expr_list *tile_list;
1518 unsigned async:1, gang:1, worker:1, vector:1, seq:1, independent:1;
fc2a1f2f 1519 unsigned par_auto:1, gang_static:1;
829c6349 1520 unsigned if_present:1, finalize:1;
a61f6afb 1521 unsigned nohost:1;
41dbbb37 1522 locus loc;
6c7a4dfd
JJ
1523}
1524gfc_omp_clauses;
1525
ece3f663 1526#define gfc_get_omp_clauses() XCNEW (gfc_omp_clauses)
6c7a4dfd 1527
6de9cd9a 1528
dc7a8b4b
JN
1529/* Node in the linked list used for storing !$oacc declare constructs. */
1530
1531typedef struct gfc_oacc_declare
1532{
1533 struct gfc_oacc_declare *next;
1534 bool module_var;
1535 gfc_omp_clauses *clauses;
1536 locus loc;
1537}
1538gfc_oacc_declare;
1539
1540#define gfc_get_oacc_declare() XCNEW (gfc_oacc_declare)
1541
1542
dd2fc525
JJ
1543/* Node in the linked list used for storing !$omp declare simd constructs. */
1544
1545typedef struct gfc_omp_declare_simd
1546{
1547 struct gfc_omp_declare_simd *next;
1548 locus where; /* Where the !$omp declare simd construct occurred. */
1549
1550 gfc_symbol *proc_name;
1551
1552 gfc_omp_clauses *clauses;
1553}
1554gfc_omp_declare_simd;
1555#define gfc_get_omp_declare_simd() XCNEW (gfc_omp_declare_simd)
1556
5f23671d
JJ
1557typedef struct gfc_omp_udr
1558{
1559 struct gfc_omp_udr *next;
1560 locus where; /* Where the !$omp declare reduction construct occurred. */
1561
1562 const char *name;
1563 gfc_typespec ts;
1564 gfc_omp_reduction_op rop;
1565
1566 struct gfc_symbol *omp_out;
1567 struct gfc_symbol *omp_in;
1568 struct gfc_namespace *combiner_ns;
1569
1570 struct gfc_symbol *omp_priv;
1571 struct gfc_symbol *omp_orig;
1572 struct gfc_namespace *initializer_ns;
1573}
1574gfc_omp_udr;
1575#define gfc_get_omp_udr() XCNEW (gfc_omp_udr)
dd2fc525 1576
b46ebd6c
JJ
1577typedef struct gfc_omp_namelist_udr
1578{
1579 struct gfc_omp_udr *udr;
1580 struct gfc_code *combiner;
1581 struct gfc_code *initializer;
1582}
1583gfc_omp_namelist_udr;
1584#define gfc_get_omp_namelist_udr() XCNEW (gfc_omp_namelist_udr)
1585
d80c695f
TS
1586/* The gfc_st_label structure is a BBT attached to a namespace that
1587 records the usage of statement labels within that space. */
1588
6de9cd9a
DN
1589typedef struct gfc_st_label
1590{
5cf54585
TS
1591 BBT_HEADER(gfc_st_label);
1592
6de9cd9a
DN
1593 int value;
1594
1595 gfc_sl_type defined, referenced;
1596
1597 struct gfc_expr *format;
1598
1599 tree backend_decl;
1600
1601 locus where;
388902da
LK
1602
1603 gfc_namespace *ns;
6de9cd9a
DN
1604}
1605gfc_st_label;
1606
1607
1608/* gfc_interface()-- Interfaces are lists of symbols strung together. */
1609typedef struct gfc_interface
1610{
1611 struct gfc_symbol *sym;
1612 locus where;
1613 struct gfc_interface *next;
1614}
1615gfc_interface;
1616
ece3f663 1617#define gfc_get_interface() XCNEW (gfc_interface)
6de9cd9a 1618
6de9cd9a
DN
1619/* User operator nodes. These are like stripped down symbols. */
1620typedef struct
1621{
cb9e4f55 1622 const char *name;
6de9cd9a 1623
8b11b59f 1624 gfc_interface *op;
6de9cd9a
DN
1625 struct gfc_namespace *ns;
1626 gfc_access access;
1627}
1628gfc_user_op;
1629
30b608eb 1630
e157f736
DK
1631/* A list of specific bindings that are associated with a generic spec. */
1632typedef struct gfc_tbp_generic
1633{
1634 /* The parser sets specific_st, upon resolution we look for the corresponding
1635 gfc_typebound_proc and set specific for further use. */
1636 struct gfc_symtree* specific_st;
1637 struct gfc_typebound_proc* specific;
1638
1639 struct gfc_tbp_generic* next;
218e1228 1640 bool is_operator;
e157f736
DK
1641}
1642gfc_tbp_generic;
1643
1644#define gfc_get_tbp_generic() XCNEW (gfc_tbp_generic)
1645
1646
30b608eb 1647/* Data needed for type-bound procedures. */
e157f736 1648typedef struct gfc_typebound_proc
30b608eb 1649{
e157f736
DK
1650 locus where; /* Where the PROCEDURE/GENERIC definition was. */
1651
1652 union
1653 {
b0e5fa94 1654 struct gfc_symtree* specific; /* The interface if DEFERRED. */
e157f736
DK
1655 gfc_tbp_generic* generic;
1656 }
1657 u;
30b608eb
DK
1658
1659 gfc_access access;
90661f26 1660 const char* pass_arg; /* Argument-name for PASS. NULL if not specified. */
30b608eb 1661
e157f736
DK
1662 /* The overridden type-bound proc (or GENERIC with this name in the
1663 parent-type) or NULL if non. */
1664 struct gfc_typebound_proc* overridden;
1665
30b608eb
DK
1666 /* Once resolved, we use the position of pass_arg in the formal arglist of
1667 the binding-target procedure to identify it. The first argument has
8e1f752a 1668 number 1 here, the second 2, and so on. */
30b608eb
DK
1669 unsigned pass_arg_num;
1670
1671 unsigned nopass:1; /* Whether we have NOPASS (PASS otherwise). */
1672 unsigned non_overridable:1;
b0e5fa94 1673 unsigned deferred:1;
e157f736
DK
1674 unsigned is_generic:1;
1675 unsigned function:1, subroutine:1;
b82657f4 1676 unsigned error:1; /* Ignore it, when an error occurred during resolution. */
90661f26 1677 unsigned ppc:1;
30b608eb
DK
1678}
1679gfc_typebound_proc;
1680
1681
6de9cd9a
DN
1682/* Symbol nodes. These are important things. They are what the
1683 standard refers to as "entities". The possibly multiple names that
1684 refer to the same entity are accomplished by a binary tree of
1685 symtree structures that is balanced by the red-black method-- more
1686 than one symtree node can point to any given symbol. */
1687
1688typedef struct gfc_symbol
1689{
cb9e4f55
TS
1690 const char *name; /* Primary name, before renaming */
1691 const char *module; /* Module this symbol came from */
6de9cd9a
DN
1692 locus declared_at;
1693
1694 gfc_typespec ts;
1695 symbol_attribute attr;
1696
32d99e68 1697 /* The formal member points to the formal argument list if the
6de9cd9a
DN
1698 symbol is a function or subroutine name. If the symbol is a
1699 generic name, the generic member points to the list of
1700 interfaces. */
1701
1702 gfc_interface *generic;
1703 gfc_access component_access;
1704
1705 gfc_formal_arglist *formal;
1706 struct gfc_namespace *formal_ns;
34523524
DK
1707 struct gfc_namespace *f2k_derived;
1708
5bab4c96
PT
1709 /* List of PDT parameter expressions */
1710 struct gfc_actual_arglist *param_list;
1711
6de9cd9a
DN
1712 struct gfc_expr *value; /* Parameter/Initializer value */
1713 gfc_array_spec *as;
1714 struct gfc_symbol *result; /* function result symbol */
1715 gfc_component *components; /* Derived type components */
1716
83d890b9
AL
1717 /* Defined only for Cray pointees; points to their pointer. */
1718 struct gfc_symbol *cp_pointer;
1719
cf2b3c22
TB
1720 int entry_id; /* Used in resolve.c for entries. */
1721
7c1dab0d
JW
1722 /* CLASS hashed name for declared and dynamic types in the class. */
1723 int hash_value;
cf2b3c22 1724
9056bd70 1725 struct gfc_symbol *common_next; /* Links for COMMON syms */
30aabb86 1726
a70ba41f
MM
1727 /* This is only used for pointer comparisons to check if symbols
1728 are in the same common block.
1729 In opposition to common_block, the common_head pointer takes into account
1730 equivalences: if A is in a common block C and A and B are in equivalence,
1731 then both A and B have common_head pointing to C, while A's common_block
1732 points to C and B's is NULL. */
30aabb86
PT
1733 struct gfc_common_head* common_head;
1734
6de9cd9a
DN
1735 /* Make sure setup code for dummy arguments is generated in the correct
1736 order. */
1737 int dummy_order;
1738
1739 gfc_namelist *namelist, *namelist_tail;
1740
1741 /* Change management fields. Symbols that might be modified by the
c064374d 1742 current statement have the mark member nonzero. Of these symbols,
6de9cd9a
DN
1743 symbols with old_symbol equal to NULL are symbols created within
1744 the current statement. Otherwise, old_symbol points to a copy of
278c3214
JB
1745 the old symbol. gfc_new is used in symbol.c to flag new symbols.
1746 comp_mark is used to indicate variables which have component accesses
1747 in OpenMP/OpenACC directive clauses. */
c064374d 1748 struct gfc_symbol *old_symbol;
278c3214 1749 unsigned mark:1, comp_mark:1, gfc_new:1;
c064374d
PT
1750
1751 /* The tlink field is used in the front end to carry the module
1752 declaration of separate module procedures so that the characteristics
1753 can be compared with the corresponding declaration in a submodule. In
1754 translation this field carries a linked list of symbols that require
1755 deferred initialization. */
1756 struct gfc_symbol *tlink;
1757
5291e69a
PB
1758 /* Nonzero if all equivalences associated with this symbol have been
1759 processed. */
1760 unsigned equiv_built:1;
31708dc6
RS
1761 /* Set if this variable is used as an index name in a FORALL. */
1762 unsigned forall_index:1;
345bd7eb
PT
1763 /* Set if the symbol is used in a function result specification . */
1764 unsigned fn_result_spec:1;
4af8d042 1765 /* Used to avoid multiple resolutions of a single symbol. */
dbeaa7ab
ME
1766 /* = 2 if this has already been resolved as an intrinsic,
1767 in gfc_resolve_intrinsic,
1768 = 1 if it has been resolved in resolve_symbol. */
1769 unsigned resolve_symbol_called:2;
4668d6f9
PT
1770 /* Set if this is a module function or subroutine with the
1771 abreviated declaration in a submodule. */
1772 unsigned abr_modproc_decl:1;
e0b9e5f9
TK
1773 /* Set if a previous error or warning has occurred and no other
1774 should be reported. */
1775 unsigned error:1;
4a4fc7fe
TK
1776 /* Set if the dummy argument of a procedure could be an array despite
1777 being called with a scalar actual argument. */
1778 unsigned maybe_array:1;
47d13acb
TK
1779 /* Set if this should be passed by value, but is not a VALUE argument
1780 according to the Fortran standard. */
1781 unsigned pass_as_value:1;
4af8d042 1782
6de9cd9a
DN
1783 int refs;
1784 struct gfc_namespace *ns; /* namespace containing this symbol */
1785
1786 tree backend_decl;
4d382327 1787
a8b3b0b6
CR
1788 /* Identity of the intrinsic module the symbol comes from, or
1789 INTMOD_NONE if it's not imported from a intrinsic module. */
1790 intmod_id from_intmod;
1791 /* Identity of the symbol from intrinsic modules, from enums maintained
1792 separately by each intrinsic module. Used together with from_intmod,
1793 it uniquely identifies a symbol from an intrinsic module. */
1794 int intmod_sym_id;
1795
1796 /* This may be repetitive, since the typespec now has a binding
1797 label field. */
9975a30b 1798 const char* binding_label;
a8b3b0b6
CR
1799 /* Store a reference to the common_block, if this symbol is in one. */
1800 struct gfc_common_head *common_block;
03af1e4c
DK
1801
1802 /* Link to corresponding association-list if this is an associate name. */
1803 struct gfc_association_list *assoc;
20e8ceae
AB
1804
1805 /* Link to next entry in derived type list */
1806 struct gfc_symbol *dt_next;
6de9cd9a
DN
1807}
1808gfc_symbol;
1809
dd355a42
MM
1810
1811struct gfc_undo_change_set
1812{
1813 vec<gfc_symbol *> syms;
1814 vec<gfc_typebound_proc *> tbps;
ab68a73e 1815 gfc_undo_change_set *previous;
dd355a42
MM
1816};
1817
1818
9056bd70 1819/* This structure is used to keep track of symbols in common blocks. */
30aabb86 1820typedef struct gfc_common_head
9056bd70
TS
1821{
1822 locus where;
b4c3a85b
JJ
1823 char use_assoc, saved, threadprivate;
1824 unsigned char omp_declare_target : 1;
1825 unsigned char omp_declare_target_link : 1;
d58e7173 1826 ENUM_BITFIELD (gfc_omp_device_type) omp_device_type:2;
3345e742
HA
1827 /* Provide sufficient space to hold "symbol.symbol.eq.1234567890". */
1828 char name[2*GFC_MAX_SYMBOL_LEN + 1 + 14 + 1];
30aabb86 1829 struct gfc_symbol *head;
9975a30b 1830 const char* binding_label;
a8b3b0b6 1831 int is_bind_c;
6f79f4d1 1832 int refs;
949446f5 1833}
9056bd70
TS
1834gfc_common_head;
1835
ece3f663 1836#define gfc_get_common_head() XCNEW (gfc_common_head)
9056bd70
TS
1837
1838
3d79abbd
PB
1839/* A list of all the alternate entry points for a procedure. */
1840
1841typedef struct gfc_entry_list
1842{
1843 /* The symbol for this entry point. */
1844 gfc_symbol *sym;
1845 /* The zero-based id of this entry point. */
1846 int id;
1847 /* The LABEL_EXPR marking this entry point. */
1848 tree label;
1933ba0f 1849 /* The next item in the list. */
3d79abbd
PB
1850 struct gfc_entry_list *next;
1851}
1852gfc_entry_list;
1853
93acb62c 1854#define gfc_get_entry_list() XCNEW (gfc_entry_list)
9056bd70 1855
a64f5186
JJ
1856/* Lists of rename info for the USE statement. */
1857
1858typedef struct gfc_use_rename
1859{
1860 char local_name[GFC_MAX_SYMBOL_LEN + 1], use_name[GFC_MAX_SYMBOL_LEN + 1];
1861 struct gfc_use_rename *next;
1862 int found;
1863 gfc_intrinsic_op op;
1864 locus where;
1865}
1866gfc_use_rename;
1867
1868#define gfc_get_use_rename() XCNEW (gfc_use_rename);
1869
1870/* A list of all USE statements in a namespace. */
1871
1872typedef struct gfc_use_list
1873{
1874 const char *module_name;
3d5dc929 1875 const char *submodule_name;
e9078ebb
TB
1876 bool intrinsic;
1877 bool non_intrinsic;
1878 bool only_flag;
a64f5186 1879 struct gfc_use_rename *rename;
9268ba9a 1880 locus where;
a64f5186
JJ
1881 /* Next USE statement. */
1882 struct gfc_use_list *next;
1883}
1884gfc_use_list;
1885
93acb62c 1886#define gfc_get_use_list() XCNEW (gfc_use_list)
a64f5186 1887
6de9cd9a
DN
1888/* Within a namespace, symbols are pointed to by symtree nodes that
1889 are linked together in a balanced binary tree. There can be
1890 several symtrees pointing to the same symbol node via USE
1891 statements. */
1892
6de9cd9a
DN
1893typedef struct gfc_symtree
1894{
1895 BBT_HEADER (gfc_symtree);
cb9e4f55 1896 const char *name;
6de9cd9a
DN
1897 int ambiguous;
1898 union
1899 {
1900 gfc_symbol *sym; /* Symbol associated with this node */
1901 gfc_user_op *uop;
9056bd70 1902 gfc_common_head *common;
e34ccb4c 1903 gfc_typebound_proc *tb;
5f23671d 1904 gfc_omp_udr *omp_udr;
6de9cd9a
DN
1905 }
1906 n;
6de9cd9a
DN
1907}
1908gfc_symtree;
1909
20e8ceae
AB
1910/* A list of all derived types. */
1911extern gfc_symbol *gfc_derived_types;
6b887797 1912
db941d7e
CP
1913typedef struct gfc_oacc_routine_name
1914{
1915 struct gfc_symbol *sym;
1916 struct gfc_omp_clauses *clauses;
1917 struct gfc_oacc_routine_name *next;
f6bf4bc1 1918 locus loc;
db941d7e
CP
1919}
1920gfc_oacc_routine_name;
1921
1922#define gfc_get_oacc_routine_name() XCNEW (gfc_oacc_routine_name)
1923
1af22e45
TK
1924/* Node in linked list to see what has already been finalized
1925 earlier. */
1926
1927typedef struct gfc_was_finalized {
1928 gfc_expr *e;
1929 gfc_component *c;
1930 struct gfc_was_finalized *next;
1931}
1932gfc_was_finalized;
1933
9abe5e56
DK
1934/* A namespace describes the contents of procedure, module, interface block
1935 or BLOCK construct. */
3d79abbd
PB
1936/* ??? Anything else use these? */
1937
6de9cd9a
DN
1938typedef struct gfc_namespace
1939{
4f613946
TS
1940 /* Tree containing all the symbols in this namespace. */
1941 gfc_symtree *sym_root;
1942 /* Tree containing all the user-defined operators in the namespace. */
1943 gfc_symtree *uop_root;
1944 /* Tree containing all the common blocks. */
949446f5 1945 gfc_symtree *common_root;
5f23671d
JJ
1946 /* Tree containing all the OpenMP user defined reductions. */
1947 gfc_symtree *omp_udr_root;
e34ccb4c
DK
1948
1949 /* Tree containing type-bound procedures. */
1950 gfc_symtree *tb_sym_root;
94747289
DK
1951 /* Type-bound user operators. */
1952 gfc_symtree *tb_uop_root;
1953 /* For derived-types, store type-bound intrinsic operators here. */
1954 gfc_typebound_proc *tb_op[GFC_INTRINSIC_OPS];
34523524
DK
1955 /* Linked list of finalizer procedures. */
1956 struct gfc_finalizer *finalizers;
6de9cd9a 1957
4f613946 1958 /* If set_flag[letter] is set, an implicit type has been set for letter. */
6de9cd9a 1959 int set_flag[GFC_LETTERS];
4f613946
TS
1960 /* Keeps track of the implicit types associated with the letters. */
1961 gfc_typespec default_type[GFC_LETTERS];
52f49934
DK
1962 /* Store the positions of IMPLICIT statements. */
1963 locus implicit_loc[GFC_LETTERS];
6de9cd9a 1964
4f613946 1965 /* If this is a namespace of a procedure, this points to the procedure. */
6de9cd9a 1966 struct gfc_symbol *proc_name;
4f613946
TS
1967 /* If this is the namespace of a unit which contains executable
1968 code, this points to it. */
6de9cd9a 1969 struct gfc_code *code;
4f613946
TS
1970
1971 /* Points to the equivalences set up in this namespace. */
31fee91e 1972 struct gfc_equiv *equiv, *old_equiv;
61321991
PT
1973
1974 /* Points to the equivalence groups produced by trans_common. */
1975 struct gfc_equiv_list *equiv_lists;
1976
a1ee985f 1977 gfc_interface *op[GFC_INTRINSIC_OPS];
4f613946
TS
1978
1979 /* Points to the parent namespace, i.e. the namespace of a module or
1980 procedure in which the procedure belonging to this namespace is
1981 contained. The parent namespace points to this namespace either
1982 directly via CONTAINED, or indirectly via the chain built by
1983 SIBLING. */
1984 struct gfc_namespace *parent;
1985 /* CONTAINED points to the first contained namespace. Sibling
1986 namespaces are chained via SIBLING. */
1987 struct gfc_namespace *contained, *sibling;
1988
1989 gfc_common_head blank_common;
6de9cd9a
DN
1990 gfc_access default_access, operator_access[GFC_INTRINSIC_OPS];
1991
1992 gfc_st_label *st_labels;
294fbfc8
TS
1993 /* This list holds information about all the data initializers in
1994 this namespace. */
d5e2274d 1995 struct gfc_data *data, *old_data;
6de9cd9a 1996
dc7a8b4b
JN
1997 /* !$ACC DECLARE. */
1998 gfc_oacc_declare *oacc_declare;
41dbbb37 1999
db941d7e
CP
2000 /* !$ACC ROUTINE clauses. */
2001 gfc_omp_clauses *oacc_routine_clauses;
2002
2003 /* !$ACC ROUTINE names. */
2004 gfc_oacc_routine_name *oacc_routine_names;
2005
d0803c0c 2006 gfc_charlen *cl_list;
6de9cd9a 2007
20e8ceae 2008 gfc_symbol *derived_types;
3af8d8cb 2009
4c1f4f52 2010 int save_all, seen_save, seen_implicit_none;
3d79abbd
PB
2011
2012 /* Normally we don't need to refcount namespaces. However when we read
2013 a module containing a function with multiple entry points, this
2014 will appear as several functions with the same formal namespace. */
2015 int refs;
2016
2017 /* A list of all alternate entry points to this procedure (or NULL). */
2018 gfc_entry_list *entries;
0de4325e 2019
a64f5186
JJ
2020 /* A list of USE statements in this namespace. */
2021 gfc_use_list *use_stmts;
2022
dd2fc525
JJ
2023 /* Linked list of !$omp declare simd constructs. */
2024 struct gfc_omp_declare_simd *omp_declare_simd;
2025
1af22e45
TK
2026 /* A hash set for the the gfc expressions that have already
2027 been finalized in this namespace. */
2028
2029 gfc_was_finalized *was_finalized;
2030
0de4325e 2031 /* Set to 1 if namespace is a BLOCK DATA program unit. */
9abe5e56 2032 unsigned is_block_data:1;
8998be20
TB
2033
2034 /* Set to 1 if namespace is an interface body with "IMPORT" used. */
9abe5e56 2035 unsigned has_import_set:1;
71a7778c 2036
8b7a967e
TB
2037 /* Set to 1 if the namespace uses "IMPLICT NONE (export)". */
2038 unsigned has_implicit_none_export:1;
2039
204803dc
JR
2040 /* Set to 1 if resolved has been called for this namespace.
2041 Holds -1 during resolution. */
2042 signed resolved:2;
3af8d8cb 2043
2b91aea8
MM
2044 /* Set when resolve_types has been called for this namespace. */
2045 unsigned types_resolved:1;
2046
3af8d8cb 2047 /* Set to 1 if code has been generated for this namespace. */
9abe5e56
DK
2048 unsigned translated:1;
2049
2050 /* Set to 1 if symbols in this namespace should be 'construct entities',
2051 i.e. for BLOCK local variables. */
2052 unsigned construct_entities:1;
5f23671d
JJ
2053
2054 /* Set to 1 for !$OMP DECLARE REDUCTION namespaces. */
2055 unsigned omp_udr_ns:1;
db941d7e
CP
2056
2057 /* Set to 1 for !$ACC ROUTINE namespaces. */
2058 unsigned oacc_routine:1;
ffeebc4f
JJ
2059
2060 /* Set to 1 if there are any calls to procedures with implicit interface. */
2061 unsigned implicit_interface_calls:1;
269322ec
TB
2062
2063 /* OpenMP requires. */
2064 unsigned omp_requires:6;
2065 unsigned omp_target_seen:1;
6de9cd9a
DN
2066}
2067gfc_namespace;
2068
2069extern gfc_namespace *gfc_current_ns;
71a7778c 2070extern gfc_namespace *gfc_global_ns_list;
6de9cd9a 2071
c9543002
TS
2072/* Global symbols are symbols of global scope. Currently we only use
2073 this to detect collisions already when parsing.
2074 TODO: Extend to verify procedure calls. */
2075
32e8bb8e
ILT
2076enum gfc_symbol_type
2077{
2078 GSYM_UNKNOWN=1, GSYM_PROGRAM, GSYM_FUNCTION, GSYM_SUBROUTINE,
2079 GSYM_MODULE, GSYM_COMMON, GSYM_BLOCK_DATA
2080};
2081
c9543002
TS
2082typedef struct gfc_gsymbol
2083{
2084 BBT_HEADER(gfc_gsymbol);
2085
973a384d 2086 const char *name;
a8b3b0b6
CR
2087 const char *sym_name;
2088 const char *mod_name;
2089 const char *binding_label;
32e8bb8e 2090 enum gfc_symbol_type type;
c9543002
TS
2091
2092 int defined, used;
55b9c612 2093 bool bind_c;
c9543002 2094 locus where;
71a7778c 2095 gfc_namespace *ns;
c9543002
TS
2096}
2097gfc_gsymbol;
2098
2099extern gfc_gsymbol *gfc_gsym_root;
6de9cd9a
DN
2100
2101/* Information on interfaces being built. */
2102typedef struct
2103{
2104 interface_type type;
2105 gfc_symbol *sym;
2106 gfc_namespace *ns;
2107 gfc_user_op *uop;
2108 gfc_intrinsic_op op;
2109}
2110gfc_interface_info;
2111
2112extern gfc_interface_info current_interface;
2113
2114
2115/* Array reference. */
32e8bb8e
ILT
2116
2117enum gfc_array_ref_dimen_type
2118{
a3935ffc 2119 DIMEN_ELEMENT = 1, DIMEN_RANGE, DIMEN_VECTOR, DIMEN_STAR, DIMEN_THIS_IMAGE, DIMEN_UNKNOWN
32e8bb8e
ILT
2120};
2121
6de9cd9a
DN
2122typedef struct gfc_array_ref
2123{
2124 ar_type type;
2125 int dimen; /* # of components in the reference */
d3a9eea2
TB
2126 int codimen;
2127 bool in_allocate; /* For coarray checks. */
f8862a1b 2128 gfc_expr *team;
20d0bfce 2129 gfc_expr *stat;
6de9cd9a
DN
2130 locus where;
2131 gfc_array_spec *as;
2132
2133 locus c_where[GFC_MAX_DIMENSIONS]; /* All expressions can be NULL */
2134 struct gfc_expr *start[GFC_MAX_DIMENSIONS], *end[GFC_MAX_DIMENSIONS],
2135 *stride[GFC_MAX_DIMENSIONS];
2136
32e8bb8e 2137 enum gfc_array_ref_dimen_type dimen_type[GFC_MAX_DIMENSIONS];
6de9cd9a
DN
2138}
2139gfc_array_ref;
2140
ece3f663 2141#define gfc_get_array_ref() XCNEW (gfc_array_ref)
6de9cd9a
DN
2142
2143
2144/* Component reference nodes. A variable is stored as an expression
2145 node that points to the base symbol. After that, a singly linked
2146 list of component reference nodes gives the variable's complete
2147 resolution. The array_ref component may be present and comes
2148 before the component component. */
2149
a79683d5 2150enum ref_type
a5fbc2f3
PT
2151 { REF_ARRAY, REF_COMPONENT, REF_SUBSTRING, REF_INQUIRY };
2152
2153enum inquiry_type
2154 { INQUIRY_RE, INQUIRY_IM, INQUIRY_KIND, INQUIRY_LEN };
6de9cd9a
DN
2155
2156typedef struct gfc_ref
2157{
2158 ref_type type;
2159
2160 union
2161 {
2162 struct gfc_array_ref ar;
2163
2164 struct
2165 {
2166 gfc_component *component;
2167 gfc_symbol *sym;
2168 }
2169 c;
2170
2171 struct
2172 {
2173 struct gfc_expr *start, *end; /* Substring */
2174 gfc_charlen *length;
2175 }
2176 ss;
2177
a5fbc2f3
PT
2178 inquiry_type i;
2179
6de9cd9a
DN
2180 }
2181 u;
2182
2183 struct gfc_ref *next;
2184}
2185gfc_ref;
2186
ece3f663 2187#define gfc_get_ref() XCNEW (gfc_ref)
6de9cd9a
DN
2188
2189
2190/* Structures representing intrinsic symbols and their arguments lists. */
2191typedef struct gfc_intrinsic_arg
2192{
2193 char name[GFC_MAX_SYMBOL_LEN + 1];
2194
2195 gfc_typespec ts;
47b99694 2196 unsigned optional:1, value:1;
23e38561 2197 ENUM_BITFIELD (sym_intent) intent:2;
6de9cd9a
DN
2198 gfc_actual_arglist *actual;
2199
2200 struct gfc_intrinsic_arg *next;
2201
2202}
2203gfc_intrinsic_arg;
2204
2205
4f613946
TS
2206/* Specifies the various kinds of check functions used to verify the
2207 argument lists of intrinsic functions. fX with X an integer refer
2208 to check functions of intrinsics with X arguments. f1m is used for
2209 the MAX and MIN intrinsics which can have an arbitrary number of
9a3d38f6 2210 arguments, f4ml is used for the MINLOC and MAXLOC intrinsics as
4f613946
TS
2211 these have special semantics. */
2212
6de9cd9a
DN
2213typedef union
2214{
524af0d6
JB
2215 bool (*f0)(void);
2216 bool (*f1)(struct gfc_expr *);
2217 bool (*f1m)(gfc_actual_arglist *);
2218 bool (*f2)(struct gfc_expr *, struct gfc_expr *);
2219 bool (*f3)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *);
64b1806b 2220 bool (*f5ml)(gfc_actual_arglist *);
01ce9e31 2221 bool (*f6fl)(gfc_actual_arglist *);
524af0d6
JB
2222 bool (*f3red)(gfc_actual_arglist *);
2223 bool (*f4)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
6de9cd9a 2224 struct gfc_expr *);
524af0d6 2225 bool (*f5)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
6de9cd9a
DN
2226 struct gfc_expr *, struct gfc_expr *);
2227}
2228gfc_check_f;
2229
4f613946
TS
2230/* Like gfc_check_f, these specify the type of the simplification
2231 function associated with an intrinsic. The fX are just like in
2232 gfc_check_f. cc is used for type conversion functions. */
6de9cd9a
DN
2233
2234typedef union
2235{
4c0c6b9f 2236 struct gfc_expr *(*f0)(void);
6de9cd9a
DN
2237 struct gfc_expr *(*f1)(struct gfc_expr *);
2238 struct gfc_expr *(*f2)(struct gfc_expr *, struct gfc_expr *);
2239 struct gfc_expr *(*f3)(struct gfc_expr *, struct gfc_expr *,
2240 struct gfc_expr *);
2241 struct gfc_expr *(*f4)(struct gfc_expr *, struct gfc_expr *,
2242 struct gfc_expr *, struct gfc_expr *);
2243 struct gfc_expr *(*f5)(struct gfc_expr *, struct gfc_expr *,
2244 struct gfc_expr *, struct gfc_expr *,
2245 struct gfc_expr *);
01ce9e31
TK
2246 struct gfc_expr *(*f6)(struct gfc_expr *, struct gfc_expr *,
2247 struct gfc_expr *, struct gfc_expr *,
2248 struct gfc_expr *, struct gfc_expr *);
6de9cd9a
DN
2249 struct gfc_expr *(*cc)(struct gfc_expr *, bt, int);
2250}
2251gfc_simplify_f;
2252
4f613946 2253/* Again like gfc_check_f, these specify the type of the resolution
13795658 2254 function associated with an intrinsic. The fX are just like in
66e4ab31 2255 gfc_check_f. f1m is used for MIN and MAX, s1 is used for abort(). */
6de9cd9a
DN
2256
2257typedef union
2258{
2259 void (*f0)(struct gfc_expr *);
2260 void (*f1)(struct gfc_expr *, struct gfc_expr *);
2261 void (*f1m)(struct gfc_expr *, struct gfc_actual_arglist *);
2262 void (*f2)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *);
2263 void (*f3)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
2264 struct gfc_expr *);
2265 void (*f4)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
2266 struct gfc_expr *, struct gfc_expr *);
2267 void (*f5)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
2268 struct gfc_expr *, struct gfc_expr *, struct gfc_expr *);
01ce9e31
TK
2269 void (*f6)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
2270 struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
2271 struct gfc_expr *);
6de9cd9a
DN
2272 void (*s1)(struct gfc_code *);
2273}
2274gfc_resolve_f;
2275
2276
2277typedef struct gfc_intrinsic_sym
2278{
cb9e4f55 2279 const char *name, *lib_name;
6de9cd9a
DN
2280 gfc_intrinsic_arg *formal;
2281 gfc_typespec ts;
4d382327 2282 unsigned elemental:1, inquiry:1, transformational:1, pure:1,
d000aa67 2283 generic:1, specific:1, actual_ok:1, noreturn:1, conversion:1,
f1abbf69 2284 from_module:1, vararg:1;
e1633d82
DF
2285
2286 int standard;
6de9cd9a
DN
2287
2288 gfc_simplify_f simplify;
2289 gfc_check_f check;
2290 gfc_resolve_f resolve;
2291 struct gfc_intrinsic_sym *specific_head, *next;
cd5ecab6 2292 gfc_isym_id id;
6de9cd9a
DN
2293
2294}
2295gfc_intrinsic_sym;
2296
2297
2298/* Expression nodes. The expression node types deserve explanations,
2299 since the last couple can be easily misconstrued:
2300
2301 EXPR_OP Operator node pointing to one or two other nodes
2302 EXPR_FUNCTION Function call, symbol points to function's name
2303 EXPR_CONSTANT A scalar constant: Logical, String, Real, Int or Complex
2304 EXPR_VARIABLE An Lvalue with a root symbol and possible reference list
8e1f752a 2305 which expresses structure, array and substring refs.
6de9cd9a
DN
2306 EXPR_NULL The NULL pointer value (which also has a basic type).
2307 EXPR_SUBSTRING A substring of a constant string
2308 EXPR_STRUCTURE A structure constructor
8e1f752a
DK
2309 EXPR_ARRAY An array constructor.
2310 EXPR_COMPCALL Function (or subroutine) call of a procedure pointer
2311 component or type-bound procedure. */
6de9cd9a 2312
f8e566e5 2313#include <mpfr.h>
eb6f9a86 2314#include <mpc.h>
c9d4cc5d 2315#define GFC_RND_MODE MPFR_RNDN
f6b855df 2316#define GFC_MPC_RND_MODE MPC_RNDNN
6de9cd9a 2317
b7e75771
JD
2318typedef splay_tree gfc_constructor_base;
2319
f622221a
JB
2320
2321/* This should be an unsigned variable of type size_t. But to handle
2322 compiling to a 64-bit target from a 32-bit host, we need to use a
2323 HOST_WIDE_INT. Also, occasionally the string length field is used
2324 as a flag with values -1 and -2, see e.g. gfc_add_assign_aux_vars.
2325 So it needs to be signed. */
2326typedef HOST_WIDE_INT gfc_charlen_t;
2327
6de9cd9a
DN
2328typedef struct gfc_expr
2329{
2330 expr_t expr_type;
2331
2332 gfc_typespec ts; /* These two refer to the overall expression */
2333
c62c6622 2334 int rank; /* 0 indicates a scalar, -1 an assumed-rank array. */
6de9cd9a
DN
2335 mpz_t *shape; /* Can be NULL if shape is unknown at compile time */
2336
4a44a72d
DK
2337 /* Nonnull for functions and structure constructors, may also used to hold the
2338 base-object for component calls. */
6de9cd9a
DN
2339 gfc_symtree *symtree;
2340
6de9cd9a
DN
2341 gfc_ref *ref;
2342
6de9cd9a
DN
2343 locus where;
2344
94fae14b
PT
2345 /* Used to store the base expression in component calls, when the expression
2346 is not a variable. */
32a9b8e0 2347 struct gfc_expr *base_expr;
94fae14b 2348
8dc63166
SK
2349 /* is_snan denotes a signalling not-a-number. */
2350 unsigned int is_snan : 1;
20585ad6 2351
ebb479cd
PT
2352 /* Sometimes, when an error has been emitted, it is necessary to prevent
2353 it from recurring. */
2354 unsigned int error : 1;
4d382327 2355
94bff632 2356 /* Mark an expression where a user operator has been substituted by
a1ab6660
PT
2357 a function call in interface.c(gfc_extend_expr). */
2358 unsigned int user_operator : 1;
ebb479cd 2359
94bff632
JW
2360 /* Mark an expression as being a MOLD argument of ALLOCATE. */
2361 unsigned int mold : 1;
4d382327 2362
43a68a9d
PT
2363 /* Will require finalization after use. */
2364 unsigned int must_finalize : 1;
2365
980fa45e
TK
2366 /* Set this if no range check should be performed on this expression. */
2367
2368 unsigned int no_bounds_check : 1;
2369
998511a6
TK
2370 /* Set this if a matmul expression has already been evaluated for conversion
2371 to a BLAS call. */
2372
2373 unsigned int external_blas : 1;
2374
01ce9e31
TK
2375 /* Set this if resolution has already happened. It could be harmful
2376 if done again. */
2377
2378 unsigned int do_not_resolve_again : 1;
2379
5197d799
TK
2380 /* Set this if no warning should be given somewhere in a lower level. */
2381
2382 unsigned int do_not_warn : 1;
4a4fc7fe
TK
2383
2384 /* Set this if the expression came from expanding an array constructor. */
2385 unsigned int from_constructor : 1;
2386
20585ad6
BM
2387 /* If an expression comes from a Hollerith constant or compile-time
2388 evaluation of a transfer statement, it may have a prescribed target-
2389 memory representation, and these cannot always be backformed from
2390 the value. */
2391 struct
2392 {
f622221a 2393 gfc_charlen_t length;
20585ad6
BM
2394 char *string;
2395 }
2396 representation;
2397
8dc63166
SK
2398 struct
2399 {
2400 int len; /* Length of BOZ string without terminating NULL. */
2401 int rdx; /* Radix of BOZ. */
2402 char *str; /* BOZ string with NULL terminating character. */
2403 }
2404 boz;
2405
6de9cd9a
DN
2406 union
2407 {
6de9cd9a 2408 int logical;
20585ad6 2409
ad7ee6f8
JD
2410 io_kind iokind;
2411
f8e566e5
SK
2412 mpz_t integer;
2413
2414 mpfr_t real;
6de9cd9a 2415
d0d92baf 2416 mpc_t complex;
6de9cd9a 2417
58b03ab2
TS
2418 struct
2419 {
a1ee985f 2420 gfc_intrinsic_op op;
58b03ab2
TS
2421 gfc_user_op *uop;
2422 struct gfc_expr *op1, *op2;
2423 }
2424 op;
2425
6de9cd9a
DN
2426 struct
2427 {
2428 gfc_actual_arglist *actual;
6b25a558 2429 const char *name; /* Points to the ultimate name of the function */
6de9cd9a
DN
2430 gfc_intrinsic_sym *isym;
2431 gfc_symbol *esym;
2432 }
2433 function;
2434
8e1f752a
DK
2435 struct
2436 {
2437 gfc_actual_arglist* actual;
e157f736 2438 const char* name;
4a44a72d
DK
2439 /* Base-object, whose component was called. NULL means that it should
2440 be taken from symtree/ref. */
2441 struct gfc_expr* base_object;
2442 gfc_typebound_proc* tbp; /* Should overlap with esym. */
2443
2444 /* For type-bound operators, we want to call PASS procedures but already
2445 have the full arglist; mark this, so that it is not extended by the
2446 PASS argument. */
2447 unsigned ignore_pass:1;
2448
2449 /* Do assign-calls rather than calls, that is appropriate dependency
2450 checking. */
2451 unsigned assign:1;
8e1f752a
DK
2452 }
2453 compcall;
2454
6de9cd9a
DN
2455 struct
2456 {
f622221a 2457 gfc_charlen_t length;
00660189 2458 gfc_char_t *string;
6de9cd9a
DN
2459 }
2460 character;
2461
b7e75771 2462 gfc_constructor_base constructor;
6de9cd9a
DN
2463 }
2464 value;
2465
5bab4c96
PT
2466 /* Used to store PDT expression lists associated with expressions. */
2467 gfc_actual_arglist *param_list;
2468
6de9cd9a
DN
2469}
2470gfc_expr;
2471
2472
93acb62c 2473#define gfc_get_shape(rank) (XCNEWVEC (mpz_t, (rank)))
6de9cd9a
DN
2474
2475/* Structures for information associated with different kinds of
2476 numbers. The first set of integer parameters define all there is
2477 to know about a particular kind. The rest of the elements are
2478 computed from the first elements. */
2479
2480typedef struct
2481{
e2cad04b 2482 /* Values really representable by the target. */
7bee49dc 2483 mpz_t huge, pedantic_min_int, min_int;
e2cad04b
RH
2484
2485 int kind, radix, digits, bit_size, range;
2486
2487 /* True if the C type of the given name maps to this precision.
2488 Note that more than one bit can be set. */
2489 unsigned int c_char : 1;
2490 unsigned int c_short : 1;
2491 unsigned int c_int : 1;
2492 unsigned int c_long : 1;
2493 unsigned int c_long_long : 1;
6de9cd9a
DN
2494}
2495gfc_integer_info;
2496
2497extern gfc_integer_info gfc_integer_kinds[];
2498
2499
2500typedef struct
2501{
2502 int kind, bit_size;
2503
e2cad04b
RH
2504 /* True if the C++ type bool, C99 type _Bool, maps to this precision. */
2505 unsigned int c_bool : 1;
6de9cd9a
DN
2506}
2507gfc_logical_info;
2508
2509extern gfc_logical_info gfc_logical_kinds[];
2510
2511
2512typedef struct
2513{
2d0aa65f 2514 mpfr_t epsilon, huge, tiny, subnormal;
6de9cd9a 2515 int kind, radix, digits, min_exponent, max_exponent;
6de9cd9a 2516 int range, precision;
e2cad04b
RH
2517
2518 /* The precision of the type as reported by GET_MODE_PRECISION. */
2519 int mode_precision;
2520
2521 /* True if the C type of the given name maps to this precision.
2522 Note that more than one bit can be set. */
2523 unsigned int c_float : 1;
2524 unsigned int c_double : 1;
2525 unsigned int c_long_double : 1;
a3c85b74 2526 unsigned int c_float128 : 1;
6de9cd9a
DN
2527}
2528gfc_real_info;
2529
2530extern gfc_real_info gfc_real_kinds[];
2531
374929b2
FXC
2532typedef struct
2533{
2534 int kind, bit_size;
2535 const char *name;
2536}
2537gfc_character_info;
2538
2539extern gfc_character_info gfc_character_kinds[];
2540
6de9cd9a
DN
2541
2542/* Equivalence structures. Equivalent lvalues are linked along the
2543 *eq pointer, equivalence sets are strung along the *next node. */
2544typedef struct gfc_equiv
2545{
2546 struct gfc_equiv *next, *eq;
2547 gfc_expr *expr;
30aabb86 2548 const char *module;
6de9cd9a
DN
2549 int used;
2550}
2551gfc_equiv;
2552
ece3f663 2553#define gfc_get_equiv() XCNEW (gfc_equiv)
6de9cd9a 2554
61321991
PT
2555/* Holds a single equivalence member after processing. */
2556typedef struct gfc_equiv_info
2557{
2558 gfc_symbol *sym;
2559 HOST_WIDE_INT offset;
37311e71 2560 HOST_WIDE_INT length;
61321991
PT
2561 struct gfc_equiv_info *next;
2562} gfc_equiv_info;
2563
2564/* Holds equivalence groups, after they have been processed. */
2565typedef struct gfc_equiv_list
2566{
2567 gfc_equiv_info *equiv;
2568 struct gfc_equiv_list *next;
2569} gfc_equiv_list;
6de9cd9a
DN
2570
2571/* gfc_case stores the selector list of a case statement. The *low
2572 and *high pointers can point to the same expression in the case of
2573 a single value. If *high is NULL, the selection is from *low
2574 upwards, if *low is NULL the selection is *high downwards.
2575
410d1a45
SK
2576 This structure has separate fields to allow single and double linked
2577 lists of CASEs at the same time. The singe linked list along the NEXT
6de9cd9a
DN
2578 field is a list of cases for a single CASE label. The double linked
2579 list along the LEFT/RIGHT fields is used to detect overlap and to
2580 build a table of the cases for SELECT constructs with a CHARACTER
2581 case expression. */
2582
2583typedef struct gfc_case
2584{
2585 /* Where we saw this case. */
2586 locus where;
2587 int n;
2588
2589 /* Case range values. If (low == high), it's a single value. If one of
2590 the labels is NULL, it's an unbounded case. If both are NULL, this
2591 represents the default case. */
2592 gfc_expr *low, *high;
2593
cf2b3c22
TB
2594 /* Only used for SELECT TYPE. */
2595 gfc_typespec ts;
2596
6de9cd9a
DN
2597 /* Next case label in the list of cases for a single CASE label. */
2598 struct gfc_case *next;
2599
2600 /* Used for detecting overlap, and for code generation. */
2601 struct gfc_case *left, *right;
2602
2603 /* True if this case label can never be matched. */
2604 int unreachable;
2605}
2606gfc_case;
2607
ece3f663 2608#define gfc_get_case() XCNEW (gfc_case)
6de9cd9a
DN
2609
2610
2611typedef struct
2612{
2613 gfc_expr *var, *start, *end, *step;
170a8bd6 2614 unsigned short unroll;
2bd86b95
HA
2615 bool ivdep;
2616 bool vector;
2617 bool novector;
6de9cd9a
DN
2618}
2619gfc_iterator;
2620
ece3f663 2621#define gfc_get_iterator() XCNEW (gfc_iterator)
6de9cd9a
DN
2622
2623
f7b529fa 2624/* Allocation structure for ALLOCATE, DEALLOCATE and NULLIFY statements. */
6de9cd9a
DN
2625
2626typedef struct gfc_alloc
2627{
2628 gfc_expr *expr;
2629 struct gfc_alloc *next;
2630}
2631gfc_alloc;
2632
ece3f663 2633#define gfc_get_alloc() XCNEW (gfc_alloc)
6de9cd9a
DN
2634
2635
2636typedef struct
2637{
2638 gfc_expr *unit, *file, *status, *access, *form, *recl,
6f0f0b2e 2639 *blank, *position, *action, *delim, *pad, *iostat, *iomsg, *convert,
0ef33d44
FR
2640 *decimal, *encoding, *round, *sign, *asynchronous, *id, *newunit,
2641 *share, *cc;
2642 char readonly;
6de9cd9a
DN
2643 gfc_st_label *err;
2644}
2645gfc_open;
2646
2647
2648typedef struct
2649{
7aba8abe 2650 gfc_expr *unit, *status, *iostat, *iomsg;
6de9cd9a
DN
2651 gfc_st_label *err;
2652}
2653gfc_close;
2654
2655
2656typedef struct
2657{
7aba8abe 2658 gfc_expr *unit, *iostat, *iomsg;
6de9cd9a
DN
2659 gfc_st_label *err;
2660}
2661gfc_filepos;
2662
2663
2664typedef struct
2665{
2666 gfc_expr *unit, *file, *iostat, *exist, *opened, *number, *named,
2667 *name, *access, *sequential, *direct, *form, *formatted,
2668 *unformatted, *recl, *nextrec, *blank, *position, *action, *read,
6f0f0b2e 2669 *write, *readwrite, *delim, *pad, *iolength, *iomsg, *convert, *strm_pos,
93e8af19 2670 *asynchronous, *decimal, *encoding, *pending, *round, *sign, *size, *id,
0ef33d44 2671 *iqstream, *share, *cc;
6de9cd9a
DN
2672
2673 gfc_st_label *err;
2674
2675}
2676gfc_inquire;
2677
2678
2679typedef struct
2680{
6f0f0b2e
JD
2681 gfc_expr *unit, *iostat, *iomsg, *id;
2682 gfc_st_label *err, *end, *eor;
2683}
2684gfc_wait;
2685
2686
2687typedef struct
2688{
2689 gfc_expr *io_unit, *format_expr, *rec, *advance, *iostat, *size, *iomsg,
2690 *id, *pos, *asynchronous, *blank, *decimal, *delim, *pad, *round,
4a8d4422 2691 *sign, *extra_comma, *dt_io_kind, *udtio;
7ee4f6f3 2692 char dec_ext;
6de9cd9a
DN
2693
2694 gfc_symbol *namelist;
2695 /* A format_label of `format_asterisk' indicates the "*" format */
2696 gfc_st_label *format_label;
2697 gfc_st_label *err, *end, *eor;
2698
e0e85e06 2699 locus eor_where, end_where, err_where;
6de9cd9a
DN
2700}
2701gfc_dt;
2702
2703
2704typedef struct gfc_forall_iterator
2705{
2706 gfc_expr *var, *start, *end, *stride;
2707 struct gfc_forall_iterator *next;
2708}
2709gfc_forall_iterator;
2710
2711
03af1e4c
DK
2712/* Linked list to store associations in an ASSOCIATE statement. */
2713
2714typedef struct gfc_association_list
2715{
4d382327 2716 struct gfc_association_list *next;
03af1e4c
DK
2717
2718 /* Whether this is association to a variable that can be changed; otherwise,
2719 it's association to an expression and the name may not be used as
2720 lvalue. */
2721 unsigned variable:1;
2722
3e78238a
DK
2723 /* True if this struct is currently only linked to from a gfc_symbol rather
2724 than as part of a real list in gfc_code->ext.block.assoc. This may
2725 happen for SELECT TYPE temporaries and must be considered
2726 for memory handling. */
2727 unsigned dangling:1;
2728
76fe932b
AV
2729 /* True when the rank of the target expression is guessed during parsing. */
2730 unsigned rankguessed:1;
2731
03af1e4c
DK
2732 char name[GFC_MAX_SYMBOL_LEN + 1];
2733 gfc_symtree *st; /* Symtree corresponding to name. */
571d54de
DK
2734 locus where;
2735
03af1e4c
DK
2736 gfc_expr *target;
2737}
2738gfc_association_list;
2739#define gfc_get_association_list() XCNEW (gfc_association_list)
2740
2741
6de9cd9a 2742/* Executable statements that fill gfc_code structures. */
a79683d5 2743enum gfc_exec_op
6de9cd9a 2744{
df1a69f6
MM
2745 EXEC_NOP = 1, EXEC_END_NESTED_BLOCK, EXEC_END_BLOCK, EXEC_ASSIGN,
2746 EXEC_LABEL_ASSIGN, EXEC_POINTER_ASSIGN, EXEC_CRITICAL, EXEC_ERROR_STOP,
8e1f752a
DK
2747 EXEC_GOTO, EXEC_CALL, EXEC_COMPCALL, EXEC_ASSIGN_CALL, EXEC_RETURN,
2748 EXEC_ENTRY, EXEC_PAUSE, EXEC_STOP, EXEC_CONTINUE, EXEC_INIT_ASSIGN,
8c6a85e3
TB
2749 EXEC_IF, EXEC_ARITHMETIC_IF, EXEC_DO, EXEC_DO_CONCURRENT, EXEC_DO_WHILE,
2750 EXEC_SELECT, EXEC_BLOCK, EXEC_FORALL, EXEC_WHERE, EXEC_CYCLE, EXEC_EXIT,
2751 EXEC_CALL_PPC, EXEC_ALLOCATE, EXEC_DEALLOCATE, EXEC_END_PROCEDURE,
70570ec1
PT
2752 EXEC_SELECT_TYPE, EXEC_SELECT_RANK, EXEC_SYNC_ALL, EXEC_SYNC_MEMORY,
2753 EXEC_SYNC_IMAGES, EXEC_OPEN, EXEC_CLOSE, EXEC_WAIT,
6de9cd9a 2754 EXEC_READ, EXEC_WRITE, EXEC_IOLENGTH, EXEC_TRANSFER, EXEC_DT_END,
6c7a4dfd 2755 EXEC_BACKSPACE, EXEC_ENDFILE, EXEC_INQUIRE, EXEC_REWIND, EXEC_FLUSH,
f8862a1b 2756 EXEC_FORM_TEAM, EXEC_CHANGE_TEAM, EXEC_END_TEAM, EXEC_SYNC_TEAM,
ef78bc3c 2757 EXEC_LOCK, EXEC_UNLOCK, EXEC_EVENT_POST, EXEC_EVENT_WAIT, EXEC_FAIL_IMAGE,
62aee289
MR
2758 EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_SERIAL_LOOP,
2759 EXEC_OACC_ROUTINE, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_SERIAL,
2760 EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE,
2761 EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA,
2762 EXEC_OACC_ATOMIC, EXEC_OACC_DECLARE,
6c7a4dfd
JJ
2763 EXEC_OMP_CRITICAL, EXEC_OMP_DO, EXEC_OMP_FLUSH, EXEC_OMP_MASTER,
2764 EXEC_OMP_ORDERED, EXEC_OMP_PARALLEL, EXEC_OMP_PARALLEL_DO,
2765 EXEC_OMP_PARALLEL_SECTIONS, EXEC_OMP_PARALLEL_WORKSHARE,
2766 EXEC_OMP_SECTIONS, EXEC_OMP_SINGLE, EXEC_OMP_WORKSHARE,
2767 EXEC_OMP_ATOMIC, EXEC_OMP_BARRIER, EXEC_OMP_END_NOWAIT,
20906c66 2768 EXEC_OMP_END_SINGLE, EXEC_OMP_TASK, EXEC_OMP_TASKWAIT,
dd2fc525
JJ
2769 EXEC_OMP_TASKYIELD, EXEC_OMP_CANCEL, EXEC_OMP_CANCELLATION_POINT,
2770 EXEC_OMP_TASKGROUP, EXEC_OMP_SIMD, EXEC_OMP_DO_SIMD,
f014c653
JJ
2771 EXEC_OMP_PARALLEL_DO_SIMD, EXEC_OMP_TARGET, EXEC_OMP_TARGET_DATA,
2772 EXEC_OMP_TEAMS, EXEC_OMP_DISTRIBUTE, EXEC_OMP_DISTRIBUTE_SIMD,
2773 EXEC_OMP_DISTRIBUTE_PARALLEL_DO, EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD,
2774 EXEC_OMP_TARGET_TEAMS, EXEC_OMP_TEAMS_DISTRIBUTE,
2775 EXEC_OMP_TEAMS_DISTRIBUTE_SIMD, EXEC_OMP_TARGET_TEAMS_DISTRIBUTE,
2776 EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD,
2777 EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO,
2778 EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
2779 EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
2780 EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
b4c3a85b
JJ
2781 EXEC_OMP_TARGET_UPDATE, EXEC_OMP_END_CRITICAL,
2782 EXEC_OMP_TARGET_ENTER_DATA, EXEC_OMP_TARGET_EXIT_DATA,
2783 EXEC_OMP_TARGET_PARALLEL, EXEC_OMP_TARGET_PARALLEL_DO,
2784 EXEC_OMP_TARGET_PARALLEL_DO_SIMD, EXEC_OMP_TARGET_SIMD,
0e3702f8 2785 EXEC_OMP_TASKLOOP, EXEC_OMP_TASKLOOP_SIMD, EXEC_OMP_SCAN, EXEC_OMP_DEPOBJ,
f6bf436d
TB
2786 EXEC_OMP_PARALLEL_MASTER, EXEC_OMP_PARALLEL_MASTER_TASKLOOP,
2787 EXEC_OMP_PARALLEL_MASTER_TASKLOOP_SIMD, EXEC_OMP_MASTER_TASKLOOP,
178191e1 2788 EXEC_OMP_MASTER_TASKLOOP_SIMD, EXEC_OMP_LOOP, EXEC_OMP_PARALLEL_LOOP,
53d5b59c
TB
2789 EXEC_OMP_TEAMS_LOOP, EXEC_OMP_TARGET_PARALLEL_LOOP,
2790 EXEC_OMP_TARGET_TEAMS_LOOP, EXEC_OMP_MASKED, EXEC_OMP_PARALLEL_MASKED,
2791 EXEC_OMP_PARALLEL_MASKED_TASKLOOP, EXEC_OMP_PARALLEL_MASKED_TASKLOOP_SIMD,
77167196
TB
2792 EXEC_OMP_MASKED_TASKLOOP, EXEC_OMP_MASKED_TASKLOOP_SIMD, EXEC_OMP_SCOPE,
2793 EXEC_OMP_ERROR
a79683d5 2794};
6de9cd9a
DN
2795
2796typedef struct gfc_code
2797{
2798 gfc_exec_op op;
2799
2800 struct gfc_code *block, *next;
2801 locus loc;
2802
79bd1948 2803 gfc_st_label *here, *label1, *label2, *label3;
6de9cd9a 2804 gfc_symtree *symtree;
5493aa17 2805 gfc_expr *expr1, *expr2, *expr3, *expr4;
6de9cd9a
DN
2806 /* A name isn't sufficient to identify a subroutine, we need the actual
2807 symbol for the interface definition.
2808 const char *sub_name; */
2809 gfc_symbol *resolved_sym;
12f681a0 2810 gfc_intrinsic_sym *resolved_isym;
6de9cd9a
DN
2811
2812 union
2813 {
2814 gfc_actual_arglist *actual;
6de9cd9a 2815 gfc_iterator *iterator;
cf2b3c22
TB
2816
2817 struct
2818 {
2819 gfc_typespec ts;
2820 gfc_alloc *list;
1792349b
AV
2821 /* Take the array specification from expr3 to allocate arrays
2822 without an explicit array specification. */
2823 unsigned arr_spec_from_expr3:1;
cf2b3c22
TB
2824 }
2825 alloc;
2826
03af1e4c
DK
2827 struct
2828 {
2829 gfc_namespace *ns;
2830 gfc_association_list *assoc;
29a63d67 2831 gfc_case *case_list;
03af1e4c
DK
2832 }
2833 block;
2834
6de9cd9a
DN
2835 gfc_open *open;
2836 gfc_close *close;
2837 gfc_filepos *filepos;
2838 gfc_inquire *inquire;
6f0f0b2e 2839 gfc_wait *wait;
6de9cd9a
DN
2840 gfc_dt *dt;
2841 gfc_forall_iterator *forall_iterator;
e5ca9693 2842 struct gfc_code *which_construct;
6de9cd9a 2843 int stop_code;
3d79abbd 2844 gfc_entry_list *entry;
dc7a8b4b 2845 gfc_oacc_declare *oacc_declare;
6c7a4dfd
JJ
2846 gfc_omp_clauses *omp_clauses;
2847 const char *omp_name;
dd2fc525 2848 gfc_omp_namelist *omp_namelist;
6c7a4dfd 2849 bool omp_bool;
6de9cd9a
DN
2850 }
2851 ext; /* Points to additional structures required by statement */
2852
e5ca9693 2853 /* Cycle and break labels in constructs. */
e7041633
NF
2854 tree cycle_label;
2855 tree exit_label;
6de9cd9a
DN
2856}
2857gfc_code;
2858
2859
2860/* Storage for DATA statements. */
2861typedef struct gfc_data_variable
2862{
2863 gfc_expr *expr;
2864 gfc_iterator iter;
2865 struct gfc_data_variable *list, *next;
2866}
2867gfc_data_variable;
2868
2869
2870typedef struct gfc_data_value
2871{
f2112868 2872 mpz_t repeat;
6de9cd9a 2873 gfc_expr *expr;
6de9cd9a
DN
2874 struct gfc_data_value *next;
2875}
2876gfc_data_value;
2877
2878
2879typedef struct gfc_data
2880{
2881 gfc_data_variable *var;
2882 gfc_data_value *value;
2883 locus where;
2884
2885 struct gfc_data *next;
2886}
2887gfc_data;
2888
6de9cd9a
DN
2889
2890/* Structure for holding compile options */
2891typedef struct
2892{
6de9cd9a
DN
2893 char *module_dir;
2894 gfc_source_form source_form;
5a06474c
JD
2895 int max_continue_fixed;
2896 int max_continue_free;
6de9cd9a 2897 int max_identifier_length;
6de9cd9a 2898
3f139fcf 2899 int max_errors;
6de9cd9a 2900
2d7c7df6 2901 int flag_preprocessed;
e0bcf78c 2902 int flag_d_lines;
51b09ce3 2903 int flag_init_integer;
66086032 2904 long flag_init_integer_value;
51b09ce3
AL
2905 int flag_init_logical;
2906 int flag_init_character;
2907 char flag_init_character_value;
6de9cd9a 2908
944b8b35 2909 int fpe;
fa86f4f9 2910 int fpe_summary;
d3d3011f 2911 int rtcheck;
944b8b35 2912
6de9cd9a
DN
2913 int warn_std;
2914 int allow_std;
2915}
2916gfc_option_t;
2917
2918extern gfc_option_t gfc_option;
2919
6de9cd9a
DN
2920/* Constructor nodes for array and structure constructors. */
2921typedef struct gfc_constructor
2922{
b7e75771
JD
2923 gfc_constructor_base base;
2924 mpz_t offset; /* Offset within a constructor, used as
2925 key within base. */
2926
6de9cd9a
DN
2927 gfc_expr *expr;
2928 gfc_iterator *iterator;
2929 locus where;
b7e75771
JD
2930
2931 union
6de9cd9a 2932 {
b7e75771 2933 gfc_component *component; /* Record the component being initialized. */
6de9cd9a
DN
2934 }
2935 n;
21ea4922
JJ
2936 mpz_t repeat; /* Record the repeat number of initial values in data
2937 statement like "data a/5*10/". */
6de9cd9a
DN
2938}
2939gfc_constructor;
2940
2941
2942typedef struct iterator_stack
2943{
2944 gfc_symtree *variable;
2945 mpz_t value;
2946 struct iterator_stack *prev;
2947}
2948iterator_stack;
2949extern iterator_stack *iter_stack;
2950
34523524 2951
7431bf06
JW
2952/* Used for (possibly nested) SELECT TYPE statements. */
2953typedef struct gfc_select_type_stack
2954{
2955 gfc_symbol *selector; /* Current selector variable. */
2956 gfc_symtree *tmp; /* Current temporary variable. */
2957 struct gfc_select_type_stack *prev; /* Previous element on stack. */
2958}
2959gfc_select_type_stack;
2960extern gfc_select_type_stack *select_type_stack;
2961#define gfc_get_select_type_stack() XCNEW (gfc_select_type_stack)
2962
2963
34523524
DK
2964/* Node in the linked list used for storing finalizer procedures. */
2965
2966typedef struct gfc_finalizer
2967{
2968 struct gfc_finalizer* next;
df2fba9e 2969 locus where; /* Where the FINAL declaration occurred. */
f6fad28e
DK
2970
2971 /* Up to resolution, we want the gfc_symbol, there we lookup the corresponding
2972 symtree and later need only that. This way, we can access and call the
2973 finalizers from every context as they should be "always accessible". I
2974 don't make this a union because we need the information whether proc_sym is
2975 still referenced or not for dereferencing it on deleting a gfc_finalizer
2976 structure. */
2977 gfc_symbol* proc_sym;
4d382327 2978 gfc_symtree* proc_tree;
34523524
DK
2979}
2980gfc_finalizer;
f6fad28e
DK
2981#define gfc_get_finalizer() XCNEW (gfc_finalizer)
2982
34523524 2983
6de9cd9a
DN
2984/************************ Function prototypes *************************/
2985
2220652d
PT
2986/* decl.c */
2987bool gfc_in_match_data (void);
8234e5e0 2988match gfc_match_char_spec (gfc_typespec *);
170a8bd6 2989extern int directive_unroll;
2bd86b95
HA
2990extern bool directive_ivdep;
2991extern bool directive_vector;
2992extern bool directive_novector;
2220652d 2993
facf0354
ML
2994/* SIMD clause enum. */
2995enum gfc_simd_clause
2996{
2997 SIMD_NONE = (1 << 0),
2998 SIMD_INBRANCH = (1 << 1),
2999 SIMD_NOTINBRANCH = (1 << 2)
3000};
3001
3002/* Tuple for parsing of vectorized built-ins. */
3003struct gfc_vect_builtin_tuple
3004{
3005 gfc_vect_builtin_tuple (const char *n, gfc_simd_clause t)
3006 : name (n), simd_type (t) {}
3007
3008 const char *name;
3009 gfc_simd_clause simd_type;
3010};
3011
3012/* Map of middle-end built-ins that should be vectorized. */
3013extern hash_map<nofree_string_hash, int> *gfc_vectorized_builtins;
3014
5bab4c96
PT
3015/* Handling Parameterized Derived Types */
3016bool gfc_insert_kind_parameter_exprs (gfc_expr *);
3017bool gfc_insert_parameter_exprs (gfc_expr *, gfc_actual_arglist *);
3018match gfc_get_pdt_instance (gfc_actual_arglist *, gfc_symbol **,
3019 gfc_actual_arglist **);
3020
7848054c
AB
3021
3022/* Given a symbol, test whether it is a module procedure in a submodule */
3023#define gfc_submodule_procedure(attr) \
3024 (gfc_state_stack->previous && gfc_state_stack->previous->previous \
3025 && gfc_state_stack->previous->previous->state == COMP_SUBMODULE \
3026 && attr->module_procedure)
3027
6de9cd9a
DN
3028/* scanner.c */
3029void gfc_scanner_done_1 (void);
3030void gfc_scanner_init_1 (void);
3031
308f961b 3032void gfc_add_include_path (const char *, bool, bool, bool);
31198773 3033void gfc_add_intrinsic_modules_path (const char *);
6de9cd9a 3034void gfc_release_include_path (void);
31198773 3035FILE *gfc_open_included_file (const char *, bool, bool);
6de9cd9a 3036
6de9cd9a
DN
3037int gfc_at_end (void);
3038int gfc_at_eof (void);
3039int gfc_at_bol (void);
3040int gfc_at_eol (void);
3041void gfc_advance_line (void);
3042int gfc_check_include (void);
9e8a6720 3043int gfc_define_undef_line (void);
6de9cd9a 3044
8fc541d3
FXC
3045int gfc_wide_is_printable (gfc_char_t);
3046int gfc_wide_is_digit (gfc_char_t);
3047int gfc_wide_fits_in_byte (gfc_char_t);
3048gfc_char_t gfc_wide_tolower (gfc_char_t);
00660189 3049gfc_char_t gfc_wide_toupper (gfc_char_t);
8fc541d3 3050size_t gfc_wide_strlen (const gfc_char_t *);
00660189
FXC
3051int gfc_wide_strncasecmp (const gfc_char_t *, const char *, size_t);
3052gfc_char_t *gfc_wide_memset (gfc_char_t *, gfc_char_t, size_t);
3053char *gfc_widechar_to_char (const gfc_char_t *, int);
3054gfc_char_t *gfc_char_to_widechar (const char *);
3055
ece3f663 3056#define gfc_get_wide_string(n) XCNEWVEC (gfc_char_t, n)
8fc541d3 3057
6de9cd9a 3058void gfc_skip_comments (void);
696abb30 3059gfc_char_t gfc_next_char_literal (gfc_instring);
8fc541d3
FXC
3060gfc_char_t gfc_next_char (void);
3061char gfc_next_ascii_char (void);
3062gfc_char_t gfc_peek_char (void);
3063char gfc_peek_ascii_char (void);
6de9cd9a
DN
3064void gfc_error_recovery (void);
3065void gfc_gobble_whitespace (void);
524af0d6 3066bool gfc_new_file (void);
2d7c7df6 3067const char * gfc_read_orig_filename (const char *, const char **);
6de9cd9a 3068
d4fa05b9 3069extern gfc_source_form gfc_current_form;
e0bcf78c 3070extern const char *gfc_source_file;
63645982 3071extern locus gfc_current_locus;
6de9cd9a 3072
60332588
JJ
3073void gfc_start_source_files (void);
3074void gfc_end_source_files (void);
3075
6de9cd9a 3076/* misc.c */
6de9cd9a
DN
3077void gfc_clear_ts (gfc_typespec *);
3078FILE *gfc_open_file (const char *);
6de9cd9a 3079const char *gfc_basic_typename (bt);
f61e54e5 3080const char *gfc_dummy_typename (gfc_typespec *);
5958b926 3081const char *gfc_typename (gfc_typespec *, bool for_hash = false);
f61e54e5 3082const char *gfc_typename (gfc_expr *);
ba3ba492 3083const char *gfc_op2string (gfc_intrinsic_op);
6de9cd9a
DN
3084const char *gfc_code2string (const mstring *, int);
3085int gfc_string2code (const mstring *, const char *);
3086const char *gfc_intent_string (sym_intent);
3087
3088void gfc_init_1 (void);
3089void gfc_init_2 (void);
3090void gfc_done_1 (void);
3091void gfc_done_2 (void);
3092
a8b3b0b6
CR
3093int get_c_kind (const char *, CInteropKind_t *);
3094
bcc478b9
BRF
3095const char *gfc_closest_fuzzy_match (const char *, char **);
3096static inline void
3097vec_push (char **&optr, size_t &osz, const char *elt)
3098{
3099 /* {auto,}vec.safe_push () replacement. Don't ask.. */
3100 // if (strlen (elt) < 4) return; premature optimization: eliminated by cutoff
3101 optr = XRESIZEVEC (char *, optr, osz + 2);
3102 optr[osz] = CONST_CAST (char *, elt);
3103 optr[++osz] = NULL;
3104}
3105
f622221a
JB
3106HOST_WIDE_INT gfc_mpz_get_hwi (mpz_t);
3107void gfc_mpz_set_hwi (mpz_t, const HOST_WIDE_INT);
3108
6de9cd9a 3109/* options.c */
7a9bf9a4 3110unsigned int gfc_option_lang_mask (void);
a75bfaa6 3111void gfc_init_options_struct (struct gcc_options *);
7a9bf9a4
JM
3112void gfc_init_options (unsigned int,
3113 struct cl_decoded_option *);
00abf86c 3114bool gfc_handle_option (size_t, const char *, HOST_WIDE_INT, int, location_t,
5f20c657 3115 const struct cl_option_handlers *);
6de9cd9a 3116bool gfc_post_options (const char **);
41804a5b 3117char *gfc_get_option_string (void);
6de9cd9a 3118
602b8523
TB
3119/* f95-lang.c */
3120void gfc_maybe_initialize_eh (void);
3121
6de9cd9a 3122/* iresolve.c */
6b25a558 3123const char * gfc_get_string (const char *, ...) ATTRIBUTE_PRINTF_1;
a68ab351 3124bool gfc_find_sym_in_expr (gfc_symbol *, gfc_expr *);
6de9cd9a
DN
3125
3126/* error.c */
6de9cd9a 3127void gfc_error_init_1 (void);
3aa34c1d
MLI
3128void gfc_diagnostics_init (void);
3129void gfc_diagnostics_finish (void);
0f447a6e 3130void gfc_buffer_error (bool);
6de9cd9a 3131
00660189
FXC
3132const char *gfc_print_wide_char (gfc_char_t);
3133
48749dbc 3134bool gfc_warning (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
4daa149b 3135bool gfc_warning_now (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
be841e11 3136bool gfc_warning_internal (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
2a2703a2
MLI
3137bool gfc_warning_now_at (location_t loc, int opt, const char *gmsgid, ...)
3138 ATTRIBUTE_GCC_GFC(3,4);
8e54f6d3 3139
6de9cd9a
DN
3140void gfc_clear_warning (void);
3141void gfc_warning_check (void);
3142
2700d0e3 3143void gfc_error_opt (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
0ce0154c
KG
3144void gfc_error (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
3145void gfc_error_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
3146void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
3147void gfc_internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
6de9cd9a 3148void gfc_clear_error (void);
b5a9fd3e 3149bool gfc_error_check (void);
0f447a6e 3150bool gfc_error_flag_test (void);
6de9cd9a 3151
8f0d39a8 3152notification gfc_notification_std (int);
524af0d6 3153bool gfc_notify_std (int, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
6de9cd9a
DN
3154
3155/* A general purpose syntax error. */
3156#define gfc_syntax_error(ST) \
3157 gfc_error ("Syntax error in %s statement at %C", gfc_ascii_statement (ST));
3158
fea70c99
MLI
3159#include "pretty-print.h" /* For output_buffer. */
3160struct gfc_error_buffer
3161{
3162 bool flag;
3163 output_buffer buffer;
3164 gfc_error_buffer(void) : flag(false), buffer() {}
3165};
3166
3167void gfc_push_error (gfc_error_buffer *);
3168void gfc_pop_error (gfc_error_buffer *);
3169void gfc_free_error (gfc_error_buffer *);
6de9cd9a 3170
6de9cd9a 3171void gfc_get_errors (int *, int *);
f4031599 3172void gfc_errors_to_warnings (bool);
6de9cd9a
DN
3173
3174/* arith.c */
3175void gfc_arith_init_1 (void);
3176void gfc_arith_done_1 (void);
25d8f0a2 3177arith gfc_check_integer_range (mpz_t p, int kind);
d393bbd7 3178bool gfc_check_character_range (gfc_char_t, int);
6de9cd9a 3179
67251118
TK
3180extern bool gfc_seen_div0;
3181
5e8e542f 3182/* trans-types.c */
524af0d6 3183bool gfc_check_any_c_kind (gfc_typespec *);
e7a2d5fb 3184int gfc_validate_kind (bt, int, bool);
e0a6661b
FXC
3185int gfc_get_int_kind_from_width_isofortranenv (int size);
3186int gfc_get_real_kind_from_width_isofortranenv (int size);
f6288c24 3187tree gfc_get_union_type (gfc_symbol *);
de91486c 3188tree gfc_get_derived_type (gfc_symbol * derived, int codimen = 0);
6de9cd9a 3189extern int gfc_index_integer_kind;
9d64df18 3190extern int gfc_default_integer_kind;
f4e7375a 3191extern int gfc_max_integer_kind;
9d64df18
TS
3192extern int gfc_default_real_kind;
3193extern int gfc_default_double_kind;
3194extern int gfc_default_character_kind;
3195extern int gfc_default_logical_kind;
3196extern int gfc_default_complex_kind;
e8525382 3197extern int gfc_c_int_kind;
a6d22fb2 3198extern int gfc_c_intptr_kind;
da661a58
TB
3199extern int gfc_atomic_int_kind;
3200extern int gfc_atomic_logical_kind;
014ec6ee 3201extern int gfc_intio_kind;
f1412ca5 3202extern int gfc_charlen_int_kind;
f622221a 3203extern int gfc_size_kind;
39f87c03
FXC
3204extern int gfc_numeric_storage_size;
3205extern int gfc_character_storage_size;
6de9cd9a 3206
64b1806b 3207#define gfc_logical_4_kind 4
6ef1366a 3208#define gfc_integer_4_kind 4
13b1afe4 3209#define gfc_real_4_kind 4
64b1806b 3210
6de9cd9a
DN
3211/* symbol.c */
3212void gfc_clear_new_implicit (void);
524af0d6
JB
3213bool gfc_add_new_implicit_range (int, int);
3214bool gfc_merge_new_implicit (gfc_typespec *);
a6c63173 3215void gfc_set_implicit_none (bool, bool, locus *);
e9bd9f7d 3216void gfc_check_function_type (gfc_namespace *);
e9c06563 3217bool gfc_is_intrinsic_typename (const char *);
b323be61 3218bool gfc_check_conflict (symbol_attribute *, const char *, locus *);
6de9cd9a 3219
713485cc 3220gfc_typespec *gfc_get_default_type (const char *, gfc_namespace *);
524af0d6 3221bool gfc_set_default_type (gfc_symbol *, int, gfc_namespace *);
6de9cd9a 3222
66e4ab31 3223void gfc_set_sym_referenced (gfc_symbol *);
6de9cd9a 3224
524af0d6
JB
3225bool gfc_add_attribute (symbol_attribute *, locus *);
3226bool gfc_add_ext_attribute (symbol_attribute *, ext_attr_id_t, locus *);
3227bool gfc_add_allocatable (symbol_attribute *, locus *);
3228bool gfc_add_codimension (symbol_attribute *, const char *, locus *);
3229bool gfc_add_contiguous (symbol_attribute *, const char *, locus *);
3230bool gfc_add_dimension (symbol_attribute *, const char *, locus *);
3231bool gfc_add_external (symbol_attribute *, locus *);
3232bool gfc_add_intrinsic (symbol_attribute *, locus *);
3233bool gfc_add_optional (symbol_attribute *, locus *);
5bab4c96
PT
3234bool gfc_add_kind (symbol_attribute *, locus *);
3235bool gfc_add_len (symbol_attribute *, locus *);
524af0d6
JB
3236bool gfc_add_pointer (symbol_attribute *, locus *);
3237bool gfc_add_cray_pointer (symbol_attribute *, locus *);
3238bool gfc_add_cray_pointee (symbol_attribute *, locus *);
32e8bb8e 3239match gfc_mod_pointee_as (gfc_array_spec *);
524af0d6
JB
3240bool gfc_add_protected (symbol_attribute *, const char *, locus *);
3241bool gfc_add_result (symbol_attribute *, const char *, locus *);
34d567d1 3242bool gfc_add_automatic (symbol_attribute *, const char *, locus *);
524af0d6
JB
3243bool gfc_add_save (symbol_attribute *, save_state, const char *, locus *);
3244bool gfc_add_threadprivate (symbol_attribute *, const char *, locus *);
f014c653 3245bool gfc_add_omp_declare_target (symbol_attribute *, const char *, locus *);
b4c3a85b
JJ
3246bool gfc_add_omp_declare_target_link (symbol_attribute *, const char *,
3247 locus *);
524af0d6
JB
3248bool gfc_add_saved_common (symbol_attribute *, locus *);
3249bool gfc_add_target (symbol_attribute *, locus *);
3250bool gfc_add_dummy (symbol_attribute *, const char *, locus *);
3251bool gfc_add_generic (symbol_attribute *, const char *, locus *);
3252bool gfc_add_common (symbol_attribute *, locus *);
3253bool gfc_add_in_common (symbol_attribute *, const char *, locus *);
3254bool gfc_add_in_equivalence (symbol_attribute *, const char *, locus *);
3255bool gfc_add_data (symbol_attribute *, const char *, locus *);
3256bool gfc_add_in_namelist (symbol_attribute *, const char *, locus *);
3257bool gfc_add_sequence (symbol_attribute *, const char *, locus *);
3258bool gfc_add_elemental (symbol_attribute *, locus *);
3259bool gfc_add_pure (symbol_attribute *, locus *);
3260bool gfc_add_recursive (symbol_attribute *, locus *);
3261bool gfc_add_function (symbol_attribute *, const char *, locus *);
3262bool gfc_add_subroutine (symbol_attribute *, const char *, locus *);
3263bool gfc_add_volatile (symbol_attribute *, const char *, locus *);
3264bool gfc_add_asynchronous (symbol_attribute *, const char *, locus *);
3265bool gfc_add_proc (symbol_attribute *attr, const char *name, locus *where);
3266bool gfc_add_abstract (symbol_attribute* attr, locus* where);
3267
3268bool gfc_add_access (symbol_attribute *, gfc_access, const char *, locus *);
3269bool gfc_add_is_bind_c (symbol_attribute *, const char *, locus *, int);
3270bool gfc_add_extension (symbol_attribute *, locus *);
3271bool gfc_add_value (symbol_attribute *, const char *, locus *);
3272bool gfc_add_flavor (symbol_attribute *, sym_flavor, const char *, locus *);
3273bool gfc_add_entry (symbol_attribute *, const char *, locus *);
3274bool gfc_add_procedure (symbol_attribute *, procedure_type,
231b2fcc 3275 const char *, locus *);
524af0d6
JB
3276bool gfc_add_intent (symbol_attribute *, sym_intent, locus *);
3277bool gfc_add_explicit_interface (gfc_symbol *, ifsrc,
6de9cd9a 3278 gfc_formal_arglist *, locus *);
524af0d6 3279bool gfc_add_type (gfc_symbol *, gfc_typespec *, locus *);
6de9cd9a
DN
3280
3281void gfc_clear_attr (symbol_attribute *);
524af0d6
JB
3282bool gfc_missing_attr (symbol_attribute *, locus *);
3283bool gfc_copy_attr (symbol_attribute *, symbol_attribute *, locus *);
4668d6f9 3284int gfc_copy_dummy_sym (gfc_symbol **, gfc_symbol *, int);
524af0d6 3285bool gfc_add_component (gfc_symbol *, const char *, gfc_component **);
6de9cd9a
DN
3286gfc_symbol *gfc_use_derived (gfc_symbol *);
3287gfc_symtree *gfc_use_derived_tree (gfc_symtree *);
f6288c24
FR
3288gfc_component *gfc_find_component (gfc_symbol *, const char *, bool, bool,
3289 gfc_ref **);
6de9cd9a
DN
3290
3291gfc_st_label *gfc_get_st_label (int);
3292void gfc_free_st_label (gfc_st_label *);
3293void gfc_define_st_label (gfc_st_label *, gfc_sl_type, locus *);
524af0d6 3294bool gfc_reference_st_label (gfc_st_label *, gfc_sl_type);
6de9cd9a 3295
0366dfe9 3296gfc_namespace *gfc_get_namespace (gfc_namespace *, int);
6de9cd9a
DN
3297gfc_symtree *gfc_new_symtree (gfc_symtree **, const char *);
3298gfc_symtree *gfc_find_symtree (gfc_symtree *, const char *);
a99d95a2 3299void gfc_delete_symtree (gfc_symtree **, const char *);
aa84a9a5 3300gfc_symtree *gfc_get_unique_symtree (gfc_namespace *);
6de9cd9a
DN
3301gfc_user_op *gfc_get_uop (const char *);
3302gfc_user_op *gfc_find_uop (const char *, gfc_namespace *);
3303void gfc_free_symbol (gfc_symbol *);
3cb595ac 3304void gfc_release_symbol (gfc_symbol *);
6de9cd9a 3305gfc_symbol *gfc_new_symbol (const char *, gfc_namespace *);
61b644c2 3306gfc_symtree* gfc_find_symtree_in_proc (const char *, gfc_namespace *);
6de9cd9a
DN
3307int gfc_find_symbol (const char *, gfc_namespace *, int, gfc_symbol **);
3308int gfc_find_sym_tree (const char *, gfc_namespace *, int, gfc_symtree **);
3309int gfc_get_symbol (const char *, gfc_namespace *, gfc_symbol **);
524af0d6
JB
3310bool gfc_verify_c_interop (gfc_typespec *);
3311bool gfc_verify_c_interop_param (gfc_symbol *);
3312bool verify_bind_c_sym (gfc_symbol *, gfc_typespec *, int, gfc_common_head *);
3313bool verify_bind_c_derived_type (gfc_symbol *);
3314bool verify_com_block_vars_c_interop (gfc_common_head *);
cadddfdd
TB
3315gfc_symtree *generate_isocbinding_symbol (const char *, iso_c_binding_symbol,
3316 const char *, gfc_symtree *, bool);
44c57c2f 3317void gfc_save_symbol_data (gfc_symbol *);
08a6b8e0 3318int gfc_get_sym_tree (const char *, gfc_namespace *, gfc_symtree **, bool);
6de9cd9a
DN
3319int gfc_get_ha_symbol (const char *, gfc_symbol **);
3320int gfc_get_ha_sym_tree (const char *, gfc_symtree **);
3321
ab68a73e
MM
3322void gfc_drop_last_undo_checkpoint (void);
3323void gfc_restore_last_undo_checkpoint (void);
6de9cd9a
DN
3324void gfc_undo_symbols (void);
3325void gfc_commit_symbols (void);
66e4ab31 3326void gfc_commit_symbol (gfc_symbol *);
b76e28c6 3327gfc_charlen *gfc_new_charlen (gfc_namespace *, gfc_charlen *);
27f31e39 3328void gfc_free_charlen (gfc_charlen *, gfc_charlen *);
6de9cd9a
DN
3329void gfc_free_namespace (gfc_namespace *);
3330
3331void gfc_symbol_init_2 (void);
3332void gfc_symbol_done_2 (void);
3333
9056bd70 3334void gfc_traverse_symtree (gfc_symtree *, void (*)(gfc_symtree *));
6de9cd9a
DN
3335void gfc_traverse_ns (gfc_namespace *, void (*)(gfc_symbol *));
3336void gfc_traverse_user_op (gfc_namespace *, void (*)(gfc_user_op *));
3337void gfc_save_all (gfc_namespace *);
3338
4bc20f3a 3339void gfc_enforce_clean_symbol_state (void);
6de9cd9a 3340
55b9c612 3341gfc_gsymbol *gfc_get_gsymbol (const char *, bool bind_c);
cb9e4f55 3342gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *);
98452460 3343gfc_gsymbol *gfc_find_case_gsymbol (gfc_gsymbol *, const char *);
5c6aa9a8 3344void gfc_traverse_gsymbol (gfc_gsymbol *, void (*)(gfc_gsymbol *, void *), void *);
c9543002 3345
3e15518b 3346gfc_typebound_proc* gfc_get_typebound_proc (gfc_typebound_proc*);
30b608eb 3347gfc_symbol* gfc_get_derived_super_type (gfc_symbol*);
cf2b3c22
TB
3348gfc_symbol* gfc_get_ultimate_derived_super_type (gfc_symbol*);
3349bool gfc_type_is_extension_of (gfc_symbol *, gfc_symbol *);
e74f1cc8 3350bool gfc_type_compatible (gfc_typespec *, gfc_typespec *);
30b608eb 3351
8fdcb6a9 3352void gfc_copy_formal_args_intr (gfc_symbol *, gfc_intrinsic_sym *,
47d13acb 3353 gfc_actual_arglist *, bool copy_type = false);
69773742 3354
34523524
DK
3355void gfc_free_finalizer (gfc_finalizer *el); /* Needed in resolve.c, too */
3356
524af0d6 3357bool gfc_check_symbol_typed (gfc_symbol*, gfc_namespace*, bool, locus);
52bf62f9 3358gfc_namespace* gfc_find_proc_namespace (gfc_namespace*);
f37e928c 3359
571d54de 3360bool gfc_is_associate_pointer (gfc_symbol*);
c3f34952 3361gfc_symbol * gfc_find_dt_in_generic (gfc_symbol *);
4cbc9039 3362gfc_formal_arglist *gfc_sym_get_dummy_args (gfc_symbol *);
571d54de 3363
f2cbd86c
DF
3364/* intrinsic.c -- true if working in an init-expr, false otherwise. */
3365extern bool gfc_init_expr_flag;
6de9cd9a
DN
3366
3367/* Given a symbol that we have decided is intrinsic, mark it as such
3368 by placing it into a special module that is otherwise impossible to
3369 read or write. */
3370
cb9e4f55 3371#define gfc_intrinsic_symbol(SYM) SYM->module = gfc_get_string ("(intrinsic)")
6de9cd9a
DN
3372
3373void gfc_intrinsic_init_1 (void);
3374void gfc_intrinsic_done_1 (void);
3375
01ce9e31 3376char gfc_type_letter (bt, bool logical_equals_int = false);
6de9cd9a 3377gfc_symbol * gfc_get_intrinsic_sub_symbol (const char *);
47d13acb
TK
3378gfc_symbol *gfc_get_intrinsic_function_symbol (gfc_expr *);
3379gfc_symbol *gfc_find_intrinsic_symbol (gfc_expr *);
524af0d6 3380bool gfc_convert_type (gfc_expr *, gfc_typespec *, int);
8405874a
ME
3381bool gfc_convert_type_warn (gfc_expr *, gfc_typespec *, int, int,
3382 bool array = false);
524af0d6 3383bool gfc_convert_chartype (gfc_expr *, gfc_typespec *);
6de9cd9a
DN
3384int gfc_generic_intrinsic (const char *);
3385int gfc_specific_intrinsic (const char *);
c3005b0f 3386bool gfc_is_intrinsic (gfc_symbol*, int, locus);
0e7e7e6e 3387int gfc_intrinsic_actual_ok (const char *, const bool);
6de9cd9a 3388gfc_intrinsic_sym *gfc_find_function (const char *);
cd5ecab6 3389gfc_intrinsic_sym *gfc_find_subroutine (const char *);
d000aa67 3390gfc_intrinsic_sym *gfc_intrinsic_function_by_id (gfc_isym_id);
cadddfdd
TB
3391gfc_intrinsic_sym *gfc_intrinsic_subroutine_by_id (gfc_isym_id);
3392gfc_isym_id gfc_isym_id_by_intmod (intmod_id, int);
3393gfc_isym_id gfc_isym_id_by_intmod_sym (gfc_symbol *);
3394
6de9cd9a
DN
3395
3396match gfc_intrinsic_func_interface (gfc_expr *, int);
3397match gfc_intrinsic_sub_interface (gfc_code *, int);
3398
c3005b0f 3399void gfc_warn_intrinsic_shadow (const gfc_symbol*, bool, bool);
524af0d6 3400bool gfc_check_intrinsic_standard (const gfc_intrinsic_sym*, const char**,
17b1d2a0 3401 bool, locus);
c3005b0f 3402
6de9cd9a
DN
3403/* match.c -- FIXME */
3404void gfc_free_iterator (gfc_iterator *, int);
3405void gfc_free_forall_iterator (gfc_forall_iterator *);
3406void gfc_free_alloc_list (gfc_alloc *);
3407void gfc_free_namelist (gfc_namelist *);
9a5de4d5 3408void gfc_free_omp_namelist (gfc_omp_namelist *, bool);
6de9cd9a 3409void gfc_free_equiv (gfc_equiv *);
31fee91e 3410void gfc_free_equiv_until (gfc_equiv *, gfc_equiv *);
6de9cd9a 3411void gfc_free_data (gfc_data *);
d5e2274d 3412void gfc_reject_data (gfc_namespace *);
6de9cd9a
DN
3413void gfc_free_case_list (gfc_case *);
3414
b6398823
PT
3415/* matchexp.c -- FIXME too? */
3416gfc_expr *gfc_get_parentheses (gfc_expr *);
3417
6c7a4dfd 3418/* openmp.c */
c7d3bb76 3419struct gfc_omp_saved_state { void *ptrs[2]; int ints[1]; };
269322ec
TB
3420bool gfc_omp_requires_add_clause (gfc_omp_requires_kind, const char *,
3421 locus *, const char *);
3422void gfc_check_omp_requires (gfc_namespace *, int);
6c7a4dfd 3423void gfc_free_omp_clauses (gfc_omp_clauses *);
dc7a8b4b 3424void gfc_free_oacc_declare_clauses (struct gfc_oacc_declare *);
dd2fc525
JJ
3425void gfc_free_omp_declare_simd (gfc_omp_declare_simd *);
3426void gfc_free_omp_declare_simd_list (gfc_omp_declare_simd *);
5f23671d
JJ
3427void gfc_free_omp_udr (gfc_omp_udr *);
3428gfc_omp_udr *gfc_omp_udr_find (gfc_symtree *, gfc_typespec *);
6c7a4dfd 3429void gfc_resolve_omp_directive (gfc_code *, gfc_namespace *);
cd30a0b8
JJ
3430void gfc_resolve_do_iterator (gfc_code *, gfc_symbol *, bool);
3431void gfc_resolve_omp_local_vars (gfc_namespace *);
6c7a4dfd
JJ
3432void gfc_resolve_omp_parallel_blocks (gfc_code *, gfc_namespace *);
3433void gfc_resolve_omp_do_blocks (gfc_code *, gfc_namespace *);
dd2fc525 3434void gfc_resolve_omp_declare_simd (gfc_namespace *);
5f23671d 3435void gfc_resolve_omp_udrs (gfc_symtree *);
c7d3bb76
JJ
3436void gfc_omp_save_and_clear_state (struct gfc_omp_saved_state *);
3437void gfc_omp_restore_state (struct gfc_omp_saved_state *);
41dbbb37
TS
3438void gfc_free_expr_list (gfc_expr_list *);
3439void gfc_resolve_oacc_directive (gfc_code *, gfc_namespace *);
3440void gfc_resolve_oacc_declare (gfc_namespace *);
3441void gfc_resolve_oacc_parallel_loop_blocks (gfc_code *, gfc_namespace *);
3442void gfc_resolve_oacc_blocks (gfc_code *, gfc_namespace *);
f6bf4bc1 3443void gfc_resolve_oacc_routines (gfc_namespace *);
6c7a4dfd 3444
6de9cd9a
DN
3445/* expr.c */
3446void gfc_free_actual_arglist (gfc_actual_arglist *);
3447gfc_actual_arglist *gfc_copy_actual_arglist (gfc_actual_arglist *);
f622221a 3448
51f03c6b 3449bool gfc_extract_int (gfc_expr *, int *, int = 0);
f622221a
JB
3450bool gfc_extract_hwi (gfc_expr *, HOST_WIDE_INT *, int = 0);
3451
0d78e4aa 3452bool is_CFI_desc (gfc_symbol *, gfc_expr *);
1d6b7f39 3453bool is_subref_array (gfc_expr *);
460263d0 3454bool gfc_is_simply_contiguous (gfc_expr *, bool, bool);
419af57c 3455bool gfc_is_not_contiguous (gfc_expr *);
524af0d6 3456bool gfc_check_init_expr (gfc_expr *);
6de9cd9a
DN
3457
3458gfc_expr *gfc_build_conversion (gfc_expr *);
3459void gfc_free_ref_list (gfc_ref *);
dcea1b2f 3460void gfc_type_convert_binary (gfc_expr *, int);
7a28353e 3461bool gfc_is_constant_expr (gfc_expr *);
524af0d6 3462bool gfc_simplify_expr (gfc_expr *, int);
4075a94e 3463int gfc_has_vector_index (gfc_expr *);
6de9cd9a
DN
3464
3465gfc_expr *gfc_get_expr (void);
b7e75771
JD
3466gfc_expr *gfc_get_array_expr (bt type, int kind, locus *);
3467gfc_expr *gfc_get_null_expr (locus *);
3468gfc_expr *gfc_get_operator_expr (locus *, gfc_intrinsic_op,gfc_expr *, gfc_expr *);
3469gfc_expr *gfc_get_structure_constructor_expr (bt, int, locus *);
3470gfc_expr *gfc_get_constant_expr (bt, int, locus *);
f622221a
JB
3471gfc_expr *gfc_get_character_expr (int, locus *, const char *, gfc_charlen_t len);
3472gfc_expr *gfc_get_int_expr (int, locus *, HOST_WIDE_INT);
b7e75771
JD
3473gfc_expr *gfc_get_logical_expr (int, locus *, bool);
3474gfc_expr *gfc_get_iokind_expr (locus *, io_kind);
3475
7d7212ec
MM
3476void gfc_clear_shape (mpz_t *shape, int rank);
3477void gfc_free_shape (mpz_t **shape, int rank);
6de9cd9a
DN
3478void gfc_free_expr (gfc_expr *);
3479void gfc_replace_expr (gfc_expr *, gfc_expr *);
6de9cd9a 3480mpz_t *gfc_copy_shape (mpz_t *, int);
94538bd1 3481mpz_t *gfc_copy_shape_excluding (mpz_t *, int, gfc_expr *);
6de9cd9a 3482gfc_expr *gfc_copy_expr (gfc_expr *);
8e1f752a 3483gfc_ref* gfc_copy_ref (gfc_ref*);
6de9cd9a 3484
524af0d6 3485bool gfc_specification_expr (gfc_expr *);
6de9cd9a
DN
3486
3487int gfc_numeric_ts (gfc_typespec *);
3488int gfc_kind_max (gfc_expr *, gfc_expr *);
3489
524af0d6 3490bool gfc_check_conformance (gfc_expr *, gfc_expr *, const char *, ...) ATTRIBUTE_PRINTF_3;
3c9f5092 3491bool gfc_check_assign (gfc_expr *, gfc_expr *, int, bool c = true);
83fad929 3492bool gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue,
cedf8d2e
TK
3493 bool suppres_type_test = false,
3494 bool is_init_expr = false);
524af0d6 3495bool gfc_check_assign_symbol (gfc_symbol *, gfc_component *, gfc_expr *);
6de9cd9a 3496
7fc61626 3497gfc_expr *gfc_build_default_init_expr (gfc_typespec *, locus *);
13051352 3498gfc_expr *gfc_build_init_expr (gfc_typespec *, locus *, bool);
7fc61626 3499void gfc_apply_init (gfc_typespec *, symbol_attribute *, gfc_expr *);
16e520b6 3500bool gfc_has_default_initializer (gfc_symbol *);
54b4ba60 3501gfc_expr *gfc_default_initializer (gfc_typespec *);
7fc61626 3502gfc_expr *gfc_generate_initializer (gfc_typespec *, bool);
294fbfc8 3503gfc_expr *gfc_get_variable_expr (gfc_symtree *);
4d382327 3504void gfc_add_full_array_ref (gfc_expr *, gfc_array_spec *);
0d87fa8c 3505gfc_expr * gfc_lval_expr_from_sym (gfc_symbol *);
294fbfc8 3506
b7d1d8b4
PT
3507gfc_array_spec *gfc_get_full_arrayspec_from_expr (gfc_expr *expr);
3508
640670c7
PT
3509bool gfc_traverse_expr (gfc_expr *, gfc_symbol *,
3510 bool (*)(gfc_expr *, gfc_symbol *, int*),
3511 int);
66e4ab31 3512void gfc_expr_set_symbols_referenced (gfc_expr *);
524af0d6 3513bool gfc_expr_check_typed (gfc_expr*, gfc_namespace*, bool);
5bab4c96
PT
3514bool gfc_derived_parameter_expr (gfc_expr *);
3515gfc_param_spec_type gfc_spec_list_type (gfc_actual_arglist *, gfc_symbol *);
2a573572
MM
3516gfc_component * gfc_get_proc_ptr_comp (gfc_expr *);
3517bool gfc_is_proc_ptr_comp (gfc_expr *);
43a68a9d 3518bool gfc_is_alloc_class_scalar_function (gfc_expr *);
a6b22eea 3519bool gfc_is_class_array_function (gfc_expr *);
713485cc 3520
badd9e69 3521bool gfc_ref_this_image (gfc_ref *ref);
d3a9eea2 3522bool gfc_is_coindexed (gfc_expr *);
394d3a2e 3523bool gfc_is_coarray (gfc_expr *);
4dc694b2 3524int gfc_get_corank (gfc_expr *);
d3a9eea2
TB
3525bool gfc_has_ultimate_allocatable (gfc_expr *);
3526bool gfc_has_ultimate_pointer (gfc_expr *);
f8862a1b 3527gfc_expr* gfc_find_team_co (gfc_expr *);
20d0bfce 3528gfc_expr* gfc_find_stat_co (gfc_expr *);
6838c137
TB
3529gfc_expr* gfc_build_intrinsic_call (gfc_namespace *, gfc_isym_id, const char*,
3530 locus, unsigned, ...);
524af0d6 3531bool gfc_check_vardef_context (gfc_expr*, bool, bool, bool, const char*);
69dcd06a 3532
d3a9eea2 3533
6de9cd9a
DN
3534/* st.c */
3535extern gfc_code new_st;
3536
3537void gfc_clear_new_st (void);
11e5274a 3538gfc_code *gfc_get_code (gfc_exec_op);
6de9cd9a
DN
3539gfc_code *gfc_append_code (gfc_code *, gfc_code *);
3540void gfc_free_statement (gfc_code *);
3541void gfc_free_statements (gfc_code *);
03af1e4c 3542void gfc_free_association_list (gfc_association_list *);
6de9cd9a
DN
3543
3544/* resolve.c */
de89b574
TB
3545void gfc_expression_rank (gfc_expr *);
3546bool gfc_resolve_ref (gfc_expr *);
524af0d6 3547bool gfc_resolve_expr (gfc_expr *);
6de9cd9a 3548void gfc_resolve (gfc_namespace *);
b46ebd6c 3549void gfc_resolve_code (gfc_code *, gfc_namespace *);
6c7a4dfd 3550void gfc_resolve_blocks (gfc_code *, gfc_namespace *);
3ab216a4 3551void gfc_resolve_formal_arglist (gfc_symbol *);
6de9cd9a
DN
3552int gfc_impure_variable (gfc_symbol *);
3553int gfc_pure (gfc_symbol *);
f1f39033 3554int gfc_implicit_pure (gfc_symbol *);
ccd7751b 3555void gfc_unset_implicit_pure (gfc_symbol *);
6de9cd9a 3556int gfc_elemental (gfc_symbol *);
524af0d6
JB
3557bool gfc_resolve_iterator (gfc_iterator *, bool, bool);
3558bool find_forall_index (gfc_expr *, gfc_symbol *, int);
3559bool gfc_resolve_index (gfc_expr *, int);
3560bool gfc_resolve_dim_arg (gfc_expr *);
7a28353e 3561bool gfc_is_formal_arg (void);
bdd1b1f5 3562bool gfc_resolve_substring (gfc_ref *, bool *);
07368af0 3563void gfc_resolve_substring_charlen (gfc_expr *);
a8b3b0b6 3564match gfc_iso_c_sub_interface(gfc_code *, gfc_symbol *);
cf2b3c22 3565gfc_expr *gfc_expr_to_initialize (gfc_expr *);
2dda89a8 3566bool gfc_type_is_extensible (gfc_symbol *);
524af0d6 3567bool gfc_resolve_intrinsic (gfc_symbol *, locus *);
96486998 3568bool gfc_explicit_interface_required (gfc_symbol *, char *, int);
ce96d372 3569extern int gfc_do_concurrent_flag;
bcc478b9 3570const char* gfc_lookup_function_fuzzy (const char *, gfc_symtree *);
6457b1f0
JW
3571int gfc_pure_function (gfc_expr *e, const char **name);
3572int gfc_implicit_pure_function (gfc_expr *e);
a8b3b0b6 3573
6de9cd9a
DN
3574
3575/* array.c */
b7e75771
JD
3576gfc_iterator *gfc_copy_iterator (gfc_iterator *);
3577
6de9cd9a
DN
3578void gfc_free_array_spec (gfc_array_spec *);
3579gfc_array_ref *gfc_copy_array_ref (gfc_array_ref *);
3580
524af0d6 3581bool gfc_set_array_spec (gfc_symbol *, gfc_array_spec *, locus *);
6de9cd9a 3582gfc_array_spec *gfc_copy_array_spec (gfc_array_spec *);
524af0d6 3583bool gfc_resolve_array_spec (gfc_array_spec *, int);
6de9cd9a
DN
3584
3585int gfc_compare_array_spec (gfc_array_spec *, gfc_array_spec *);
3586
6de9cd9a 3587void gfc_simplify_iterator_var (gfc_expr *);
524af0d6 3588bool gfc_expand_constructor (gfc_expr *, bool);
6de9cd9a
DN
3589int gfc_constant_ac (gfc_expr *);
3590int gfc_expanded_ac (gfc_expr *);
524af0d6
JB
3591bool gfc_resolve_character_array_constructor (gfc_expr *);
3592bool gfc_resolve_array_constructor (gfc_expr *);
3593bool gfc_check_constructor_type (gfc_expr *);
3594bool gfc_check_iter_variable (gfc_expr *);
3595bool gfc_check_constructor (gfc_expr *, bool (*)(gfc_expr *));
3596bool gfc_array_size (gfc_expr *, mpz_t *);
3597bool gfc_array_dimen_size (gfc_expr *, int, mpz_t *);
3598bool gfc_array_ref_shape (gfc_array_ref *, mpz_t *);
eb401400 3599gfc_array_ref *gfc_find_array_ref (gfc_expr *, bool a = false);
66e4ab31 3600tree gfc_conv_array_initializer (tree type, gfc_expr *);
524af0d6
JB
3601bool spec_size (gfc_array_spec *, mpz_t *);
3602bool spec_dimen_size (gfc_array_spec *, int, mpz_t *);
7a28353e 3603bool gfc_is_compile_time_shape (gfc_array_spec *);
6de9cd9a 3604
524af0d6 3605bool gfc_ref_dimen_size (gfc_array_ref *, int dimen, mpz_t *, mpz_t *);
543af7ab 3606
6de9cd9a
DN
3607/* interface.c -- FIXME: some of these should be in symbol.c */
3608void gfc_free_interface (gfc_interface *);
f3e1097b
JW
3609bool gfc_compare_derived_types (gfc_symbol *, gfc_symbol *);
3610bool gfc_compare_types (gfc_typespec *, gfc_typespec *);
4668d6f9
PT
3611bool gfc_check_dummy_characteristics (gfc_symbol *, gfc_symbol *,
3612 bool, char *, int);
3613bool gfc_check_result_characteristics (gfc_symbol *, gfc_symbol *,
3614 char *, int);
f3e1097b 3615bool gfc_compare_interfaces (gfc_symbol*, gfc_symbol*, const char *, int, int,
2298af08
TK
3616 char *, int, const char *, const char *,
3617 bool *bad_result_characteristics = NULL);
6de9cd9a 3618void gfc_check_interfaces (gfc_namespace *);
524af0d6 3619bool gfc_procedure_use (gfc_symbol *, gfc_actual_arglist **, locus *);
7e196f89 3620void gfc_ppc_use (gfc_component *, gfc_actual_arglist **, locus *);
6de9cd9a
DN
3621gfc_symbol *gfc_search_interface (gfc_interface *, int,
3622 gfc_actual_arglist **);
eaee02a5 3623match gfc_extend_expr (gfc_expr *);
6de9cd9a 3624void gfc_free_formal_arglist (gfc_formal_arglist *);
524af0d6
JB
3625bool gfc_extend_assign (gfc_code *, gfc_namespace *);
3626bool gfc_check_new_interface (gfc_interface *, gfc_symbol *, locus);
3627bool gfc_add_interface (gfc_symbol *);
2b77e908
FXC
3628gfc_interface *gfc_current_interface_head (void);
3629void gfc_set_current_interface_head (gfc_interface *);
f6fad28e 3630gfc_symtree* gfc_find_sym_in_symtree (gfc_symbol*);
f0ac18b7 3631bool gfc_arglist_matches_symbol (gfc_actual_arglist**, gfc_symbol*);
94747289 3632bool gfc_check_operator_interface (gfc_symbol*, gfc_intrinsic_op, locus);
f3e1097b 3633bool gfc_has_vector_subscript (gfc_expr*);
fb03a37e 3634gfc_intrinsic_op gfc_equivalent_op (gfc_intrinsic_op);
524af0d6 3635bool gfc_check_typebound_override (gfc_symtree*, gfc_symtree*);
e73d3ca6 3636void gfc_check_dtio_interfaces (gfc_symbol*);
e4e659b9 3637gfc_symtree* gfc_find_typebound_dtio_proc (gfc_symbol *, bool, bool);
e73d3ca6 3638gfc_symbol* gfc_find_specific_dtio_proc (gfc_symbol*, bool, bool);
e68a35ae
TK
3639void gfc_get_formal_from_actual_arglist (gfc_symbol *, gfc_actual_arglist *);
3640bool gfc_compare_actual_formal (gfc_actual_arglist **, gfc_formal_arglist *,
3641 int, int, bool, locus *);
e73d3ca6 3642
6de9cd9a
DN
3643
3644/* io.c */
3645extern gfc_st_label format_asterisk;
3646
3647void gfc_free_open (gfc_open *);
44facdb7 3648bool gfc_resolve_open (gfc_open *, locus *);
6de9cd9a 3649void gfc_free_close (gfc_close *);
44facdb7 3650bool gfc_resolve_close (gfc_close *, locus *);
6de9cd9a 3651void gfc_free_filepos (gfc_filepos *);
3d07fb21 3652bool gfc_resolve_filepos (gfc_filepos *, locus *);
6de9cd9a 3653void gfc_free_inquire (gfc_inquire *);
524af0d6 3654bool gfc_resolve_inquire (gfc_inquire *);
6de9cd9a 3655void gfc_free_dt (gfc_dt *);
44facdb7 3656bool gfc_resolve_dt (gfc_code *, gfc_dt *, locus *);
6f0f0b2e 3657void gfc_free_wait (gfc_wait *);
524af0d6 3658bool gfc_resolve_wait (gfc_wait *);
6de9cd9a
DN
3659
3660/* module.c */
3661void gfc_module_init_2 (void);
3662void gfc_module_done_2 (void);
3663void gfc_dump_module (const char *, int);
6e2062b0 3664bool gfc_check_symbol_access (gfc_symbol *);
a64f5186 3665void gfc_free_use_stmts (gfc_use_list *);
f6288c24
FR
3666const char *gfc_dt_lower_string (const char *);
3667const char *gfc_dt_upper_string (const char *);
6de9cd9a
DN
3668
3669/* primary.c */
3670symbol_attribute gfc_variable_attr (gfc_expr *, gfc_typespec *);
3671symbol_attribute gfc_expr_attr (gfc_expr *);
ba85c8c3 3672symbol_attribute gfc_caf_attr (gfc_expr *, bool i = false, bool *r = NULL);
eb77cddf 3673match gfc_match_rvalue (gfc_expr **);
713485cc 3674match gfc_match_varspec (gfc_expr*, int, bool, bool);
8fc541d3 3675int gfc_check_digit (char, int);
2d71b918 3676bool gfc_is_function_return_value (gfc_symbol *, gfc_namespace *);
524af0d6 3677bool gfc_convert_to_structure_constructor (gfc_expr *, gfc_symbol *,
c3f34952
TB
3678 gfc_expr **,
3679 gfc_actual_arglist **, bool);
6de9cd9a
DN
3680
3681/* trans.c */
3682void gfc_generate_code (gfc_namespace *);
3683void gfc_generate_module_code (gfc_namespace *);
3684
9645e798
MM
3685/* trans-intrinsic.c */
3686bool gfc_inline_intrinsic_function_p (gfc_expr *);
3687
6de9cd9a
DN
3688/* bbt.c */
3689typedef int (*compare_fn) (void *, void *);
3690void gfc_insert_bbt (void *, void *, compare_fn);
3691void gfc_delete_bbt (void *, void *, compare_fn);
3692
3693/* dump-parse-tree.c */
6c1abb5c 3694void gfc_dump_parse_tree (gfc_namespace *, FILE *);
e655a6cc 3695void gfc_dump_c_prototypes (gfc_namespace *, FILE *);
6328ce1f 3696void gfc_dump_external_c_prototypes (FILE *);
5c6aa9a8 3697void gfc_dump_global_symbols (FILE *);
fb078366
TK
3698void debug (gfc_symbol *);
3699void debug (gfc_expr *);
6de9cd9a
DN
3700
3701/* parse.c */
524af0d6 3702bool gfc_parse_file (void);
ca39e6f2 3703void gfc_global_used (gfc_gsymbol *, locus *);
3e78238a 3704gfc_namespace* gfc_build_block_ns (gfc_namespace *);
6de9cd9a 3705
2990f854 3706/* dependency.c */
2757d5ec 3707int gfc_dep_compare_functions (gfc_expr *, gfc_expr *, bool);
2990f854 3708int gfc_dep_compare_expr (gfc_expr *, gfc_expr *);
eab19a1a 3709bool gfc_dep_difference (gfc_expr *, gfc_expr *, mpz_t *);
2990f854 3710
fb5bc08b 3711/* check.c */
524af0d6
JB
3712bool gfc_check_same_strlen (const gfc_expr*, const gfc_expr*, const char*);
3713bool gfc_calculate_transfer_sizes (gfc_expr*, gfc_expr*, gfc_expr*,
86dbed7d 3714 size_t*, size_t*, size_t*);
8dc63166
SK
3715bool gfc_boz2int (gfc_expr *, int);
3716bool gfc_boz2real (gfc_expr *, int);
3717bool gfc_invalid_boz (const char *, locus *);
7fd614ee 3718bool gfc_invalid_null_arg (gfc_expr *);
8dc63166 3719
fb5bc08b 3720
d15bac21 3721/* class.c */
37da591f 3722void gfc_fix_class_refs (gfc_expr *e);
d15bac21 3723void gfc_add_component_ref (gfc_expr *, const char *);
c49ea23d 3724void gfc_add_class_array_ref (gfc_expr *);
b04533af
JW
3725#define gfc_add_data_component(e) gfc_add_component_ref(e,"_data")
3726#define gfc_add_vptr_component(e) gfc_add_component_ref(e,"_vptr")
34d9d749 3727#define gfc_add_len_component(e) gfc_add_component_ref(e,"_len")
b04533af
JW
3728#define gfc_add_hash_component(e) gfc_add_component_ref(e,"_hash")
3729#define gfc_add_size_component(e) gfc_add_component_ref(e,"_size")
3730#define gfc_add_def_init_component(e) gfc_add_component_ref(e,"_def_init")
86035eec 3731#define gfc_add_final_component(e) gfc_add_component_ref(e,"_final")
c49ea23d
PT
3732bool gfc_is_class_array_ref (gfc_expr *, bool *);
3733bool gfc_is_class_scalar_expr (gfc_expr *);
5bf5fa56 3734bool gfc_is_class_container_ref (gfc_expr *e);
2cc6320d 3735gfc_expr *gfc_class_initializer (gfc_typespec *, gfc_expr *);
4fa02692 3736unsigned int gfc_hash_value (gfc_symbol *);
9e6644c6 3737gfc_expr *gfc_get_len_component (gfc_expr *e, int);
524af0d6 3738bool gfc_build_class_symbol (gfc_typespec *, symbol_attribute *,
9b6da3c7 3739 gfc_array_spec **);
88ce8031 3740gfc_symbol *gfc_find_derived_vtab (gfc_symbol *);
7289d1c9 3741gfc_symbol *gfc_find_vtab (gfc_typespec *);
524af0d6 3742gfc_symtree* gfc_find_typebound_proc (gfc_symbol*, bool*,
d15bac21 3743 const char*, bool, locus*);
524af0d6 3744gfc_symtree* gfc_find_typebound_user_op (gfc_symbol*, bool*,
d15bac21 3745 const char*, bool, locus*);
524af0d6 3746gfc_typebound_proc* gfc_find_typebound_intrinsic_op (gfc_symbol*, bool*,
d15bac21
JW
3747 gfc_intrinsic_op, bool,
3748 locus*);
3749gfc_symtree* gfc_get_tbp_symtree (gfc_symtree**, const char*);
86035eec 3750bool gfc_is_finalizable (gfc_symbol *, gfc_expr **);
d15bac21 3751
7a08eda1 3752#define CLASS_DATA(sym) sym->ts.u.derived->components
8b704316
PT
3753#define UNLIMITED_POLY(sym) \
3754 (sym != NULL && sym->ts.type == BT_CLASS \
3755 && CLASS_DATA (sym) \
3756 && CLASS_DATA (sym)->ts.u.derived \
3757 && CLASS_DATA (sym)->ts.u.derived->attr.unlimited_polymorphic)
f3b0bb7a
AV
3758#define IS_CLASS_ARRAY(sym) \
3759 (sym->ts.type == BT_CLASS \
3760 && CLASS_DATA (sym) \
3761 && CLASS_DATA (sym)->attr.dimension \
3762 && !CLASS_DATA (sym)->attr.class_pointer)
7a08eda1 3763
601d98be
TK
3764/* frontend-passes.c */
3765
3766void gfc_run_passes (gfc_namespace *);
3767
4d42b5cd
JJ
3768typedef int (*walk_code_fn_t) (gfc_code **, int *, void *);
3769typedef int (*walk_expr_fn_t) (gfc_expr **, int *, void *);
3770
5f23671d 3771int gfc_dummy_code_callback (gfc_code **, int *, void *);
4d42b5cd
JJ
3772int gfc_expr_walker (gfc_expr **, walk_expr_fn_t, void *);
3773int gfc_code_walker (gfc_code **, walk_code_fn_t, walk_expr_fn_t, void *);
1585b483 3774bool gfc_has_dimen_vector_ref (gfc_expr *e);
fb078366 3775void gfc_check_externals (gfc_namespace *);
3055d879 3776bool gfc_fix_implicit_pure (gfc_namespace *);
4d42b5cd 3777
d01b2c21
TK
3778/* simplify.c */
3779
3780void gfc_convert_mpz_to_signed (mpz_t, int);
0e360db9 3781gfc_expr *gfc_simplify_ieee_functions (gfc_expr *);
5867bb9a 3782bool gfc_is_size_zero_array (gfc_expr *);
d01b2c21 3783
f1abbf69
TK
3784/* trans-array.c */
3785
3786bool gfc_is_reallocatable_lhs (gfc_expr *);
3787
dc7a8b4b
JN
3788/* trans-decl.c */
3789
3790void finish_oacc_declare (gfc_namespace *, gfc_symbol *, bool);
facf0354 3791void gfc_adjust_builtins (void);
dc7a8b4b 3792
53814b8f 3793#endif /* GCC_GFORTRAN_H */