Branch data Line data Source code
1 : : /* Build up a list of intrinsic subroutines and functions for the
2 : : name-resolution stage.
3 : : Copyright (C) 2000-2025 Free Software Foundation, Inc.
4 : : Contributed by Andy Vaught & Katherine Holcomb
5 : :
6 : : This file is part of GCC.
7 : :
8 : : GCC is free software; you can redistribute it and/or modify it under
9 : : the terms of the GNU General Public License as published by the Free
10 : : Software Foundation; either version 3, or (at your option) any later
11 : : version.
12 : :
13 : : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 : : WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 : : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 : : for more details.
17 : :
18 : : You should have received a copy of the GNU General Public License
19 : : along with GCC; see the file COPYING3. If not see
20 : : <http://www.gnu.org/licenses/>. */
21 : :
22 : : #include "config.h"
23 : : #include "system.h"
24 : : #include "coretypes.h"
25 : : #include "options.h"
26 : : #include "gfortran.h"
27 : : #include "intrinsic.h"
28 : : #include "diagnostic.h" /* For errorcount. */
29 : :
30 : : /* Namespace to hold the resolved symbols for intrinsic subroutines. */
31 : : static gfc_namespace *gfc_intrinsic_namespace;
32 : :
33 : : bool gfc_init_expr_flag = false;
34 : :
35 : : /* Pointers to an intrinsic function and its argument names that are being
36 : : checked. */
37 : :
38 : : const char *gfc_current_intrinsic;
39 : : gfc_intrinsic_arg *gfc_current_intrinsic_arg[MAX_INTRINSIC_ARGS];
40 : : locus *gfc_current_intrinsic_where;
41 : :
42 : : static gfc_intrinsic_sym *functions, *subroutines, *conversion, *next_sym;
43 : : static gfc_intrinsic_sym *char_conversions;
44 : : static gfc_intrinsic_arg *next_arg;
45 : :
46 : : static int nfunc, nsub, nargs, nconv, ncharconv;
47 : :
48 : : static enum
49 : : { SZ_NOTHING = 0, SZ_SUBS, SZ_FUNCS, SZ_CONVS }
50 : : sizing;
51 : :
52 : : enum klass
53 : : { CLASS_IMPURE = 0, CLASS_PURE, CLASS_ELEMENTAL,
54 : : CLASS_INQUIRY, CLASS_TRANSFORMATIONAL, CLASS_ATOMIC };
55 : :
56 : : #define ACTUAL_NO 0
57 : : #define ACTUAL_YES 1
58 : :
59 : : #define REQUIRED 0
60 : : #define OPTIONAL 1
61 : :
62 : :
63 : : /* Return a letter based on the passed type. Used to construct the
64 : : name of a type-dependent subroutine. If logical_equals_int is
65 : : true, we can treat a logical like an int. */
66 : :
67 : : char
68 : 15307736 : gfc_type_letter (bt type, bool logical_equals_int)
69 : : {
70 : 15307736 : char c;
71 : :
72 : 15307736 : switch (type)
73 : : {
74 : 2883122 : case BT_LOGICAL:
75 : 2883122 : if (logical_equals_int)
76 : : c = 'i';
77 : : else
78 : 15307736 : c = 'l';
79 : :
80 : : break;
81 : : case BT_CHARACTER:
82 : : c = 's';
83 : : break;
84 : : case BT_INTEGER:
85 : 5493851 : c = 'i';
86 : : break;
87 : 3135252 : case BT_REAL:
88 : 3135252 : c = 'r';
89 : 3135252 : break;
90 : 3058582 : case BT_COMPLEX:
91 : 3058582 : c = 'c';
92 : 3058582 : break;
93 : :
94 : 565253 : case BT_HOLLERITH:
95 : 565253 : c = 'h';
96 : 565253 : break;
97 : :
98 : : /* 'u' would be the logical choice, but it is used for
99 : : "unknown", let's use m for "modulo". */
100 : 11068 : case BT_UNSIGNED:
101 : 11068 : c = 'm';
102 : 11068 : break;
103 : :
104 : 45 : default:
105 : 45 : c = 'u';
106 : 45 : break;
107 : : }
108 : :
109 : 15307736 : return c;
110 : : }
111 : :
112 : :
113 : : /* Return kind that should be used for ABI purposes in libgfortran
114 : : APIs. Usually the same as ts->kind, except for BT_REAL/BT_COMPLEX
115 : : for IEEE 754 quad format kind 16 where it returns 17. */
116 : :
117 : : int
118 : 16083465 : gfc_type_abi_kind (bt type, int kind)
119 : : {
120 : 16083465 : switch (type)
121 : : {
122 : 6931293 : case BT_REAL:
123 : 6931293 : case BT_COMPLEX:
124 : 6931293 : if (kind == 16)
125 : 6815684 : for (int i = 0; gfc_real_kinds[i].kind != 0; i++)
126 : 6815684 : if (gfc_real_kinds[i].kind == kind)
127 : 1703921 : return gfc_real_kinds[i].abi_kind;
128 : : return kind;
129 : : default:
130 : : return kind;
131 : : }
132 : : }
133 : :
134 : : /* Get a symbol for a resolved name. Note, if needed be, the elemental
135 : : attribute has be added afterwards. */
136 : :
137 : : gfc_symbol *
138 : 3972 : gfc_get_intrinsic_sub_symbol (const char *name)
139 : : {
140 : 3972 : gfc_symbol *sym = NULL;
141 : :
142 : 3972 : gfc_get_symbol (name, gfc_intrinsic_namespace, &sym);
143 : 3972 : sym->attr.always_explicit = 1;
144 : 3972 : sym->attr.subroutine = 1;
145 : 3972 : sym->attr.flavor = FL_PROCEDURE;
146 : 3972 : sym->attr.proc = PROC_INTRINSIC;
147 : :
148 : 3972 : gfc_commit_symbol (sym);
149 : :
150 : 3972 : return sym;
151 : : }
152 : :
153 : : /* Get a symbol for a resolved function, with its special name. The
154 : : actual argument list needs to be set by the caller. */
155 : :
156 : : gfc_symbol *
157 : 1567 : gfc_get_intrinsic_function_symbol (gfc_expr *expr)
158 : : {
159 : 1567 : gfc_symbol *sym;
160 : :
161 : 1567 : gfc_get_symbol (expr->value.function.name, gfc_intrinsic_namespace, &sym);
162 : 1567 : sym->attr.external = 1;
163 : 1567 : sym->attr.function = 1;
164 : 1567 : sym->attr.always_explicit = 1;
165 : 1567 : sym->attr.proc = PROC_INTRINSIC;
166 : 1567 : sym->attr.flavor = FL_PROCEDURE;
167 : 1567 : sym->result = sym;
168 : 1567 : if (expr->rank > 0)
169 : : {
170 : 1401 : sym->attr.dimension = 1;
171 : 1401 : sym->as = gfc_get_array_spec ();
172 : 1401 : sym->as->type = AS_ASSUMED_SHAPE;
173 : 1401 : sym->as->rank = expr->rank;
174 : 1401 : sym->as->corank = expr->corank;
175 : : }
176 : 1567 : return sym;
177 : : }
178 : :
179 : : /* Find a symbol for a resolved intrinsic procedure, return NULL if
180 : : not found. */
181 : :
182 : : gfc_symbol *
183 : 6999 : gfc_find_intrinsic_symbol (gfc_expr *expr)
184 : : {
185 : 6999 : gfc_symbol *sym;
186 : 6999 : gfc_find_symbol (expr->value.function.name, gfc_intrinsic_namespace,
187 : : 0, &sym);
188 : 6999 : return sym;
189 : : }
190 : :
191 : :
192 : : /* Return a pointer to the name of a conversion function given two
193 : : typespecs. */
194 : :
195 : : static const char *
196 : 7580037 : conv_name (gfc_typespec *from, gfc_typespec *to)
197 : : {
198 : 22740111 : return gfc_get_string ("__convert_%c%d_%c%d",
199 : 7580037 : gfc_type_letter (from->type), gfc_type_abi_kind (from),
200 : 7580037 : gfc_type_letter (to->type), gfc_type_abi_kind (to));
201 : : }
202 : :
203 : :
204 : : /* Given a pair of typespecs, find the gfc_intrinsic_sym node that
205 : : corresponds to the conversion. Returns NULL if the conversion
206 : : isn't found. */
207 : :
208 : : static gfc_intrinsic_sym *
209 : 122465 : find_conv (gfc_typespec *from, gfc_typespec *to)
210 : : {
211 : 122465 : gfc_intrinsic_sym *sym;
212 : 122465 : const char *target;
213 : 122465 : int i;
214 : :
215 : 122465 : target = conv_name (from, to);
216 : 122465 : sym = conversion;
217 : :
218 : 4755115 : for (i = 0; i < nconv; i++, sym++)
219 : 4755033 : if (target == sym->name)
220 : : return sym;
221 : :
222 : : return NULL;
223 : : }
224 : :
225 : :
226 : : /* Given a pair of CHARACTER typespecs, find the gfc_intrinsic_sym node
227 : : that corresponds to the conversion. Returns NULL if the conversion
228 : : isn't found. */
229 : :
230 : : static gfc_intrinsic_sym *
231 : 379 : find_char_conv (gfc_typespec *from, gfc_typespec *to)
232 : : {
233 : 379 : gfc_intrinsic_sym *sym;
234 : 379 : const char *target;
235 : 379 : int i;
236 : :
237 : 379 : target = conv_name (from, to);
238 : 379 : sym = char_conversions;
239 : :
240 : 479 : for (i = 0; i < ncharconv; i++, sym++)
241 : 476 : if (target == sym->name)
242 : : return sym;
243 : :
244 : : return NULL;
245 : : }
246 : :
247 : :
248 : : /* Check TS29113, C407b for assumed type and C535b for assumed-rank,
249 : : and a likewise check for NO_ARG_CHECK. */
250 : :
251 : : static bool
252 : 301743 : do_ts29113_check (gfc_intrinsic_sym *specific, gfc_actual_arglist *arg)
253 : : {
254 : 301743 : gfc_actual_arglist *a;
255 : 301743 : bool ok = true;
256 : :
257 : 905715 : for (a = arg; a; a = a->next)
258 : : {
259 : 603972 : if (!a->expr)
260 : 190530 : continue;
261 : :
262 : 413442 : if (a->expr->expr_type == EXPR_VARIABLE
263 : 174090 : && (a->expr->symtree->n.sym->attr.ext_attr
264 : : & (1 << EXT_ATTR_NO_ARG_CHECK))
265 : 25 : && specific->id != GFC_ISYM_C_LOC
266 : 10 : && specific->id != GFC_ISYM_PRESENT)
267 : : {
268 : 3 : gfc_error ("Variable with NO_ARG_CHECK attribute at %L is only "
269 : : "permitted as argument to the intrinsic functions "
270 : : "C_LOC and PRESENT", &a->expr->where);
271 : 3 : ok = false;
272 : : }
273 : 413439 : else if (a->expr->ts.type == BT_ASSUMED
274 : 380 : && specific->id != GFC_ISYM_LBOUND
275 : : && specific->id != GFC_ISYM_PRESENT
276 : : && specific->id != GFC_ISYM_RANK
277 : : && specific->id != GFC_ISYM_SHAPE
278 : : && specific->id != GFC_ISYM_SIZE
279 : : && specific->id != GFC_ISYM_SIZEOF
280 : : && specific->id != GFC_ISYM_UBOUND
281 : : && specific->id != GFC_ISYM_IS_CONTIGUOUS
282 : : && specific->id != GFC_ISYM_C_LOC)
283 : : {
284 : 13 : gfc_error ("Assumed-type argument at %L is not permitted as actual"
285 : : " argument to the intrinsic %s", &a->expr->where,
286 : : gfc_current_intrinsic);
287 : 13 : ok = false;
288 : : }
289 : 413426 : else if (a->expr->ts.type == BT_ASSUMED && a != arg)
290 : : {
291 : 2 : gfc_error ("Assumed-type argument at %L is only permitted as "
292 : : "first actual argument to the intrinsic %s",
293 : : &a->expr->where, gfc_current_intrinsic);
294 : 2 : ok = false;
295 : : }
296 : 413424 : else if (a->expr->rank == -1
297 : 6146 : && !(specific->inquiry
298 : 59 : || (specific->id == GFC_ISYM_RESHAPE
299 : 8 : && (gfc_option.allow_std & GFC_STD_F202Y))))
300 : : {
301 : 53 : gfc_error ("Assumed-rank argument at %L is only permitted as actual "
302 : : "argument to intrinsic inquiry functions or to RESHAPE. "
303 : : "The latter is an experimental F202y feature. Use "
304 : : "-std=f202y to enable", &a->expr->where);
305 : 53 : ok = false;
306 : : }
307 : 413371 : else if (a->expr->rank == -1 && arg != a)
308 : : {
309 : 3 : gfc_error ("Assumed-rank argument at %L is only permitted as first "
310 : : "actual argument to the intrinsic inquiry function %s",
311 : : &a->expr->where, gfc_current_intrinsic);
312 : 3 : ok = false;
313 : : }
314 : 6090 : else if (a->expr->rank == -1 && specific->id == GFC_ISYM_RESHAPE
315 : 413374 : && !gfc_is_simply_contiguous (a->expr, true, false))
316 : : {
317 : 0 : gfc_error ("Assumed rank argument to the RESHAPE intrinsic at %L "
318 : 0 : "must be contiguous", &a->expr->where);
319 : 0 : ok = false;
320 : : }
321 : : }
322 : :
323 : 301743 : return ok;
324 : : }
325 : :
326 : :
327 : : /* Interface to the check functions. We break apart an argument list
328 : : and call the proper check function rather than forcing each
329 : : function to manipulate the argument list. */
330 : :
331 : : static bool
332 : 248312 : do_check (gfc_intrinsic_sym *specific, gfc_actual_arglist *arg)
333 : : {
334 : 248312 : gfc_expr *a1, *a2, *a3, *a4, *a5, *a6;
335 : :
336 : 248312 : if (arg == NULL)
337 : 0 : return (*specific->check.f0) ();
338 : :
339 : 248312 : a1 = arg->expr;
340 : 248312 : arg = arg->next;
341 : 248312 : if (arg == NULL)
342 : 75367 : return (*specific->check.f1) (a1);
343 : :
344 : 172945 : a2 = arg->expr;
345 : 172945 : arg = arg->next;
346 : 172945 : if (arg == NULL)
347 : 118736 : return (*specific->check.f2) (a1, a2);
348 : :
349 : 54209 : a3 = arg->expr;
350 : 54209 : arg = arg->next;
351 : 54209 : if (arg == NULL)
352 : 42094 : return (*specific->check.f3) (a1, a2, a3);
353 : :
354 : 12115 : a4 = arg->expr;
355 : 12115 : arg = arg->next;
356 : 12115 : if (arg == NULL)
357 : 11575 : return (*specific->check.f4) (a1, a2, a3, a4);
358 : :
359 : 540 : a5 = arg->expr;
360 : 540 : arg = arg->next;
361 : 540 : if (arg == NULL)
362 : 289 : return (*specific->check.f5) (a1, a2, a3, a4, a5);
363 : :
364 : 251 : a6 = arg->expr;
365 : 251 : arg = arg->next;
366 : 251 : if (arg == NULL)
367 : 251 : return (*specific->check.f6) (a1, a2, a3, a4, a5, a6);
368 : :
369 : 0 : gfc_internal_error ("do_check(): too many args");
370 : : }
371 : :
372 : :
373 : : /*********** Subroutines to build the intrinsic list ****************/
374 : :
375 : : /* Add a single intrinsic symbol to the current list.
376 : :
377 : : Argument list:
378 : : char * name of function
379 : : int whether function is elemental
380 : : int If the function can be used as an actual argument [1]
381 : : bt return type of function
382 : : int kind of return type of function
383 : : int Fortran standard version
384 : : check pointer to check function
385 : : simplify pointer to simplification function
386 : : resolve pointer to resolution function
387 : :
388 : : Optional arguments come in multiples of five:
389 : : char * name of argument
390 : : bt type of argument
391 : : int kind of argument
392 : : int arg optional flag (1=optional, 0=required)
393 : : sym_intent intent of argument
394 : :
395 : : The sequence is terminated by a NULL name.
396 : :
397 : :
398 : : [1] Whether a function can or cannot be used as an actual argument is
399 : : determined by its presence on the 13.6 list in Fortran 2003. The
400 : : following intrinsics, which are GNU extensions, are considered allowed
401 : : as actual arguments: ACOSH ATANH DACOSH DASINH DATANH DCONJG DIMAG
402 : : ZABS ZCOS ZEXP ZLOG ZSIN ZSQRT. */
403 : :
404 : : static void
405 : 25024968 : add_sym (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type, int kind,
406 : : int standard, gfc_check_f check, gfc_simplify_f simplify,
407 : : gfc_resolve_f resolve, ...)
408 : : {
409 : 25024968 : char buf[GFC_MAX_SYMBOL_LEN + 11]; /* 10 for '_gfortran_', 1 for '\0' */
410 : 25024968 : int optional, first_flag;
411 : 25024968 : sym_intent intent;
412 : 25024968 : va_list argp;
413 : :
414 : 25024968 : switch (sizing)
415 : : {
416 : 2374632 : case SZ_SUBS:
417 : 2374632 : nsub++;
418 : 2374632 : break;
419 : :
420 : 10137852 : case SZ_FUNCS:
421 : 10137852 : nfunc++;
422 : 10137852 : break;
423 : :
424 : 12512484 : case SZ_NOTHING:
425 : 12512484 : next_sym->name = gfc_get_string ("%s", name);
426 : :
427 : 12512484 : strcpy (buf, "_gfortran_");
428 : 12512484 : strcat (buf, name);
429 : 12512484 : next_sym->lib_name = gfc_get_string ("%s", buf);
430 : :
431 : 12512484 : next_sym->pure = (cl != CLASS_IMPURE);
432 : 12512484 : next_sym->elemental = (cl == CLASS_ELEMENTAL);
433 : 12512484 : next_sym->inquiry = (cl == CLASS_INQUIRY);
434 : 12512484 : next_sym->transformational = (cl == CLASS_TRANSFORMATIONAL);
435 : 12512484 : next_sym->actual_ok = actual_ok;
436 : 12512484 : next_sym->ts.type = type;
437 : 12512484 : next_sym->ts.kind = kind;
438 : 12512484 : next_sym->standard = standard;
439 : 12512484 : next_sym->simplify = simplify;
440 : 12512484 : next_sym->check = check;
441 : 12512484 : next_sym->resolve = resolve;
442 : 12512484 : next_sym->specific = 0;
443 : 12512484 : next_sym->generic = 0;
444 : 12512484 : next_sym->conversion = 0;
445 : 12512484 : next_sym->id = id;
446 : 12512484 : break;
447 : :
448 : 0 : default:
449 : 0 : gfc_internal_error ("add_sym(): Bad sizing mode");
450 : : }
451 : :
452 : 25024968 : va_start (argp, resolve);
453 : :
454 : 25024968 : first_flag = 1;
455 : :
456 : 69046992 : for (;;)
457 : : {
458 : 69046992 : name = va_arg (argp, char *);
459 : 69046992 : if (name == NULL)
460 : : break;
461 : :
462 : 44022024 : type = (bt) va_arg (argp, int);
463 : 44022024 : kind = va_arg (argp, int);
464 : 44022024 : optional = va_arg (argp, int);
465 : 44022024 : intent = (sym_intent) va_arg (argp, int);
466 : :
467 : 44022024 : if (sizing != SZ_NOTHING)
468 : 22011012 : nargs++;
469 : : else
470 : : {
471 : 22011012 : next_arg++;
472 : :
473 : 22011012 : if (first_flag)
474 : 12025380 : next_sym->formal = next_arg;
475 : : else
476 : 9985632 : (next_arg - 1)->next = next_arg;
477 : :
478 : 22011012 : first_flag = 0;
479 : :
480 : 22011012 : strcpy (next_arg->name, name);
481 : 22011012 : next_arg->ts.type = type;
482 : 22011012 : next_arg->ts.kind = kind;
483 : 22011012 : next_arg->optional = optional;
484 : 22011012 : next_arg->value = 0;
485 : 22011012 : next_arg->intent = intent;
486 : : }
487 : : }
488 : :
489 : 25024968 : va_end (argp);
490 : :
491 : 25024968 : next_sym++;
492 : 25024968 : }
493 : :
494 : :
495 : : /* Add a symbol to the function list where the function takes
496 : : 0 arguments. */
497 : :
498 : : static void
499 : 852432 : add_sym_0 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
500 : : int kind, int standard,
501 : : bool (*check) (void),
502 : : gfc_expr *(*simplify) (void),
503 : : void (*resolve) (gfc_expr *))
504 : : {
505 : 852432 : gfc_simplify_f sf;
506 : 852432 : gfc_check_f cf;
507 : 852432 : gfc_resolve_f rf;
508 : :
509 : 852432 : cf.f0 = check;
510 : 852432 : sf.f0 = simplify;
511 : 852432 : rf.f0 = resolve;
512 : :
513 : 852432 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
514 : : (void *) 0);
515 : 852432 : }
516 : :
517 : :
518 : : /* Add a symbol to the subroutine list where the subroutine takes
519 : : 0 arguments. */
520 : :
521 : : static void
522 : 121776 : add_sym_0s (const char *name, gfc_isym_id id, int standard,
523 : : void (*resolve) (gfc_code *))
524 : : {
525 : 121776 : gfc_check_f cf;
526 : 121776 : gfc_simplify_f sf;
527 : 121776 : gfc_resolve_f rf;
528 : :
529 : 121776 : cf.f1 = NULL;
530 : 121776 : sf.f1 = NULL;
531 : 121776 : rf.s1 = resolve;
532 : :
533 : 121776 : add_sym (name, id, CLASS_IMPURE, ACTUAL_NO, BT_UNKNOWN, 0, standard, cf, sf,
534 : : rf, (void *) 0);
535 : 121776 : }
536 : :
537 : :
538 : : /* Add a symbol to the function list where the function takes
539 : : 1 arguments. */
540 : :
541 : : static void
542 : 9985632 : add_sym_1 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
543 : : int kind, int standard,
544 : : bool (*check) (gfc_expr *),
545 : : gfc_expr *(*simplify) (gfc_expr *),
546 : : void (*resolve) (gfc_expr *, gfc_expr *),
547 : : const char *a1, bt type1, int kind1, int optional1)
548 : : {
549 : 9985632 : gfc_check_f cf;
550 : 9985632 : gfc_simplify_f sf;
551 : 9985632 : gfc_resolve_f rf;
552 : :
553 : 9985632 : cf.f1 = check;
554 : 9985632 : sf.f1 = simplify;
555 : 9985632 : rf.f1 = resolve;
556 : :
557 : 9985632 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
558 : : a1, type1, kind1, optional1, INTENT_IN,
559 : : (void *) 0);
560 : 9985632 : }
561 : :
562 : :
563 : : /* Add a symbol to the function list where the function takes
564 : : 1 arguments, specifying the intent of the argument. */
565 : :
566 : : static void
567 : 182664 : add_sym_1_intent (const char *name, gfc_isym_id id, enum klass cl,
568 : : int actual_ok, bt type, int kind, int standard,
569 : : bool (*check) (gfc_expr *),
570 : : gfc_expr *(*simplify) (gfc_expr *),
571 : : void (*resolve) (gfc_expr *, gfc_expr *),
572 : : const char *a1, bt type1, int kind1, int optional1,
573 : : sym_intent intent1)
574 : : {
575 : 182664 : gfc_check_f cf;
576 : 182664 : gfc_simplify_f sf;
577 : 182664 : gfc_resolve_f rf;
578 : :
579 : 182664 : cf.f1 = check;
580 : 182664 : sf.f1 = simplify;
581 : 182664 : rf.f1 = resolve;
582 : :
583 : 182664 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
584 : : a1, type1, kind1, optional1, intent1,
585 : : (void *) 0);
586 : 182664 : }
587 : :
588 : :
589 : : /* Add a symbol to the subroutine list where the subroutine takes
590 : : 1 arguments, specifying the intent of the argument. */
591 : :
592 : : static void
593 : 852432 : add_sym_1s (const char *name, gfc_isym_id id, enum klass cl, bt type, int kind,
594 : : int standard, bool (*check) (gfc_expr *),
595 : : gfc_expr *(*simplify) (gfc_expr *), void (*resolve) (gfc_code *),
596 : : const char *a1, bt type1, int kind1, int optional1,
597 : : sym_intent intent1)
598 : : {
599 : 852432 : gfc_check_f cf;
600 : 852432 : gfc_simplify_f sf;
601 : 852432 : gfc_resolve_f rf;
602 : :
603 : 852432 : cf.f1 = check;
604 : 852432 : sf.f1 = simplify;
605 : 852432 : rf.s1 = resolve;
606 : :
607 : 852432 : add_sym (name, id, cl, ACTUAL_NO, type, kind, standard, cf, sf, rf,
608 : : a1, type1, kind1, optional1, intent1,
609 : : (void *) 0);
610 : 852432 : }
611 : :
612 : : /* Add a symbol to the subroutine ilst where the subroutine takes one
613 : : printf-style character argument and a variable number of arguments
614 : : to follow. */
615 : :
616 : : static void
617 : 60888 : add_sym_1p (const char *name, gfc_isym_id id, enum klass cl, bt type, int kind,
618 : : int standard, bool (*check) (gfc_actual_arglist *),
619 : : gfc_expr *(*simplify) (gfc_expr*), void (*resolve) (gfc_code *),
620 : : const char *a1, bt type1, int kind1, int optional1, sym_intent intent1)
621 : : {
622 : 60888 : gfc_check_f cf;
623 : 60888 : gfc_simplify_f sf;
624 : 60888 : gfc_resolve_f rf;
625 : :
626 : 60888 : cf.f1m = check;
627 : 60888 : sf.f1 = simplify;
628 : 60888 : rf.s1 = resolve;
629 : :
630 : 60888 : add_sym (name, id, cl, ACTUAL_NO, type, kind, standard, cf, sf, rf,
631 : : a1, type1, kind1, optional1, intent1,
632 : : (void *) 0);
633 : 60888 : }
634 : :
635 : :
636 : : /* Add a symbol from the MAX/MIN family of intrinsic functions to the
637 : : function. MAX et al take 2 or more arguments. */
638 : :
639 : : static void
640 : 730656 : add_sym_1m (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
641 : : int kind, int standard,
642 : : bool (*check) (gfc_actual_arglist *),
643 : : gfc_expr *(*simplify) (gfc_expr *),
644 : : void (*resolve) (gfc_expr *, gfc_actual_arglist *),
645 : : const char *a1, bt type1, int kind1, int optional1,
646 : : const char *a2, bt type2, int kind2, int optional2)
647 : : {
648 : 730656 : gfc_check_f cf;
649 : 730656 : gfc_simplify_f sf;
650 : 730656 : gfc_resolve_f rf;
651 : :
652 : 730656 : cf.f1m = check;
653 : 730656 : sf.f1 = simplify;
654 : 730656 : rf.f1m = resolve;
655 : :
656 : 730656 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
657 : : a1, type1, kind1, optional1, INTENT_IN,
658 : : a2, type2, kind2, optional2, INTENT_IN,
659 : : (void *) 0);
660 : 730656 : }
661 : :
662 : :
663 : : /* Add a symbol to the function list where the function takes
664 : : 2 arguments. */
665 : :
666 : : static void
667 : 5845248 : add_sym_2 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
668 : : int kind, int standard,
669 : : bool (*check) (gfc_expr *, gfc_expr *),
670 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *),
671 : : void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *),
672 : : const char *a1, bt type1, int kind1, int optional1,
673 : : const char *a2, bt type2, int kind2, int optional2)
674 : : {
675 : 5845248 : gfc_check_f cf;
676 : 5845248 : gfc_simplify_f sf;
677 : 5845248 : gfc_resolve_f rf;
678 : :
679 : 5845248 : cf.f2 = check;
680 : 5845248 : sf.f2 = simplify;
681 : 5845248 : rf.f2 = resolve;
682 : :
683 : 5845248 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
684 : : a1, type1, kind1, optional1, INTENT_IN,
685 : : a2, type2, kind2, optional2, INTENT_IN,
686 : : (void *) 0);
687 : 5845248 : }
688 : :
689 : :
690 : : /* Add a symbol to the function list where the function takes
691 : : 2 arguments; same as add_sym_2 - but allows to specify the intent. */
692 : :
693 : : static void
694 : 243552 : add_sym_2_intent (const char *name, gfc_isym_id id, enum klass cl,
695 : : int actual_ok, bt type, int kind, int standard,
696 : : bool (*check) (gfc_expr *, gfc_expr *),
697 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *),
698 : : void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *),
699 : : const char *a1, bt type1, int kind1, int optional1,
700 : : sym_intent intent1, const char *a2, bt type2, int kind2,
701 : : int optional2, sym_intent intent2)
702 : : {
703 : 243552 : gfc_check_f cf;
704 : 243552 : gfc_simplify_f sf;
705 : 243552 : gfc_resolve_f rf;
706 : :
707 : 243552 : cf.f2 = check;
708 : 243552 : sf.f2 = simplify;
709 : 243552 : rf.f2 = resolve;
710 : :
711 : 243552 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
712 : : a1, type1, kind1, optional1, intent1,
713 : : a2, type2, kind2, optional2, intent2,
714 : : (void *) 0);
715 : 243552 : }
716 : :
717 : :
718 : : /* Add a symbol to the subroutine list where the subroutine takes
719 : : 2 arguments, specifying the intent of the arguments. */
720 : :
721 : : static void
722 : 1339536 : add_sym_2s (const char *name, gfc_isym_id id, enum klass cl, bt type,
723 : : int kind, int standard,
724 : : bool (*check) (gfc_expr *, gfc_expr *),
725 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *),
726 : : void (*resolve) (gfc_code *),
727 : : const char *a1, bt type1, int kind1, int optional1,
728 : : sym_intent intent1, const char *a2, bt type2, int kind2,
729 : : int optional2, sym_intent intent2)
730 : : {
731 : 1339536 : gfc_check_f cf;
732 : 1339536 : gfc_simplify_f sf;
733 : 1339536 : gfc_resolve_f rf;
734 : :
735 : 1339536 : cf.f2 = check;
736 : 1339536 : sf.f2 = simplify;
737 : 1339536 : rf.s1 = resolve;
738 : :
739 : 1339536 : add_sym (name, id, cl, ACTUAL_NO, type, kind, standard, cf, sf, rf,
740 : : a1, type1, kind1, optional1, intent1,
741 : : a2, type2, kind2, optional2, intent2,
742 : : (void *) 0);
743 : 1339536 : }
744 : :
745 : :
746 : : /* Add a symbol to the function list where the function takes
747 : : 3 arguments. */
748 : :
749 : : static void
750 : 1461312 : add_sym_3 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
751 : : int kind, int standard,
752 : : bool (*check) (gfc_expr *, gfc_expr *, gfc_expr *),
753 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *),
754 : : void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
755 : : const char *a1, bt type1, int kind1, int optional1,
756 : : const char *a2, bt type2, int kind2, int optional2,
757 : : const char *a3, bt type3, int kind3, int optional3)
758 : : {
759 : 1461312 : gfc_check_f cf;
760 : 1461312 : gfc_simplify_f sf;
761 : 1461312 : gfc_resolve_f rf;
762 : :
763 : 1461312 : cf.f3 = check;
764 : 1461312 : sf.f3 = simplify;
765 : 1461312 : rf.f3 = resolve;
766 : :
767 : 1461312 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
768 : : a1, type1, kind1, optional1, INTENT_IN,
769 : : a2, type2, kind2, optional2, INTENT_IN,
770 : : a3, type3, kind3, optional3, INTENT_IN,
771 : : (void *) 0);
772 : 1461312 : }
773 : :
774 : :
775 : : /* MINLOC and MAXLOC get special treatment because their
776 : : argument might have to be reordered. */
777 : :
778 : : static void
779 : 121776 : add_sym_5ml (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
780 : : int kind, int standard,
781 : : bool (*check) (gfc_actual_arglist *),
782 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *,
783 : : gfc_expr *, gfc_expr *),
784 : : void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
785 : : gfc_expr *, gfc_expr *),
786 : : const char *a1, bt type1, int kind1, int optional1,
787 : : const char *a2, bt type2, int kind2, int optional2,
788 : : const char *a3, bt type3, int kind3, int optional3,
789 : : const char *a4, bt type4, int kind4, int optional4,
790 : : const char *a5, bt type5, int kind5, int optional5)
791 : : {
792 : 121776 : gfc_check_f cf;
793 : 121776 : gfc_simplify_f sf;
794 : 121776 : gfc_resolve_f rf;
795 : :
796 : 121776 : cf.f5ml = check;
797 : 121776 : sf.f5 = simplify;
798 : 121776 : rf.f5 = resolve;
799 : :
800 : 121776 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
801 : : a1, type1, kind1, optional1, INTENT_IN,
802 : : a2, type2, kind2, optional2, INTENT_IN,
803 : : a3, type3, kind3, optional3, INTENT_IN,
804 : : a4, type4, kind4, optional4, INTENT_IN,
805 : : a5, type5, kind5, optional5, INTENT_IN,
806 : : (void *) 0);
807 : 121776 : }
808 : :
809 : : /* Similar for FINDLOC. */
810 : :
811 : : static void
812 : 60888 : add_sym_6fl (const char *name, gfc_isym_id id, enum klass cl, int actual_ok,
813 : : bt type, int kind, int standard,
814 : : bool (*check) (gfc_actual_arglist *),
815 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *,
816 : : gfc_expr *, gfc_expr *, gfc_expr *),
817 : : void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
818 : : gfc_expr *, gfc_expr *, gfc_expr *),
819 : : const char *a1, bt type1, int kind1, int optional1,
820 : : const char *a2, bt type2, int kind2, int optional2,
821 : : const char *a3, bt type3, int kind3, int optional3,
822 : : const char *a4, bt type4, int kind4, int optional4,
823 : : const char *a5, bt type5, int kind5, int optional5,
824 : : const char *a6, bt type6, int kind6, int optional6)
825 : :
826 : : {
827 : 60888 : gfc_check_f cf;
828 : 60888 : gfc_simplify_f sf;
829 : 60888 : gfc_resolve_f rf;
830 : :
831 : 60888 : cf.f6fl = check;
832 : 60888 : sf.f6 = simplify;
833 : 60888 : rf.f6 = resolve;
834 : :
835 : 60888 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
836 : : a1, type1, kind1, optional1, INTENT_IN,
837 : : a2, type2, kind2, optional2, INTENT_IN,
838 : : a3, type3, kind3, optional3, INTENT_IN,
839 : : a4, type4, kind4, optional4, INTENT_IN,
840 : : a5, type5, kind5, optional5, INTENT_IN,
841 : : a6, type6, kind6, optional6, INTENT_IN,
842 : : (void *) 0);
843 : 60888 : }
844 : :
845 : :
846 : : /* Add a symbol to the function list where the function takes
847 : : 6 arguments. */
848 : :
849 : : static void
850 : 60888 : add_sym_6 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok,
851 : : bt type, int kind, int standard,
852 : : bool (*check) (gfc_expr *, gfc_expr *, gfc_expr *,
853 : : gfc_expr *, gfc_expr *, gfc_expr *),
854 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *,
855 : : gfc_expr *, gfc_expr *, gfc_expr *),
856 : : void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
857 : : gfc_expr *, gfc_expr *, gfc_expr *),
858 : : const char *a1, bt type1, int kind1, int optional1,
859 : : const char *a2, bt type2, int kind2, int optional2,
860 : : const char *a3, bt type3, int kind3, int optional3,
861 : : const char *a4, bt type4, int kind4, int optional4,
862 : : const char *a5, bt type5, int kind5, int optional5,
863 : : const char *a6, bt type6, int kind6, int optional6)
864 : : {
865 : 60888 : gfc_check_f cf;
866 : 60888 : gfc_simplify_f sf;
867 : 60888 : gfc_resolve_f rf;
868 : :
869 : 60888 : cf.f6 = check;
870 : 60888 : sf.f6 = simplify;
871 : 60888 : rf.f6 = resolve;
872 : :
873 : 60888 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
874 : : a1, type1, kind1, optional1, INTENT_IN,
875 : : a2, type2, kind2, optional2, INTENT_IN,
876 : : a3, type3, kind3, optional3, INTENT_IN,
877 : : a4, type4, kind4, optional4, INTENT_IN,
878 : : a5, type5, kind5, optional5, INTENT_IN,
879 : : a6, type6, kind6, optional6, INTENT_IN,
880 : : (void *) 0);
881 : 60888 : }
882 : :
883 : :
884 : : /* MINVAL, MAXVAL, PRODUCT, and SUM also get special treatment because
885 : : their argument also might have to be reordered. */
886 : :
887 : : static void
888 : 426216 : add_sym_3red (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
889 : : int kind, int standard,
890 : : bool (*check) (gfc_actual_arglist *),
891 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *),
892 : : void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
893 : : const char *a1, bt type1, int kind1, int optional1,
894 : : const char *a2, bt type2, int kind2, int optional2,
895 : : const char *a3, bt type3, int kind3, int optional3)
896 : : {
897 : 426216 : gfc_check_f cf;
898 : 426216 : gfc_simplify_f sf;
899 : 426216 : gfc_resolve_f rf;
900 : :
901 : 426216 : cf.f3red = check;
902 : 426216 : sf.f3 = simplify;
903 : 426216 : rf.f3 = resolve;
904 : :
905 : 426216 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
906 : : a1, type1, kind1, optional1, INTENT_IN,
907 : : a2, type2, kind2, optional2, INTENT_IN,
908 : : a3, type3, kind3, optional3, INTENT_IN,
909 : : (void *) 0);
910 : 426216 : }
911 : :
912 : :
913 : : /* Add a symbol to the subroutine list where the subroutine takes
914 : : 3 arguments, specifying the intent of the arguments. */
915 : :
916 : : static void
917 : 1400424 : add_sym_3s (const char *name, gfc_isym_id id, enum klass cl, bt type,
918 : : int kind, int standard,
919 : : bool (*check) (gfc_expr *, gfc_expr *, gfc_expr *),
920 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *),
921 : : void (*resolve) (gfc_code *),
922 : : const char *a1, bt type1, int kind1, int optional1,
923 : : sym_intent intent1, const char *a2, bt type2, int kind2,
924 : : int optional2, sym_intent intent2, const char *a3, bt type3,
925 : : int kind3, int optional3, sym_intent intent3)
926 : : {
927 : 1400424 : gfc_check_f cf;
928 : 1400424 : gfc_simplify_f sf;
929 : 1400424 : gfc_resolve_f rf;
930 : :
931 : 1400424 : cf.f3 = check;
932 : 1400424 : sf.f3 = simplify;
933 : 1400424 : rf.s1 = resolve;
934 : :
935 : 1400424 : add_sym (name, id, cl, ACTUAL_NO, type, kind, standard, cf, sf, rf,
936 : : a1, type1, kind1, optional1, intent1,
937 : : a2, type2, kind2, optional2, intent2,
938 : : a3, type3, kind3, optional3, intent3,
939 : : (void *) 0);
940 : 1400424 : }
941 : :
942 : :
943 : : /* Add a symbol to the function list where the function takes
944 : : 4 arguments. */
945 : :
946 : : static void
947 : 304440 : add_sym_4 (const char *name, gfc_isym_id id, enum klass cl, int actual_ok, bt type,
948 : : int kind, int standard,
949 : : bool (*check) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
950 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *,
951 : : gfc_expr *),
952 : : void (*resolve) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
953 : : gfc_expr *),
954 : : const char *a1, bt type1, int kind1, int optional1,
955 : : const char *a2, bt type2, int kind2, int optional2,
956 : : const char *a3, bt type3, int kind3, int optional3,
957 : : const char *a4, bt type4, int kind4, int optional4 )
958 : : {
959 : 304440 : gfc_check_f cf;
960 : 304440 : gfc_simplify_f sf;
961 : 304440 : gfc_resolve_f rf;
962 : :
963 : 304440 : cf.f4 = check;
964 : 304440 : sf.f4 = simplify;
965 : 304440 : rf.f4 = resolve;
966 : :
967 : 304440 : add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
968 : : a1, type1, kind1, optional1, INTENT_IN,
969 : : a2, type2, kind2, optional2, INTENT_IN,
970 : : a3, type3, kind3, optional3, INTENT_IN,
971 : : a4, type4, kind4, optional4, INTENT_IN,
972 : : (void *) 0);
973 : 304440 : }
974 : :
975 : :
976 : : /* Add a symbol to the subroutine list where the subroutine takes
977 : : 4 arguments. */
978 : :
979 : : static void
980 : 669768 : add_sym_4s (const char *name, gfc_isym_id id, enum klass cl, bt type, int kind,
981 : : int standard,
982 : : bool (*check) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *),
983 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *,
984 : : gfc_expr *),
985 : : void (*resolve) (gfc_code *),
986 : : const char *a1, bt type1, int kind1, int optional1,
987 : : sym_intent intent1, const char *a2, bt type2, int kind2,
988 : : int optional2, sym_intent intent2, const char *a3, bt type3,
989 : : int kind3, int optional3, sym_intent intent3, const char *a4,
990 : : bt type4, int kind4, int optional4, sym_intent intent4)
991 : : {
992 : 669768 : gfc_check_f cf;
993 : 669768 : gfc_simplify_f sf;
994 : 669768 : gfc_resolve_f rf;
995 : :
996 : 669768 : cf.f4 = check;
997 : 669768 : sf.f4 = simplify;
998 : 669768 : rf.s1 = resolve;
999 : :
1000 : 669768 : add_sym (name, id, cl, ACTUAL_NO, type, kind, standard, cf, sf, rf,
1001 : : a1, type1, kind1, optional1, intent1,
1002 : : a2, type2, kind2, optional2, intent2,
1003 : : a3, type3, kind3, optional3, intent3,
1004 : : a4, type4, kind4, optional4, intent4,
1005 : : (void *) 0);
1006 : 669768 : }
1007 : :
1008 : :
1009 : : /* Add a symbol to the subroutine list where the subroutine takes
1010 : : 5 arguments. */
1011 : :
1012 : : static void
1013 : 304440 : add_sym_5s (const char *name, gfc_isym_id id, enum klass cl, bt type, int kind,
1014 : : int standard,
1015 : : bool (*check) (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
1016 : : gfc_expr *),
1017 : : gfc_expr *(*simplify) (gfc_expr *, gfc_expr *, gfc_expr *,
1018 : : gfc_expr *, gfc_expr *),
1019 : : void (*resolve) (gfc_code *),
1020 : : const char *a1, bt type1, int kind1, int optional1,
1021 : : sym_intent intent1, const char *a2, bt type2, int kind2,
1022 : : int optional2, sym_intent intent2, const char *a3, bt type3,
1023 : : int kind3, int optional3, sym_intent intent3, const char *a4,
1024 : : bt type4, int kind4, int optional4, sym_intent intent4,
1025 : : const char *a5, bt type5, int kind5, int optional5,
1026 : : sym_intent intent5)
1027 : : {
1028 : 304440 : gfc_check_f cf;
1029 : 304440 : gfc_simplify_f sf;
1030 : 304440 : gfc_resolve_f rf;
1031 : :
1032 : 304440 : cf.f5 = check;
1033 : 304440 : sf.f5 = simplify;
1034 : 304440 : rf.s1 = resolve;
1035 : :
1036 : 304440 : add_sym (name, id, cl, ACTUAL_NO, type, kind, standard, cf, sf, rf,
1037 : : a1, type1, kind1, optional1, intent1,
1038 : : a2, type2, kind2, optional2, intent2,
1039 : : a3, type3, kind3, optional3, intent3,
1040 : : a4, type4, kind4, optional4, intent4,
1041 : : a5, type5, kind5, optional5, intent5,
1042 : : (void *) 0);
1043 : 304440 : }
1044 : :
1045 : :
1046 : : /* Locate an intrinsic symbol given a base pointer, number of elements
1047 : : in the table and a pointer to a name. Returns the NULL pointer if
1048 : : a name is not found. */
1049 : :
1050 : : static gfc_intrinsic_sym *
1051 : 8615588 : find_sym (gfc_intrinsic_sym *start, int n, const char *name)
1052 : : {
1053 : : /* name may be a user-supplied string, so we must first make sure
1054 : : that we're comparing against a pointer into the global string
1055 : : table. */
1056 : 8615588 : const char *p = gfc_get_string ("%s", name);
1057 : :
1058 : 1539680544 : while (n > 0)
1059 : : {
1060 : 1530743882 : if (p == start->name)
1061 : : return start;
1062 : :
1063 : 1522449368 : start++;
1064 : 1522449368 : n--;
1065 : : }
1066 : :
1067 : : return NULL;
1068 : : }
1069 : :
1070 : :
1071 : : gfc_isym_id
1072 : 49810 : gfc_isym_id_by_intmod (intmod_id from_intmod, int intmod_sym_id)
1073 : : {
1074 : 49810 : if (from_intmod == INTMOD_NONE)
1075 : 0 : return (gfc_isym_id) intmod_sym_id;
1076 : 49810 : else if (from_intmod == INTMOD_ISO_C_BINDING)
1077 : 48632 : return (gfc_isym_id) c_interop_kinds_table[intmod_sym_id].value;
1078 : 1178 : else if (from_intmod == INTMOD_ISO_FORTRAN_ENV)
1079 : 1178 : switch (intmod_sym_id)
1080 : : {
1081 : : #define NAMED_SUBROUTINE(a,b,c,d) \
1082 : : case a: \
1083 : : return (gfc_isym_id) c;
1084 : : #define NAMED_FUNCTION(a,b,c,d) \
1085 : : case a: \
1086 : : return (gfc_isym_id) c;
1087 : : #include "iso-fortran-env.def"
1088 : 0 : default:
1089 : 0 : gcc_unreachable ();
1090 : : }
1091 : : else
1092 : 0 : gcc_unreachable ();
1093 : : return (gfc_isym_id) 0;
1094 : : }
1095 : :
1096 : :
1097 : : gfc_isym_id
1098 : 27155 : gfc_isym_id_by_intmod_sym (gfc_symbol *sym)
1099 : : {
1100 : 27155 : return gfc_isym_id_by_intmod (sym->from_intmod, sym->intmod_sym_id);
1101 : : }
1102 : :
1103 : :
1104 : : gfc_intrinsic_sym *
1105 : 18026 : gfc_intrinsic_subroutine_by_id (gfc_isym_id id)
1106 : : {
1107 : 18026 : gfc_intrinsic_sym *start = subroutines;
1108 : 18026 : int n = nsub;
1109 : :
1110 : 1516880 : while (true)
1111 : : {
1112 : 767453 : gcc_assert (n > 0);
1113 : 767453 : if (id == start->id)
1114 : 18026 : return start;
1115 : :
1116 : 749427 : start++;
1117 : 749427 : n--;
1118 : : }
1119 : : }
1120 : :
1121 : :
1122 : : gfc_intrinsic_sym *
1123 : 66265 : gfc_intrinsic_function_by_id (gfc_isym_id id)
1124 : : {
1125 : 66265 : gfc_intrinsic_sym *start = functions;
1126 : 66265 : int n = nfunc;
1127 : :
1128 : 36350323 : while (true)
1129 : : {
1130 : 18208294 : gcc_assert (n > 0);
1131 : 18208294 : if (id == start->id)
1132 : 66265 : return start;
1133 : :
1134 : 18142029 : start++;
1135 : 18142029 : n--;
1136 : : }
1137 : : }
1138 : :
1139 : :
1140 : : /* Given a name, find a function in the intrinsic function table.
1141 : : Returns NULL if not found. */
1142 : :
1143 : : gfc_intrinsic_sym *
1144 : 8378397 : gfc_find_function (const char *name)
1145 : : {
1146 : 8378397 : gfc_intrinsic_sym *sym;
1147 : :
1148 : 8378397 : sym = find_sym (functions, nfunc, name);
1149 : 8378397 : if (!sym || sym->from_module)
1150 : 158904 : sym = find_sym (conversion, nconv, name);
1151 : :
1152 : 8378397 : return (!sym || sym->from_module) ? NULL : sym;
1153 : : }
1154 : :
1155 : :
1156 : : /* Given a name, find a function in the intrinsic subroutine table.
1157 : : Returns NULL if not found. */
1158 : :
1159 : : gfc_intrinsic_sym *
1160 : 78287 : gfc_find_subroutine (const char *name)
1161 : : {
1162 : 78287 : gfc_intrinsic_sym *sym;
1163 : 78287 : sym = find_sym (subroutines, nsub, name);
1164 : 78287 : return (!sym || sym->from_module) ? NULL : sym;
1165 : : }
1166 : :
1167 : :
1168 : : /* Given a string, figure out if it is the name of a generic intrinsic
1169 : : function or not. */
1170 : :
1171 : : bool
1172 : 9338 : gfc_generic_intrinsic (const char *name)
1173 : : {
1174 : 9338 : gfc_intrinsic_sym *sym;
1175 : :
1176 : 9338 : sym = gfc_find_function (name);
1177 : 9338 : return (!sym || sym->from_module) ? 0 : sym->generic;
1178 : : }
1179 : :
1180 : :
1181 : : /* Given a string, figure out if it is the name of a specific
1182 : : intrinsic function or not. */
1183 : :
1184 : : bool
1185 : 8275 : gfc_specific_intrinsic (const char *name)
1186 : : {
1187 : 8275 : gfc_intrinsic_sym *sym;
1188 : :
1189 : 8275 : sym = gfc_find_function (name);
1190 : 8275 : return (!sym || sym->from_module) ? 0 : sym->specific;
1191 : : }
1192 : :
1193 : :
1194 : : /* Given a string, figure out if it is the name of an intrinsic function
1195 : : or subroutine allowed as an actual argument or not. */
1196 : : bool
1197 : 3228 : gfc_intrinsic_actual_ok (const char *name, const bool subroutine_flag)
1198 : : {
1199 : 3228 : gfc_intrinsic_sym *sym;
1200 : :
1201 : : /* Intrinsic subroutines are not allowed as actual arguments. */
1202 : 3228 : if (subroutine_flag)
1203 : : return 0;
1204 : : else
1205 : : {
1206 : 2336 : sym = gfc_find_function (name);
1207 : 2336 : return (sym == NULL) ? 0 : sym->actual_ok;
1208 : : }
1209 : : }
1210 : :
1211 : :
1212 : : /* Given a symbol, find out if it is (and is to be treated as) an intrinsic.
1213 : : If its name refers to an intrinsic, but this intrinsic is not included in
1214 : : the selected standard, this returns FALSE and sets the symbol's external
1215 : : attribute. */
1216 : :
1217 : : bool
1218 : 995190 : gfc_is_intrinsic (gfc_symbol* sym, int subroutine_flag, locus loc)
1219 : : {
1220 : 995190 : gfc_intrinsic_sym* isym;
1221 : 995190 : const char* symstd;
1222 : :
1223 : : /* If INTRINSIC attribute is already known, return. */
1224 : 995190 : if (sym->attr.intrinsic)
1225 : : return true;
1226 : :
1227 : : /* Check for attributes which prevent the symbol from being INTRINSIC. */
1228 : 967727 : if (sym->attr.external || sym->attr.contained
1229 : 935899 : || sym->attr.recursive
1230 : 935468 : || sym->attr.if_source == IFSRC_IFBODY)
1231 : : return false;
1232 : :
1233 : 930382 : if (subroutine_flag)
1234 : 73842 : isym = gfc_find_subroutine (sym->name);
1235 : : else
1236 : 856540 : isym = gfc_find_function (sym->name);
1237 : :
1238 : : /* No such intrinsic available at all? */
1239 : 930382 : if (!isym)
1240 : : return false;
1241 : :
1242 : : /* See if this intrinsic is allowed in the current standard. */
1243 : 784026 : if (!gfc_check_intrinsic_standard (isym, &symstd, false, loc)
1244 : 784026 : && !sym->attr.artificial)
1245 : : {
1246 : 157 : if (sym->attr.proc == PROC_UNKNOWN && warn_intrinsics_std)
1247 : 36 : gfc_warning_now (OPT_Wintrinsics_std, "The intrinsic %qs at %L is not "
1248 : : "included in the selected standard but %s and %qs will"
1249 : : " be treated as if declared EXTERNAL. Use an"
1250 : : " appropriate %<-std=%> option or define"
1251 : : " %<-fall-intrinsics%> to allow this intrinsic.",
1252 : : sym->name, &loc, symstd, sym->name);
1253 : :
1254 : 157 : return false;
1255 : : }
1256 : :
1257 : : return true;
1258 : : }
1259 : :
1260 : :
1261 : : /* Collect a set of intrinsic functions into a generic collection.
1262 : : The first argument is the name of the generic function, which is
1263 : : also the name of a specific function. The rest of the specifics
1264 : : currently in the table are placed into the list of specific
1265 : : functions associated with that generic.
1266 : :
1267 : : PR fortran/32778
1268 : : FIXME: Remove the argument STANDARD if no regressions are
1269 : : encountered. Change all callers (approx. 360).
1270 : : */
1271 : :
1272 : : static void
1273 : 14065128 : make_generic (const char *name, gfc_isym_id id, int standard ATTRIBUTE_UNUSED)
1274 : : {
1275 : 14065128 : gfc_intrinsic_sym *g;
1276 : :
1277 : 14065128 : if (sizing != SZ_NOTHING)
1278 : : return;
1279 : :
1280 : 7032564 : g = gfc_find_function (name);
1281 : 7032564 : if (g == NULL)
1282 : 0 : gfc_internal_error ("make_generic(): Cannot find generic symbol %qs",
1283 : : name);
1284 : :
1285 : 7032564 : gcc_assert (g->id == id);
1286 : :
1287 : 7032564 : g->generic = 1;
1288 : 7032564 : g->specific = 1;
1289 : 7032564 : if ((g + 1)->name != NULL)
1290 : 1341736 : g->specific_head = g + 1;
1291 : 7032564 : g++;
1292 : :
1293 : 9630504 : while (g->name != NULL)
1294 : : {
1295 : 2597940 : g->next = g + 1;
1296 : 2597940 : g->specific = 1;
1297 : 2597940 : g++;
1298 : : }
1299 : :
1300 : 7032564 : g--;
1301 : 7032564 : g->next = NULL;
1302 : : }
1303 : :
1304 : :
1305 : : /* Create a duplicate intrinsic function entry for the current
1306 : : function, the only differences being the alternate name and
1307 : : a different standard if necessary. Note that we use argument
1308 : : lists more than once, but all argument lists are freed as a
1309 : : single block. */
1310 : :
1311 : : static void
1312 : 1117984 : make_alias (const char *name, int standard)
1313 : : {
1314 : 1117984 : switch (sizing)
1315 : : {
1316 : 558192 : case SZ_FUNCS:
1317 : 558192 : nfunc++;
1318 : 558192 : break;
1319 : :
1320 : 800 : case SZ_SUBS:
1321 : 800 : nsub++;
1322 : 800 : break;
1323 : :
1324 : 558992 : case SZ_NOTHING:
1325 : 558992 : next_sym[0] = next_sym[-1];
1326 : 558992 : next_sym->name = gfc_get_string ("%s", name);
1327 : 558992 : next_sym->standard = standard;
1328 : 558992 : next_sym++;
1329 : 558992 : break;
1330 : :
1331 : : default:
1332 : : break;
1333 : : }
1334 : 1117984 : }
1335 : :
1336 : :
1337 : : /* Make the current subroutine noreturn. */
1338 : :
1339 : : static void
1340 : 182664 : make_noreturn (void)
1341 : : {
1342 : 0 : if (sizing == SZ_NOTHING)
1343 : 91332 : next_sym[-1].noreturn = 1;
1344 : 0 : }
1345 : :
1346 : :
1347 : : /* Mark current intrinsic as module intrinsic. */
1348 : : static void
1349 : 913320 : make_from_module (void)
1350 : : {
1351 : 0 : if (sizing == SZ_NOTHING)
1352 : 456660 : next_sym[-1].from_module = 1;
1353 : 0 : }
1354 : :
1355 : :
1356 : : /* Mark the current subroutine as having a variable number of
1357 : : arguments. */
1358 : :
1359 : : static void
1360 : 60888 : make_vararg (void)
1361 : : {
1362 : 0 : if (sizing == SZ_NOTHING)
1363 : 30444 : next_sym[-1].vararg = 1;
1364 : 0 : }
1365 : :
1366 : : /* Set the attr.value of the current procedure. */
1367 : :
1368 : : static void
1369 : 121776 : set_attr_value (int n, ...)
1370 : : {
1371 : 121776 : gfc_intrinsic_arg *arg;
1372 : 121776 : va_list argp;
1373 : 121776 : int i;
1374 : :
1375 : 121776 : if (sizing != SZ_NOTHING)
1376 : 60888 : return;
1377 : :
1378 : 60888 : va_start (argp, n);
1379 : 60888 : arg = next_sym[-1].formal;
1380 : :
1381 : 243552 : for (i = 0; i < n; i++)
1382 : : {
1383 : 182664 : gcc_assert (arg != NULL);
1384 : 182664 : arg->value = va_arg (argp, int);
1385 : 182664 : arg = arg->next;
1386 : : }
1387 : 60888 : va_end (argp);
1388 : : }
1389 : :
1390 : :
1391 : : /* Add intrinsic functions. */
1392 : :
1393 : : static void
1394 : 60888 : add_functions (void)
1395 : : {
1396 : : /* Argument names. These are used as argument keywords and so need to
1397 : : match the documentation. Please keep this list in sorted order. */
1398 : 60888 : const char
1399 : 60888 : *a = "a", *a1 = "a1", *a2 = "a2", *ar = "array", *b = "b",
1400 : 60888 : *bck = "back", *bd = "boundary", *c = "c", *c_ptr_1 = "c_ptr_1",
1401 : 60888 : *c_ptr_2 = "c_ptr_2", *ca = "coarray", *com = "command",
1402 : 60888 : *dist = "distance", *dm = "dim", *f = "field", *failed="failed",
1403 : 60888 : *fs = "fsource", *han = "handler", *i = "i",
1404 : 60888 : *idy = "identity", *image = "image", *j = "j", *kind = "kind",
1405 : 60888 : *l = "l", *ln = "len", *level = "level", *m = "matrix", *ma = "matrix_a",
1406 : 60888 : *mb = "matrix_b", *md = "mode", *mo = "mold", *msk = "mask",
1407 : 60888 : *n = "n", *ncopies= "ncopies", *nm = "name", *num = "number",
1408 : 60888 : *op = "operation", *ord = "order", *odd = "ordered", *p = "p",
1409 : 60888 : *p1 = "path1", *p2 = "path2", *pad = "pad", *pid = "pid", *pos = "pos",
1410 : 60888 : *pt = "pointer", *r = "r", *rd = "round",
1411 : 60888 : *s = "s", *set = "set", *sh = "shift", *shp = "shape",
1412 : 60888 : *sig = "sig", *src = "source", *ssg = "substring",
1413 : 60888 : *sta = "string_a", *stb = "string_b", *stg = "string",
1414 : 60888 : *sub = "sub", *sz = "size", *tg = "target", *team = "team", *tm = "time",
1415 : 60888 : *ts = "tsource", *ut = "unit", *v = "vector", *va = "vector_a",
1416 : 60888 : *vb = "vector_b", *vl = "values", *val = "value", *x = "x", *y = "y",
1417 : 60888 : *z = "z";
1418 : :
1419 : 60888 : int di, dr, dd, dl, dc, dz, ii;
1420 : :
1421 : 60888 : di = gfc_default_integer_kind;
1422 : 60888 : dr = gfc_default_real_kind;
1423 : 60888 : dd = gfc_default_double_kind;
1424 : 60888 : dl = gfc_default_logical_kind;
1425 : 60888 : dc = gfc_default_character_kind;
1426 : 60888 : dz = gfc_default_complex_kind;
1427 : 60888 : ii = gfc_index_integer_kind;
1428 : :
1429 : 60888 : add_sym_1 ("abs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1430 : : gfc_check_abs, gfc_simplify_abs, gfc_resolve_abs,
1431 : : a, BT_REAL, dr, REQUIRED);
1432 : :
1433 : 60888 : if (flag_dec_intrinsic_ints)
1434 : : {
1435 : 400 : make_alias ("babs", GFC_STD_GNU);
1436 : 400 : make_alias ("iiabs", GFC_STD_GNU);
1437 : 400 : make_alias ("jiabs", GFC_STD_GNU);
1438 : 400 : make_alias ("kiabs", GFC_STD_GNU);
1439 : : }
1440 : :
1441 : 60888 : add_sym_1 ("iabs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER, di, GFC_STD_F77,
1442 : : NULL, gfc_simplify_abs, gfc_resolve_abs,
1443 : : a, BT_INTEGER, di, REQUIRED);
1444 : :
1445 : 60888 : add_sym_1 ("dabs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1446 : : gfc_check_fn_d, gfc_simplify_abs, gfc_resolve_abs,
1447 : : a, BT_REAL, dd, REQUIRED);
1448 : :
1449 : 60888 : add_sym_1 ("cabs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1450 : : NULL, gfc_simplify_abs, gfc_resolve_abs,
1451 : : a, BT_COMPLEX, dz, REQUIRED);
1452 : :
1453 : 60888 : add_sym_1 ("zabs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_GNU,
1454 : : NULL, gfc_simplify_abs, gfc_resolve_abs,
1455 : : a, BT_COMPLEX, dd, REQUIRED);
1456 : :
1457 : 60888 : make_alias ("cdabs", GFC_STD_GNU);
1458 : :
1459 : 60888 : make_generic ("abs", GFC_ISYM_ABS, GFC_STD_F77);
1460 : :
1461 : : /* The checking function for ACCESS is called gfc_check_access_func
1462 : : because the name gfc_check_access is already used in module.cc. */
1463 : 60888 : add_sym_2 ("access", GFC_ISYM_ACCESS, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
1464 : : di, GFC_STD_GNU, gfc_check_access_func, NULL, gfc_resolve_access,
1465 : : nm, BT_CHARACTER, dc, REQUIRED, md, BT_CHARACTER, dc, REQUIRED);
1466 : :
1467 : 60888 : make_generic ("access", GFC_ISYM_ACCESS, GFC_STD_GNU);
1468 : :
1469 : 60888 : add_sym_2 ("achar", GFC_ISYM_ACHAR, CLASS_ELEMENTAL, ACTUAL_NO,
1470 : : BT_CHARACTER, dc, GFC_STD_F95,
1471 : : gfc_check_achar, gfc_simplify_achar, gfc_resolve_achar,
1472 : : i, BT_INTEGER, di, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
1473 : :
1474 : 60888 : make_generic ("achar", GFC_ISYM_ACHAR, GFC_STD_F95);
1475 : :
1476 : 60888 : add_sym_1 ("acos", GFC_ISYM_ACOS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1477 : : gfc_check_fn_rc2008, gfc_simplify_acos, gfc_resolve_acos,
1478 : : x, BT_REAL, dr, REQUIRED);
1479 : :
1480 : 60888 : add_sym_1 ("dacos", GFC_ISYM_ACOS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1481 : : gfc_check_fn_d, gfc_simplify_acos, gfc_resolve_acos,
1482 : : x, BT_REAL, dd, REQUIRED);
1483 : :
1484 : 60888 : make_generic ("acos", GFC_ISYM_ACOS, GFC_STD_F77);
1485 : :
1486 : 60888 : add_sym_1 ("acosh", GFC_ISYM_ACOSH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr,
1487 : : GFC_STD_F2008, gfc_check_fn_rc2008, gfc_simplify_acosh,
1488 : : gfc_resolve_acosh, x, BT_REAL, dr, REQUIRED);
1489 : :
1490 : 60888 : add_sym_1 ("dacosh", GFC_ISYM_ACOSH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_GNU,
1491 : : gfc_check_fn_d, gfc_simplify_acosh, gfc_resolve_acosh,
1492 : : x, BT_REAL, dd, REQUIRED);
1493 : :
1494 : 60888 : make_generic ("acosh", GFC_ISYM_ACOSH, GFC_STD_F2008);
1495 : :
1496 : 60888 : add_sym_1 ("adjustl", GFC_ISYM_ADJUSTL, CLASS_ELEMENTAL, ACTUAL_NO,
1497 : : BT_CHARACTER, dc, GFC_STD_F95, NULL, gfc_simplify_adjustl,
1498 : : gfc_resolve_adjustl, stg, BT_CHARACTER, 0, REQUIRED);
1499 : :
1500 : 60888 : make_generic ("adjustl", GFC_ISYM_ADJUSTL, GFC_STD_F95);
1501 : :
1502 : 60888 : add_sym_1 ("adjustr", GFC_ISYM_ADJUSTR, CLASS_ELEMENTAL, ACTUAL_NO,
1503 : : BT_CHARACTER, dc, GFC_STD_F95, NULL, gfc_simplify_adjustr,
1504 : : gfc_resolve_adjustr, stg, BT_CHARACTER, 0, REQUIRED);
1505 : :
1506 : 60888 : make_generic ("adjustr", GFC_ISYM_ADJUSTR, GFC_STD_F95);
1507 : :
1508 : 60888 : add_sym_1 ("aimag", GFC_ISYM_AIMAG, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1509 : : gfc_check_fn_c, gfc_simplify_aimag, gfc_resolve_aimag,
1510 : : z, BT_COMPLEX, dz, REQUIRED);
1511 : :
1512 : 60888 : make_alias ("imag", GFC_STD_GNU);
1513 : 60888 : make_alias ("imagpart", GFC_STD_GNU);
1514 : :
1515 : 60888 : add_sym_1 ("dimag", GFC_ISYM_AIMAG, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_GNU,
1516 : : NULL, gfc_simplify_aimag, gfc_resolve_aimag,
1517 : : z, BT_COMPLEX, dd, REQUIRED);
1518 : :
1519 : 60888 : make_generic ("aimag", GFC_ISYM_AIMAG, GFC_STD_F77);
1520 : :
1521 : 60888 : add_sym_2 ("aint", GFC_ISYM_AINT, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1522 : : gfc_check_a_xkind, gfc_simplify_aint, gfc_resolve_aint,
1523 : : a, BT_REAL, dr, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
1524 : :
1525 : 60888 : add_sym_1 ("dint", GFC_ISYM_AINT, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1526 : : NULL, gfc_simplify_dint, gfc_resolve_dint,
1527 : : a, BT_REAL, dd, REQUIRED);
1528 : :
1529 : 60888 : make_generic ("aint", GFC_ISYM_AINT, GFC_STD_F77);
1530 : :
1531 : 60888 : add_sym_2 ("all", GFC_ISYM_ALL, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F95,
1532 : : gfc_check_all_any, gfc_simplify_all, gfc_resolve_all,
1533 : : msk, BT_LOGICAL, dl, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL);
1534 : :
1535 : 60888 : make_generic ("all", GFC_ISYM_ALL, GFC_STD_F95);
1536 : :
1537 : 60888 : add_sym_1 ("allocated", GFC_ISYM_ALLOCATED, CLASS_INQUIRY, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F95,
1538 : : gfc_check_allocated, NULL, NULL,
1539 : : ar, BT_UNKNOWN, 0, REQUIRED);
1540 : :
1541 : 60888 : make_generic ("allocated", GFC_ISYM_ALLOCATED, GFC_STD_F95);
1542 : :
1543 : 60888 : add_sym_2 ("anint", GFC_ISYM_ANINT, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1544 : : gfc_check_a_xkind, gfc_simplify_anint, gfc_resolve_anint,
1545 : : a, BT_REAL, dr, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
1546 : :
1547 : 60888 : add_sym_1 ("dnint", GFC_ISYM_ANINT, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1548 : : NULL, gfc_simplify_dnint, gfc_resolve_dnint,
1549 : : a, BT_REAL, dd, REQUIRED);
1550 : :
1551 : 60888 : make_generic ("anint", GFC_ISYM_ANINT, GFC_STD_F77);
1552 : :
1553 : 60888 : add_sym_2 ("any", GFC_ISYM_ANY, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F95,
1554 : : gfc_check_all_any, gfc_simplify_any, gfc_resolve_any,
1555 : : msk, BT_LOGICAL, dl, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL);
1556 : :
1557 : 60888 : make_generic ("any", GFC_ISYM_ANY, GFC_STD_F95);
1558 : :
1559 : 60888 : add_sym_1 ("asin", GFC_ISYM_ASIN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1560 : : gfc_check_fn_rc2008, gfc_simplify_asin, gfc_resolve_asin,
1561 : : x, BT_REAL, dr, REQUIRED);
1562 : :
1563 : 60888 : add_sym_1 ("dasin", GFC_ISYM_ASIN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1564 : : gfc_check_fn_d, gfc_simplify_asin, gfc_resolve_asin,
1565 : : x, BT_REAL, dd, REQUIRED);
1566 : :
1567 : 60888 : make_generic ("asin", GFC_ISYM_ASIN, GFC_STD_F77);
1568 : :
1569 : 60888 : add_sym_1 ("asinh", GFC_ISYM_ASINH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr,
1570 : : GFC_STD_F2008, gfc_check_fn_rc2008, gfc_simplify_asinh,
1571 : : gfc_resolve_asinh, x, BT_REAL, dr, REQUIRED);
1572 : :
1573 : 60888 : add_sym_1 ("dasinh", GFC_ISYM_ASINH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_GNU,
1574 : : gfc_check_fn_d, gfc_simplify_asinh, gfc_resolve_asinh,
1575 : : x, BT_REAL, dd, REQUIRED);
1576 : :
1577 : 60888 : make_generic ("asinh", GFC_ISYM_ASINH, GFC_STD_F2008);
1578 : :
1579 : 60888 : add_sym_2 ("associated", GFC_ISYM_ASSOCIATED, CLASS_INQUIRY, ACTUAL_NO, BT_LOGICAL, dl,
1580 : : GFC_STD_F95, gfc_check_associated, NULL, NULL,
1581 : : pt, BT_UNKNOWN, 0, REQUIRED, tg, BT_UNKNOWN, 0, OPTIONAL);
1582 : :
1583 : 60888 : make_generic ("associated", GFC_ISYM_ASSOCIATED, GFC_STD_F95);
1584 : :
1585 : 60888 : add_sym_1 ("atan", GFC_ISYM_ATAN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1586 : : gfc_check_fn_rc2008, gfc_simplify_atan, gfc_resolve_atan,
1587 : : x, BT_REAL, dr, REQUIRED);
1588 : :
1589 : 60888 : add_sym_1 ("datan", GFC_ISYM_ATAN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1590 : : gfc_check_fn_d, gfc_simplify_atan, gfc_resolve_atan,
1591 : : x, BT_REAL, dd, REQUIRED);
1592 : :
1593 : : /* Two-argument version of atan, equivalent to atan2. */
1594 : 60888 : add_sym_2 ("atan", GFC_ISYM_ATAN2, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F2008,
1595 : : gfc_check_atan_2, gfc_simplify_atan2, gfc_resolve_atan2,
1596 : : y, BT_REAL, dr, REQUIRED, x, BT_REAL, dr, REQUIRED);
1597 : :
1598 : 60888 : make_generic ("atan", GFC_ISYM_ATAN, GFC_STD_F77);
1599 : :
1600 : 60888 : add_sym_1 ("atanh", GFC_ISYM_ATANH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr,
1601 : : GFC_STD_F2008, gfc_check_fn_rc2008, gfc_simplify_atanh,
1602 : : gfc_resolve_atanh, x, BT_REAL, dr, REQUIRED);
1603 : :
1604 : 60888 : add_sym_1 ("datanh", GFC_ISYM_ATANH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_GNU,
1605 : : gfc_check_fn_d, gfc_simplify_atanh, gfc_resolve_atanh,
1606 : : x, BT_REAL, dd, REQUIRED);
1607 : :
1608 : 60888 : make_generic ("atanh", GFC_ISYM_ATANH, GFC_STD_F2008);
1609 : :
1610 : 60888 : add_sym_2 ("atan2", GFC_ISYM_ATAN2, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1611 : : gfc_check_atan2, gfc_simplify_atan2, gfc_resolve_atan2,
1612 : : y, BT_REAL, dr, REQUIRED, x, BT_REAL, dr, REQUIRED);
1613 : :
1614 : 60888 : add_sym_2 ("datan2", GFC_ISYM_ATAN2, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1615 : : gfc_check_datan2, gfc_simplify_atan2, gfc_resolve_atan2,
1616 : : y, BT_REAL, dd, REQUIRED, x, BT_REAL, dd, REQUIRED);
1617 : :
1618 : 60888 : make_generic ("atan2", GFC_ISYM_ATAN2, GFC_STD_F77);
1619 : :
1620 : : /* Bessel and Neumann functions for G77 compatibility. */
1621 : 60888 : add_sym_1 ("besj0", GFC_ISYM_J0, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
1622 : : gfc_check_fn_r, gfc_simplify_bessel_j0, gfc_resolve_g77_math1,
1623 : : x, BT_REAL, dr, REQUIRED);
1624 : :
1625 : 60888 : make_alias ("bessel_j0", GFC_STD_F2008);
1626 : :
1627 : 60888 : add_sym_1 ("dbesj0", GFC_ISYM_J0, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU,
1628 : : gfc_check_fn_d, gfc_simplify_bessel_j0, gfc_resolve_g77_math1,
1629 : : x, BT_REAL, dd, REQUIRED);
1630 : :
1631 : 60888 : make_generic ("bessel_j0", GFC_ISYM_J0, GFC_STD_F2008);
1632 : :
1633 : 60888 : add_sym_1 ("besj1", GFC_ISYM_J1, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
1634 : : gfc_check_fn_r, gfc_simplify_bessel_j1, gfc_resolve_g77_math1,
1635 : : x, BT_REAL, dr, REQUIRED);
1636 : :
1637 : 60888 : make_alias ("bessel_j1", GFC_STD_F2008);
1638 : :
1639 : 60888 : add_sym_1 ("dbesj1", GFC_ISYM_J1, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU,
1640 : : gfc_check_fn_d, gfc_simplify_bessel_j1, gfc_resolve_g77_math1,
1641 : : x, BT_REAL, dd, REQUIRED);
1642 : :
1643 : 60888 : make_generic ("bessel_j1", GFC_ISYM_J1, GFC_STD_F2008);
1644 : :
1645 : 60888 : add_sym_2 ("besjn", GFC_ISYM_JN, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
1646 : : gfc_check_besn, gfc_simplify_bessel_jn, gfc_resolve_besn,
1647 : : n, BT_INTEGER, di, REQUIRED, x, BT_REAL, dr, REQUIRED);
1648 : :
1649 : 60888 : make_alias ("bessel_jn", GFC_STD_F2008);
1650 : :
1651 : 60888 : add_sym_2 ("dbesjn", GFC_ISYM_JN, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU,
1652 : : gfc_check_besn, gfc_simplify_bessel_jn, gfc_resolve_besn,
1653 : : n, BT_INTEGER, di, REQUIRED, x, BT_REAL, dd, REQUIRED);
1654 : :
1655 : 60888 : add_sym_3 ("bessel_jn", GFC_ISYM_JN2, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F2008,
1656 : : gfc_check_bessel_n2, gfc_simplify_bessel_jn2, gfc_resolve_bessel_n2,
1657 : : "n1", BT_INTEGER, di, REQUIRED,"n2", BT_INTEGER, di, REQUIRED,
1658 : : x, BT_REAL, dr, REQUIRED);
1659 : 60888 : set_attr_value (3, true, true, true);
1660 : :
1661 : 60888 : make_generic ("bessel_jn", GFC_ISYM_JN, GFC_STD_F2008);
1662 : :
1663 : 60888 : add_sym_1 ("besy0", GFC_ISYM_Y0, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
1664 : : gfc_check_fn_r, gfc_simplify_bessel_y0, gfc_resolve_g77_math1,
1665 : : x, BT_REAL, dr, REQUIRED);
1666 : :
1667 : 60888 : make_alias ("bessel_y0", GFC_STD_F2008);
1668 : :
1669 : 60888 : add_sym_1 ("dbesy0", GFC_ISYM_Y0, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU,
1670 : : gfc_check_fn_d, gfc_simplify_bessel_y0, gfc_resolve_g77_math1,
1671 : : x, BT_REAL, dd, REQUIRED);
1672 : :
1673 : 60888 : make_generic ("bessel_y0", GFC_ISYM_Y0, GFC_STD_F2008);
1674 : :
1675 : 60888 : add_sym_1 ("besy1", GFC_ISYM_Y1, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
1676 : : gfc_check_fn_r, gfc_simplify_bessel_y1, gfc_resolve_g77_math1,
1677 : : x, BT_REAL, dr, REQUIRED);
1678 : :
1679 : 60888 : make_alias ("bessel_y1", GFC_STD_F2008);
1680 : :
1681 : 60888 : add_sym_1 ("dbesy1", GFC_ISYM_Y1, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU,
1682 : : gfc_check_fn_d, gfc_simplify_bessel_y1, gfc_resolve_g77_math1,
1683 : : x, BT_REAL, dd, REQUIRED);
1684 : :
1685 : 60888 : make_generic ("bessel_y1", GFC_ISYM_Y1, GFC_STD_F2008);
1686 : :
1687 : 60888 : add_sym_2 ("besyn", GFC_ISYM_YN, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
1688 : : gfc_check_besn, gfc_simplify_bessel_yn, gfc_resolve_besn,
1689 : : n, BT_INTEGER, di, REQUIRED, x, BT_REAL, dr, REQUIRED);
1690 : :
1691 : 60888 : make_alias ("bessel_yn", GFC_STD_F2008);
1692 : :
1693 : 60888 : add_sym_2 ("dbesyn", GFC_ISYM_YN, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU,
1694 : : gfc_check_besn, gfc_simplify_bessel_yn, gfc_resolve_besn,
1695 : : n, BT_INTEGER, di, REQUIRED, x, BT_REAL, dd, REQUIRED);
1696 : :
1697 : 60888 : add_sym_3 ("bessel_yn", GFC_ISYM_YN2, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F2008,
1698 : : gfc_check_bessel_n2, gfc_simplify_bessel_yn2, gfc_resolve_bessel_n2,
1699 : : "n1", BT_INTEGER, di, REQUIRED,"n2", BT_INTEGER, di, REQUIRED,
1700 : : x, BT_REAL, dr, REQUIRED);
1701 : 60888 : set_attr_value (3, true, true, true);
1702 : :
1703 : 60888 : make_generic ("bessel_yn", GFC_ISYM_YN, GFC_STD_F2008);
1704 : :
1705 : 60888 : add_sym_2 ("bge", GFC_ISYM_BGE, CLASS_ELEMENTAL, ACTUAL_NO,
1706 : : BT_LOGICAL, dl, GFC_STD_F2008,
1707 : : gfc_check_bge_bgt_ble_blt, gfc_simplify_bge, NULL,
1708 : : i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
1709 : :
1710 : 60888 : make_generic ("bge", GFC_ISYM_BGE, GFC_STD_F2008);
1711 : :
1712 : 60888 : add_sym_2 ("bgt", GFC_ISYM_BGT, CLASS_ELEMENTAL, ACTUAL_NO,
1713 : : BT_LOGICAL, dl, GFC_STD_F2008,
1714 : : gfc_check_bge_bgt_ble_blt, gfc_simplify_bgt, NULL,
1715 : : i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
1716 : :
1717 : 60888 : make_generic ("bgt", GFC_ISYM_BGT, GFC_STD_F2008);
1718 : :
1719 : 60888 : add_sym_1 ("bit_size", GFC_ISYM_BIT_SIZE, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
1720 : : gfc_check_iu, gfc_simplify_bit_size, NULL,
1721 : : i, BT_INTEGER, di, REQUIRED);
1722 : :
1723 : 60888 : make_generic ("bit_size", GFC_ISYM_BIT_SIZE, GFC_STD_F95);
1724 : :
1725 : 60888 : add_sym_2 ("ble", GFC_ISYM_BLE, CLASS_ELEMENTAL, ACTUAL_NO,
1726 : : BT_LOGICAL, dl, GFC_STD_F2008,
1727 : : gfc_check_bge_bgt_ble_blt, gfc_simplify_ble, NULL,
1728 : : i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
1729 : :
1730 : 60888 : make_generic ("ble", GFC_ISYM_BLE, GFC_STD_F2008);
1731 : :
1732 : 60888 : add_sym_2 ("blt", GFC_ISYM_BLT, CLASS_ELEMENTAL, ACTUAL_NO,
1733 : : BT_LOGICAL, dl, GFC_STD_F2008,
1734 : : gfc_check_bge_bgt_ble_blt, gfc_simplify_blt, NULL,
1735 : : i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
1736 : :
1737 : 60888 : make_generic ("blt", GFC_ISYM_BLT, GFC_STD_F2008);
1738 : :
1739 : 60888 : add_sym_2 ("btest", GFC_ISYM_BTEST, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F95,
1740 : : gfc_check_bitfcn, gfc_simplify_btest, gfc_resolve_btest,
1741 : : i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED);
1742 : :
1743 : 60888 : if (flag_dec_intrinsic_ints)
1744 : : {
1745 : 400 : make_alias ("bbtest", GFC_STD_GNU);
1746 : 400 : make_alias ("bitest", GFC_STD_GNU);
1747 : 400 : make_alias ("bjtest", GFC_STD_GNU);
1748 : 400 : make_alias ("bktest", GFC_STD_GNU);
1749 : : }
1750 : :
1751 : 60888 : make_generic ("btest", GFC_ISYM_BTEST, GFC_STD_F95);
1752 : :
1753 : 60888 : add_sym_2 ("ceiling", GFC_ISYM_CEILING, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
1754 : : gfc_check_a_ikind, gfc_simplify_ceiling, gfc_resolve_ceiling,
1755 : : a, BT_REAL, dr, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
1756 : :
1757 : 60888 : make_generic ("ceiling", GFC_ISYM_CEILING, GFC_STD_F95);
1758 : :
1759 : 60888 : add_sym_2 ("char", GFC_ISYM_CHAR, CLASS_ELEMENTAL, ACTUAL_NO, BT_CHARACTER, dc, GFC_STD_F77,
1760 : : gfc_check_char, gfc_simplify_char, gfc_resolve_char,
1761 : : i, BT_INTEGER, di, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
1762 : :
1763 : 60888 : make_generic ("char", GFC_ISYM_CHAR, GFC_STD_F77);
1764 : :
1765 : 60888 : add_sym_1 ("chdir", GFC_ISYM_CHDIR, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, di,
1766 : : GFC_STD_GNU, gfc_check_chdir, NULL, gfc_resolve_chdir,
1767 : : nm, BT_CHARACTER, dc, REQUIRED);
1768 : :
1769 : 60888 : make_generic ("chdir", GFC_ISYM_CHDIR, GFC_STD_GNU);
1770 : :
1771 : 60888 : add_sym_2 ("chmod", GFC_ISYM_CHMOD, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
1772 : : di, GFC_STD_GNU, gfc_check_chmod, NULL, gfc_resolve_chmod,
1773 : : nm, BT_CHARACTER, dc, REQUIRED, md, BT_CHARACTER, dc, REQUIRED);
1774 : :
1775 : 60888 : make_generic ("chmod", GFC_ISYM_CHMOD, GFC_STD_GNU);
1776 : :
1777 : 60888 : add_sym_3 ("cmplx", GFC_ISYM_CMPLX, CLASS_ELEMENTAL, ACTUAL_NO, BT_COMPLEX, dz, GFC_STD_F77,
1778 : : gfc_check_cmplx, gfc_simplify_cmplx, gfc_resolve_cmplx,
1779 : : x, BT_UNKNOWN, dr, REQUIRED, y, BT_UNKNOWN, dr, OPTIONAL,
1780 : : kind, BT_INTEGER, di, OPTIONAL);
1781 : :
1782 : 60888 : make_generic ("cmplx", GFC_ISYM_CMPLX, GFC_STD_F77);
1783 : :
1784 : 60888 : add_sym_0 ("command_argument_count", GFC_ISYM_COMMAND_ARGUMENT_COUNT, CLASS_INQUIRY,
1785 : : ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2003, NULL, NULL, NULL);
1786 : :
1787 : 60888 : make_generic ("command_argument_count", GFC_ISYM_COMMAND_ARGUMENT_COUNT,
1788 : : GFC_STD_F2003);
1789 : :
1790 : 60888 : add_sym_2 ("complex", GFC_ISYM_COMPLEX, CLASS_ELEMENTAL, ACTUAL_NO, BT_COMPLEX, dz, GFC_STD_GNU,
1791 : : gfc_check_complex, gfc_simplify_complex, gfc_resolve_complex,
1792 : : x, BT_UNKNOWN, dr, REQUIRED, y, BT_UNKNOWN, dr, REQUIRED);
1793 : :
1794 : 60888 : make_generic ("complex", GFC_ISYM_COMPLEX, GFC_STD_GNU);
1795 : :
1796 : : /* Making dcmplx a specific of cmplx causes cmplx to return a double
1797 : : complex instead of the default complex. */
1798 : :
1799 : 60888 : add_sym_2 ("dcmplx", GFC_ISYM_CMPLX, CLASS_ELEMENTAL, ACTUAL_NO, BT_COMPLEX, dd, GFC_STD_GNU,
1800 : : gfc_check_dcmplx, gfc_simplify_dcmplx, gfc_resolve_dcmplx,
1801 : : x, BT_REAL, dd, REQUIRED, y, BT_REAL, dd, OPTIONAL);
1802 : :
1803 : 60888 : make_generic ("dcmplx", GFC_ISYM_CMPLX, GFC_STD_GNU);
1804 : :
1805 : 60888 : add_sym_1 ("conjg", GFC_ISYM_CONJG, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dz, GFC_STD_F77,
1806 : : gfc_check_fn_c, gfc_simplify_conjg, gfc_resolve_conjg,
1807 : : z, BT_COMPLEX, dz, REQUIRED);
1808 : :
1809 : 60888 : add_sym_1 ("dconjg", GFC_ISYM_CONJG, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dd, GFC_STD_GNU,
1810 : : NULL, gfc_simplify_conjg, gfc_resolve_conjg,
1811 : : z, BT_COMPLEX, dd, REQUIRED);
1812 : :
1813 : 60888 : make_generic ("conjg", GFC_ISYM_CONJG, GFC_STD_F77);
1814 : :
1815 : 60888 : add_sym_1 ("cos", GFC_ISYM_COS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1816 : : gfc_check_fn_rc, gfc_simplify_cos, gfc_resolve_cos,
1817 : : x, BT_REAL, dr, REQUIRED);
1818 : :
1819 : 60888 : add_sym_1 ("dcos", GFC_ISYM_COS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1820 : : gfc_check_fn_d, gfc_simplify_cos, gfc_resolve_cos,
1821 : : x, BT_REAL, dd, REQUIRED);
1822 : :
1823 : 60888 : add_sym_1 ("ccos", GFC_ISYM_COS, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dz, GFC_STD_F77,
1824 : : NULL, gfc_simplify_cos, gfc_resolve_cos,
1825 : : x, BT_COMPLEX, dz, REQUIRED);
1826 : :
1827 : 60888 : add_sym_1 ("zcos", GFC_ISYM_COS, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dd, GFC_STD_GNU,
1828 : : NULL, gfc_simplify_cos, gfc_resolve_cos,
1829 : : x, BT_COMPLEX, dd, REQUIRED);
1830 : :
1831 : 60888 : make_alias ("cdcos", GFC_STD_GNU);
1832 : :
1833 : 60888 : make_generic ("cos", GFC_ISYM_COS, GFC_STD_F77);
1834 : :
1835 : 60888 : add_sym_1 ("cosh", GFC_ISYM_COSH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1836 : : gfc_check_fn_rc2008, gfc_simplify_cosh, gfc_resolve_cosh,
1837 : : x, BT_REAL, dr, REQUIRED);
1838 : :
1839 : 60888 : add_sym_1 ("dcosh", GFC_ISYM_COSH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1840 : : gfc_check_fn_d, gfc_simplify_cosh, gfc_resolve_cosh,
1841 : : x, BT_REAL, dd, REQUIRED);
1842 : :
1843 : 60888 : make_generic ("cosh", GFC_ISYM_COSH, GFC_STD_F77);
1844 : :
1845 : 60888 : add_sym_3 ("count", GFC_ISYM_COUNT, CLASS_TRANSFORMATIONAL, ACTUAL_NO,
1846 : : BT_INTEGER, di, GFC_STD_F95,
1847 : : gfc_check_count, gfc_simplify_count, gfc_resolve_count,
1848 : : msk, BT_LOGICAL, dl, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
1849 : : kind, BT_INTEGER, di, OPTIONAL);
1850 : :
1851 : 60888 : make_generic ("count", GFC_ISYM_COUNT, GFC_STD_F95);
1852 : :
1853 : 60888 : add_sym_3 ("cshift", GFC_ISYM_CSHIFT, CLASS_TRANSFORMATIONAL, ACTUAL_NO,
1854 : : BT_REAL, dr, GFC_STD_F95,
1855 : : gfc_check_cshift, gfc_simplify_cshift, gfc_resolve_cshift,
1856 : : ar, BT_REAL, dr, REQUIRED,
1857 : : sh, BT_INTEGER, di, REQUIRED,
1858 : : dm, BT_INTEGER, ii, OPTIONAL);
1859 : :
1860 : 60888 : make_generic ("cshift", GFC_ISYM_CSHIFT, GFC_STD_F95);
1861 : :
1862 : 60888 : add_sym_1 ("ctime", GFC_ISYM_CTIME, CLASS_IMPURE, ACTUAL_NO, BT_CHARACTER,
1863 : : 0, GFC_STD_GNU, gfc_check_ctime, NULL, gfc_resolve_ctime,
1864 : : tm, BT_INTEGER, di, REQUIRED);
1865 : :
1866 : 60888 : make_generic ("ctime", GFC_ISYM_CTIME, GFC_STD_GNU);
1867 : :
1868 : 60888 : add_sym_1 ("dble", GFC_ISYM_DBLE, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_F77,
1869 : : gfc_check_dble, gfc_simplify_dble, gfc_resolve_dble,
1870 : : a, BT_REAL, dr, REQUIRED);
1871 : :
1872 : 60888 : make_generic ("dble", GFC_ISYM_DBLE, GFC_STD_F77);
1873 : :
1874 : 60888 : add_sym_1 ("digits", GFC_ISYM_DIGITS, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
1875 : : gfc_check_digits, gfc_simplify_digits, NULL,
1876 : : x, BT_UNKNOWN, dr, REQUIRED);
1877 : :
1878 : 60888 : make_generic ("digits", GFC_ISYM_DIGITS, GFC_STD_F95);
1879 : :
1880 : 60888 : add_sym_2 ("dim", GFC_ISYM_DIM, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1881 : : gfc_check_a_p, gfc_simplify_dim, gfc_resolve_dim,
1882 : : x, BT_REAL, dr, REQUIRED, y, BT_REAL, dr, REQUIRED);
1883 : :
1884 : 60888 : add_sym_2 ("idim", GFC_ISYM_DIM, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER, di, GFC_STD_F77,
1885 : : NULL, gfc_simplify_dim, gfc_resolve_dim,
1886 : : x, BT_INTEGER, di, REQUIRED, y, BT_INTEGER, di, REQUIRED);
1887 : :
1888 : 60888 : add_sym_2 ("ddim", GFC_ISYM_DIM, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1889 : : gfc_check_x_yd, gfc_simplify_dim, gfc_resolve_dim,
1890 : : x, BT_REAL, dd, REQUIRED, y, BT_REAL, dd, REQUIRED);
1891 : :
1892 : 60888 : make_generic ("dim", GFC_ISYM_DIM, GFC_STD_F77);
1893 : :
1894 : 60888 : add_sym_2 ("dot_product", GFC_ISYM_DOT_PRODUCT, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr,
1895 : : GFC_STD_F95, gfc_check_dot_product, gfc_simplify_dot_product, gfc_resolve_dot_product,
1896 : : va, BT_REAL, dr, REQUIRED, vb, BT_REAL, dr, REQUIRED);
1897 : :
1898 : 60888 : make_generic ("dot_product", GFC_ISYM_DOT_PRODUCT, GFC_STD_F95);
1899 : :
1900 : 60888 : add_sym_2 ("dprod", GFC_ISYM_DPROD,CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1901 : : gfc_check_dprod, gfc_simplify_dprod, gfc_resolve_dprod,
1902 : : x, BT_REAL, dr, REQUIRED, y, BT_REAL, dr, REQUIRED);
1903 : :
1904 : 60888 : make_generic ("dprod", GFC_ISYM_DPROD, GFC_STD_F77);
1905 : :
1906 : 60888 : add_sym_1 ("dreal", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO,
1907 : : BT_REAL, dd, GFC_STD_GNU, NULL, gfc_simplify_dreal, NULL,
1908 : : a, BT_COMPLEX, dd, REQUIRED);
1909 : :
1910 : 60888 : make_generic ("dreal", GFC_ISYM_REAL, GFC_STD_GNU);
1911 : :
1912 : 60888 : add_sym_3 ("dshiftl", GFC_ISYM_DSHIFTL, CLASS_ELEMENTAL, ACTUAL_NO,
1913 : : BT_INTEGER, di, GFC_STD_F2008,
1914 : : gfc_check_dshift, gfc_simplify_dshiftl, gfc_resolve_dshift,
1915 : : i, BT_INTEGER, di, REQUIRED,
1916 : : j, BT_INTEGER, di, REQUIRED,
1917 : : sh, BT_INTEGER, di, REQUIRED);
1918 : :
1919 : 60888 : make_generic ("dshiftl", GFC_ISYM_DSHIFTL, GFC_STD_F2008);
1920 : :
1921 : 60888 : add_sym_3 ("dshiftr", GFC_ISYM_DSHIFTR, CLASS_ELEMENTAL, ACTUAL_NO,
1922 : : BT_INTEGER, di, GFC_STD_F2008,
1923 : : gfc_check_dshift, gfc_simplify_dshiftr, gfc_resolve_dshift,
1924 : : i, BT_INTEGER, di, REQUIRED,
1925 : : j, BT_INTEGER, di, REQUIRED,
1926 : : sh, BT_INTEGER, di, REQUIRED);
1927 : :
1928 : 60888 : make_generic ("dshiftr", GFC_ISYM_DSHIFTR, GFC_STD_F2008);
1929 : :
1930 : 60888 : add_sym_4 ("eoshift", GFC_ISYM_EOSHIFT, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
1931 : : gfc_check_eoshift, gfc_simplify_eoshift, gfc_resolve_eoshift,
1932 : : ar, BT_REAL, dr, REQUIRED, sh, BT_INTEGER, ii, REQUIRED,
1933 : : bd, BT_REAL, dr, OPTIONAL, dm, BT_INTEGER, ii, OPTIONAL);
1934 : :
1935 : 60888 : make_generic ("eoshift", GFC_ISYM_EOSHIFT, GFC_STD_F95);
1936 : :
1937 : 60888 : add_sym_1 ("epsilon", GFC_ISYM_EPSILON, CLASS_INQUIRY, ACTUAL_NO, BT_REAL, dr,
1938 : : GFC_STD_F95, gfc_check_fn_r, gfc_simplify_epsilon, NULL,
1939 : : x, BT_REAL, dr, REQUIRED);
1940 : :
1941 : 60888 : make_generic ("epsilon", GFC_ISYM_EPSILON, GFC_STD_F95);
1942 : :
1943 : : /* G77 compatibility for the ERF() and ERFC() functions. */
1944 : 60888 : add_sym_1 ("erf", GFC_ISYM_ERF, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr,
1945 : : GFC_STD_F2008, gfc_check_fn_r, gfc_simplify_erf,
1946 : : gfc_resolve_g77_math1, x, BT_REAL, dr, REQUIRED);
1947 : :
1948 : 60888 : add_sym_1 ("derf", GFC_ISYM_ERF, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd,
1949 : : GFC_STD_GNU, gfc_check_fn_d, gfc_simplify_erf,
1950 : : gfc_resolve_g77_math1, x, BT_REAL, dd, REQUIRED);
1951 : :
1952 : 60888 : make_generic ("erf", GFC_ISYM_ERF, GFC_STD_F2008);
1953 : :
1954 : 60888 : add_sym_1 ("erfc", GFC_ISYM_ERFC, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr,
1955 : : GFC_STD_F2008, gfc_check_fn_r, gfc_simplify_erfc,
1956 : : gfc_resolve_g77_math1, x, BT_REAL, dr, REQUIRED);
1957 : :
1958 : 60888 : add_sym_1 ("derfc", GFC_ISYM_ERFC, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd,
1959 : : GFC_STD_GNU, gfc_check_fn_d, gfc_simplify_erfc,
1960 : : gfc_resolve_g77_math1, x, BT_REAL, dd, REQUIRED);
1961 : :
1962 : 60888 : make_generic ("erfc", GFC_ISYM_ERFC, GFC_STD_F2008);
1963 : :
1964 : 60888 : add_sym_1 ("erfc_scaled", GFC_ISYM_ERFC_SCALED, CLASS_ELEMENTAL, ACTUAL_NO,
1965 : : BT_REAL, dr, GFC_STD_F2008, gfc_check_fn_r,
1966 : : gfc_simplify_erfc_scaled, gfc_resolve_g77_math1, x, BT_REAL,
1967 : : dr, REQUIRED);
1968 : :
1969 : 60888 : make_generic ("erfc_scaled", GFC_ISYM_ERFC_SCALED, GFC_STD_F2008);
1970 : :
1971 : : /* G77 compatibility */
1972 : 60888 : add_sym_1 ("dtime", GFC_ISYM_DTIME, CLASS_IMPURE, ACTUAL_NO, BT_REAL,
1973 : : 4, GFC_STD_GNU, gfc_check_dtime_etime, NULL, NULL,
1974 : : x, BT_REAL, 4, REQUIRED);
1975 : :
1976 : 60888 : make_generic ("dtime", GFC_ISYM_DTIME, GFC_STD_GNU);
1977 : :
1978 : 60888 : add_sym_1 ("etime", GFC_ISYM_ETIME, CLASS_IMPURE, ACTUAL_NO, BT_REAL,
1979 : : 4, GFC_STD_GNU, gfc_check_dtime_etime, NULL, NULL,
1980 : : x, BT_REAL, 4, REQUIRED);
1981 : :
1982 : 60888 : make_generic ("etime", GFC_ISYM_ETIME, GFC_STD_GNU);
1983 : :
1984 : 60888 : add_sym_1 ("exp", GFC_ISYM_EXP, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
1985 : : gfc_check_fn_rc, gfc_simplify_exp, gfc_resolve_exp,
1986 : : x, BT_REAL, dr, REQUIRED);
1987 : :
1988 : 60888 : add_sym_1 ("dexp", GFC_ISYM_EXP, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
1989 : : gfc_check_fn_d, gfc_simplify_exp, gfc_resolve_exp,
1990 : : x, BT_REAL, dd, REQUIRED);
1991 : :
1992 : 60888 : add_sym_1 ("cexp", GFC_ISYM_EXP, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dz, GFC_STD_F77,
1993 : : NULL, gfc_simplify_exp, gfc_resolve_exp,
1994 : : x, BT_COMPLEX, dz, REQUIRED);
1995 : :
1996 : 60888 : add_sym_1 ("zexp", GFC_ISYM_EXP, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dd, GFC_STD_GNU,
1997 : : NULL, gfc_simplify_exp, gfc_resolve_exp,
1998 : : x, BT_COMPLEX, dd, REQUIRED);
1999 : :
2000 : 60888 : make_alias ("cdexp", GFC_STD_GNU);
2001 : :
2002 : 60888 : make_generic ("exp", GFC_ISYM_EXP, GFC_STD_F77);
2003 : :
2004 : 60888 : add_sym_1 ("exponent", GFC_ISYM_EXPONENT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di,
2005 : : GFC_STD_F95, gfc_check_fn_r, gfc_simplify_exponent, gfc_resolve_exponent,
2006 : : x, BT_REAL, dr, REQUIRED);
2007 : :
2008 : 60888 : make_generic ("exponent", GFC_ISYM_EXPONENT, GFC_STD_F95);
2009 : :
2010 : 60888 : add_sym_2 ("extends_type_of", GFC_ISYM_EXTENDS_TYPE_OF, CLASS_INQUIRY,
2011 : : ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F2003,
2012 : : gfc_check_same_type_as, gfc_simplify_extends_type_of,
2013 : : gfc_resolve_extends_type_of,
2014 : : a, BT_UNKNOWN, 0, REQUIRED,
2015 : : mo, BT_UNKNOWN, 0, REQUIRED);
2016 : :
2017 : 60888 : add_sym_2 ("failed_images", GFC_ISYM_FAILED_IMAGES, CLASS_TRANSFORMATIONAL,
2018 : : ACTUAL_NO, BT_INTEGER, dd, GFC_STD_F2018,
2019 : : gfc_check_failed_or_stopped_images,
2020 : : gfc_simplify_failed_or_stopped_images,
2021 : : gfc_resolve_failed_images, team, BT_VOID, di, OPTIONAL,
2022 : : kind, BT_INTEGER, di, OPTIONAL);
2023 : :
2024 : 60888 : add_sym_0 ("fdate", GFC_ISYM_FDATE, CLASS_IMPURE, ACTUAL_NO, BT_CHARACTER,
2025 : : dc, GFC_STD_GNU, NULL, NULL, gfc_resolve_fdate);
2026 : :
2027 : 60888 : make_generic ("fdate", GFC_ISYM_FDATE, GFC_STD_GNU);
2028 : :
2029 : 60888 : add_sym_2 ("floor", GFC_ISYM_FLOOR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2030 : : gfc_check_a_ikind, gfc_simplify_floor, gfc_resolve_floor,
2031 : : a, BT_REAL, dr, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
2032 : :
2033 : 60888 : make_generic ("floor", GFC_ISYM_FLOOR, GFC_STD_F95);
2034 : :
2035 : : /* G77 compatible fnum */
2036 : 60888 : add_sym_1 ("fnum", GFC_ISYM_FNUM, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2037 : : di, GFC_STD_GNU, gfc_check_fnum, NULL, gfc_resolve_fnum,
2038 : : ut, BT_INTEGER, di, REQUIRED);
2039 : :
2040 : 60888 : make_generic ("fnum", GFC_ISYM_FNUM, GFC_STD_GNU);
2041 : :
2042 : 60888 : add_sym_1 ("fraction", GFC_ISYM_FRACTION, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr,
2043 : : GFC_STD_F95, gfc_check_fn_r, gfc_simplify_fraction, gfc_resolve_fraction,
2044 : : x, BT_REAL, dr, REQUIRED);
2045 : :
2046 : 60888 : make_generic ("fraction", GFC_ISYM_FRACTION, GFC_STD_F95);
2047 : :
2048 : 60888 : add_sym_2_intent ("fstat", GFC_ISYM_FSTAT, CLASS_IMPURE, ACTUAL_NO,
2049 : : BT_INTEGER, di, GFC_STD_GNU,
2050 : : gfc_check_fstat, NULL, gfc_resolve_fstat,
2051 : : ut, BT_INTEGER, di, REQUIRED, INTENT_IN,
2052 : : vl, BT_INTEGER, di, REQUIRED, INTENT_OUT);
2053 : :
2054 : 60888 : make_generic ("fstat", GFC_ISYM_FSTAT, GFC_STD_GNU);
2055 : :
2056 : 60888 : add_sym_1 ("ftell", GFC_ISYM_FTELL, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2057 : : ii, GFC_STD_GNU, gfc_check_ftell, NULL, gfc_resolve_ftell,
2058 : : ut, BT_INTEGER, di, REQUIRED);
2059 : :
2060 : 60888 : make_generic ("ftell", GFC_ISYM_FTELL, GFC_STD_GNU);
2061 : :
2062 : 60888 : add_sym_2_intent ("fgetc", GFC_ISYM_FGETC, CLASS_IMPURE, ACTUAL_NO,
2063 : : BT_INTEGER, di, GFC_STD_GNU,
2064 : : gfc_check_fgetputc, NULL, gfc_resolve_fgetc,
2065 : : ut, BT_INTEGER, di, REQUIRED, INTENT_IN,
2066 : : c, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
2067 : :
2068 : 60888 : make_generic ("fgetc", GFC_ISYM_FGETC, GFC_STD_GNU);
2069 : :
2070 : 60888 : add_sym_1_intent ("fget", GFC_ISYM_FGET, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2071 : : di, GFC_STD_GNU, gfc_check_fgetput, NULL, gfc_resolve_fget,
2072 : : c, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
2073 : :
2074 : 60888 : make_generic ("fget", GFC_ISYM_FGET, GFC_STD_GNU);
2075 : :
2076 : 60888 : add_sym_2 ("fputc", GFC_ISYM_FPUTC, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2077 : : di, GFC_STD_GNU, gfc_check_fgetputc, NULL, gfc_resolve_fputc,
2078 : : ut, BT_INTEGER, di, REQUIRED, c, BT_CHARACTER, dc, REQUIRED);
2079 : :
2080 : 60888 : make_generic ("fputc", GFC_ISYM_FPUTC, GFC_STD_GNU);
2081 : :
2082 : 60888 : add_sym_1 ("fput", GFC_ISYM_FPUT, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2083 : : di, GFC_STD_GNU, gfc_check_fgetput, NULL, gfc_resolve_fput,
2084 : : c, BT_CHARACTER, dc, REQUIRED);
2085 : :
2086 : 60888 : make_generic ("fput", GFC_ISYM_FPUT, GFC_STD_GNU);
2087 : :
2088 : 60888 : add_sym_1 ("gamma", GFC_ISYM_TGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr,
2089 : : GFC_STD_F2008, gfc_check_fn_r, gfc_simplify_gamma,
2090 : : gfc_resolve_gamma, x, BT_REAL, dr, REQUIRED);
2091 : :
2092 : 60888 : add_sym_1 ("dgamma", GFC_ISYM_TGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
2093 : : gfc_check_fn_d, gfc_simplify_gamma, gfc_resolve_gamma,
2094 : : x, BT_REAL, dr, REQUIRED);
2095 : :
2096 : 60888 : make_generic ("gamma", GFC_ISYM_TGAMMA, GFC_STD_F2008);
2097 : :
2098 : : /* Unix IDs (g77 compatibility) */
2099 : 60888 : add_sym_1 ("getcwd", GFC_ISYM_GETCWD, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2100 : : di, GFC_STD_GNU, NULL, NULL, gfc_resolve_getcwd,
2101 : : c, BT_CHARACTER, dc, REQUIRED);
2102 : :
2103 : 60888 : make_generic ("getcwd", GFC_ISYM_GETCWD, GFC_STD_GNU);
2104 : :
2105 : 60888 : add_sym_0 ("getgid", GFC_ISYM_GETGID, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2106 : : di, GFC_STD_GNU, NULL, NULL, gfc_resolve_getgid);
2107 : :
2108 : 60888 : make_generic ("getgid", GFC_ISYM_GETGID, GFC_STD_GNU);
2109 : :
2110 : 60888 : add_sym_0 ("getpid", GFC_ISYM_GETPID, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2111 : : di, GFC_STD_GNU, NULL, NULL, gfc_resolve_getpid);
2112 : :
2113 : 60888 : make_generic ("getpid", GFC_ISYM_GETPID, GFC_STD_GNU);
2114 : :
2115 : 60888 : add_sym_1 ("get_team", GFC_ISYM_GET_TEAM, CLASS_TRANSFORMATIONAL,
2116 : : ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2018,
2117 : : gfc_check_get_team, NULL, gfc_resolve_get_team,
2118 : : level, BT_INTEGER, di, OPTIONAL);
2119 : :
2120 : 60888 : add_sym_0 ("getuid", GFC_ISYM_GETUID, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2121 : : di, GFC_STD_GNU, NULL, NULL, gfc_resolve_getuid);
2122 : :
2123 : 60888 : make_generic ("getuid", GFC_ISYM_GETUID, GFC_STD_GNU);
2124 : :
2125 : 60888 : add_sym_1_intent ("hostnm", GFC_ISYM_HOSTNM, CLASS_IMPURE, ACTUAL_NO,
2126 : : BT_INTEGER, di, GFC_STD_GNU,
2127 : : gfc_check_hostnm, NULL, gfc_resolve_hostnm,
2128 : : c, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
2129 : :
2130 : 60888 : make_generic ("hostnm", GFC_ISYM_HOSTNM, GFC_STD_GNU);
2131 : :
2132 : 60888 : add_sym_1 ("huge", GFC_ISYM_HUGE, CLASS_INQUIRY, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
2133 : : gfc_check_huge, gfc_simplify_huge, NULL,
2134 : : x, BT_UNKNOWN, dr, REQUIRED);
2135 : :
2136 : 60888 : make_generic ("huge", GFC_ISYM_HUGE, GFC_STD_F95);
2137 : :
2138 : 60888 : add_sym_2 ("hypot", GFC_ISYM_HYPOT, CLASS_ELEMENTAL, ACTUAL_NO,
2139 : : BT_REAL, dr, GFC_STD_F2008,
2140 : : gfc_check_hypot, gfc_simplify_hypot, gfc_resolve_hypot,
2141 : : x, BT_REAL, dr, REQUIRED, y, BT_REAL, dr, REQUIRED);
2142 : :
2143 : 60888 : make_generic ("hypot", GFC_ISYM_HYPOT, GFC_STD_F2008);
2144 : :
2145 : 60888 : add_sym_2 ("iachar", GFC_ISYM_IACHAR, CLASS_ELEMENTAL, ACTUAL_NO,
2146 : : BT_INTEGER, di, GFC_STD_F95,
2147 : : gfc_check_ichar_iachar, gfc_simplify_iachar, gfc_resolve_iachar,
2148 : : c, BT_CHARACTER, dc, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
2149 : :
2150 : 60888 : make_generic ("iachar", GFC_ISYM_IACHAR, GFC_STD_F95);
2151 : :
2152 : 60888 : add_sym_2 ("iand", GFC_ISYM_IAND, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di,
2153 : : GFC_STD_F95,
2154 : : gfc_check_iand_ieor_ior, gfc_simplify_iand, gfc_resolve_iand,
2155 : : i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
2156 : :
2157 : 60888 : if (flag_dec_intrinsic_ints)
2158 : : {
2159 : 400 : make_alias ("biand", GFC_STD_GNU);
2160 : 400 : make_alias ("iiand", GFC_STD_GNU);
2161 : 400 : make_alias ("jiand", GFC_STD_GNU);
2162 : 400 : make_alias ("kiand", GFC_STD_GNU);
2163 : : }
2164 : :
2165 : 60888 : make_generic ("iand", GFC_ISYM_IAND, GFC_STD_F95);
2166 : :
2167 : 60888 : add_sym_2 ("and", GFC_ISYM_AND, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
2168 : : dl, GFC_STD_GNU, gfc_check_and, gfc_simplify_and, gfc_resolve_and,
2169 : : i, BT_UNKNOWN, 0, REQUIRED, j, BT_UNKNOWN, 0, REQUIRED);
2170 : :
2171 : 60888 : make_generic ("and", GFC_ISYM_AND, GFC_STD_GNU);
2172 : :
2173 : 60888 : add_sym_3red ("iall", GFC_ISYM_IALL, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F2008,
2174 : : gfc_check_transf_bit_intrins, gfc_simplify_iall, gfc_resolve_iall,
2175 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
2176 : : msk, BT_LOGICAL, dl, OPTIONAL);
2177 : :
2178 : 60888 : make_generic ("iall", GFC_ISYM_IALL, GFC_STD_F2008);
2179 : :
2180 : 60888 : add_sym_3red ("iany", GFC_ISYM_IANY, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F2008,
2181 : : gfc_check_transf_bit_intrins, gfc_simplify_iany, gfc_resolve_iany,
2182 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
2183 : : msk, BT_LOGICAL, dl, OPTIONAL);
2184 : :
2185 : 60888 : make_generic ("iany", GFC_ISYM_IANY, GFC_STD_F2008);
2186 : :
2187 : 60888 : add_sym_0 ("iargc", GFC_ISYM_IARGC, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2188 : : di, GFC_STD_GNU, NULL, NULL, NULL);
2189 : :
2190 : 60888 : make_generic ("iargc", GFC_ISYM_IARGC, GFC_STD_GNU);
2191 : :
2192 : 60888 : add_sym_2 ("ibclr", GFC_ISYM_IBCLR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2193 : : gfc_check_bitfcn, gfc_simplify_ibclr, gfc_resolve_ibclr,
2194 : : i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED);
2195 : :
2196 : 60888 : if (flag_dec_intrinsic_ints)
2197 : : {
2198 : 400 : make_alias ("bbclr", GFC_STD_GNU);
2199 : 400 : make_alias ("iibclr", GFC_STD_GNU);
2200 : 400 : make_alias ("jibclr", GFC_STD_GNU);
2201 : 400 : make_alias ("kibclr", GFC_STD_GNU);
2202 : : }
2203 : :
2204 : 60888 : make_generic ("ibclr", GFC_ISYM_IBCLR, GFC_STD_F95);
2205 : :
2206 : 60888 : add_sym_3 ("ibits", GFC_ISYM_IBITS, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2207 : : gfc_check_ibits, gfc_simplify_ibits, gfc_resolve_ibits,
2208 : : i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED,
2209 : : ln, BT_INTEGER, di, REQUIRED);
2210 : :
2211 : 60888 : if (flag_dec_intrinsic_ints)
2212 : : {
2213 : 400 : make_alias ("bbits", GFC_STD_GNU);
2214 : 400 : make_alias ("iibits", GFC_STD_GNU);
2215 : 400 : make_alias ("jibits", GFC_STD_GNU);
2216 : 400 : make_alias ("kibits", GFC_STD_GNU);
2217 : : }
2218 : :
2219 : 60888 : make_generic ("ibits", GFC_ISYM_IBITS, GFC_STD_F95);
2220 : :
2221 : 60888 : add_sym_2 ("ibset", GFC_ISYM_IBSET, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2222 : : gfc_check_bitfcn, gfc_simplify_ibset, gfc_resolve_ibset,
2223 : : i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED);
2224 : :
2225 : 60888 : if (flag_dec_intrinsic_ints)
2226 : : {
2227 : 400 : make_alias ("bbset", GFC_STD_GNU);
2228 : 400 : make_alias ("iibset", GFC_STD_GNU);
2229 : 400 : make_alias ("jibset", GFC_STD_GNU);
2230 : 400 : make_alias ("kibset", GFC_STD_GNU);
2231 : : }
2232 : :
2233 : 60888 : make_generic ("ibset", GFC_ISYM_IBSET, GFC_STD_F95);
2234 : :
2235 : 60888 : add_sym_2 ("ichar", GFC_ISYM_ICHAR, CLASS_ELEMENTAL, ACTUAL_NO,
2236 : : BT_INTEGER, di, GFC_STD_F77,
2237 : : gfc_check_ichar_iachar, gfc_simplify_ichar, gfc_resolve_ichar,
2238 : : c, BT_CHARACTER, dc, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
2239 : :
2240 : 60888 : make_generic ("ichar", GFC_ISYM_ICHAR, GFC_STD_F77);
2241 : :
2242 : 60888 : add_sym_2 ("ieor", GFC_ISYM_IEOR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di,
2243 : : GFC_STD_F95,
2244 : : gfc_check_iand_ieor_ior, gfc_simplify_ieor, gfc_resolve_ieor,
2245 : : i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
2246 : :
2247 : 60888 : if (flag_dec_intrinsic_ints)
2248 : : {
2249 : 400 : make_alias ("bieor", GFC_STD_GNU);
2250 : 400 : make_alias ("iieor", GFC_STD_GNU);
2251 : 400 : make_alias ("jieor", GFC_STD_GNU);
2252 : 400 : make_alias ("kieor", GFC_STD_GNU);
2253 : : }
2254 : :
2255 : 60888 : make_generic ("ieor", GFC_ISYM_IEOR, GFC_STD_F95);
2256 : :
2257 : 60888 : add_sym_2 ("xor", GFC_ISYM_XOR, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
2258 : : dl, GFC_STD_GNU, gfc_check_and, gfc_simplify_xor, gfc_resolve_xor,
2259 : : i, BT_UNKNOWN, 0, REQUIRED, j, BT_UNKNOWN, 0, REQUIRED);
2260 : :
2261 : 60888 : make_generic ("xor", GFC_ISYM_XOR, GFC_STD_GNU);
2262 : :
2263 : 60888 : add_sym_0 ("ierrno", GFC_ISYM_IERRNO, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2264 : : di, GFC_STD_GNU, NULL, NULL, gfc_resolve_ierrno);
2265 : :
2266 : 60888 : make_generic ("ierrno", GFC_ISYM_IERRNO, GFC_STD_GNU);
2267 : :
2268 : 60888 : add_sym_2 ("image_index", GFC_ISYM_IMAGE_INDEX, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008,
2269 : : gfc_check_image_index, gfc_simplify_image_index, gfc_resolve_image_index,
2270 : : ca, BT_REAL, dr, REQUIRED, sub, BT_INTEGER, ii, REQUIRED);
2271 : :
2272 : 60888 : add_sym_2 ("image_status", GFC_ISYM_IMAGE_STATUS, CLASS_ELEMENTAL, ACTUAL_NO,
2273 : : BT_INTEGER, di, GFC_STD_F2018, gfc_check_image_status,
2274 : : gfc_simplify_image_status, gfc_resolve_image_status, image,
2275 : : BT_INTEGER, di, REQUIRED, team, BT_VOID, di, OPTIONAL);
2276 : :
2277 : : /* The resolution function for INDEX is called gfc_resolve_index_func
2278 : : because the name gfc_resolve_index is already used in resolve.cc. */
2279 : 60888 : add_sym_4 ("index", GFC_ISYM_INDEX, CLASS_ELEMENTAL, ACTUAL_YES,
2280 : : BT_INTEGER, di, GFC_STD_F77,
2281 : : gfc_check_index, gfc_simplify_index, gfc_resolve_index_func,
2282 : : stg, BT_CHARACTER, dc, REQUIRED, ssg, BT_CHARACTER, dc, REQUIRED,
2283 : : bck, BT_LOGICAL, dl, OPTIONAL, kind, BT_INTEGER, di, OPTIONAL);
2284 : :
2285 : 60888 : make_generic ("index", GFC_ISYM_INDEX, GFC_STD_F77);
2286 : :
2287 : 60888 : add_sym_2 ("int", GFC_ISYM_INT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F77,
2288 : : gfc_check_int, gfc_simplify_int, gfc_resolve_int,
2289 : : a, BT_REAL, dr, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
2290 : :
2291 : 60888 : add_sym_1 ("ifix", GFC_ISYM_INT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F77,
2292 : : NULL, gfc_simplify_ifix, NULL,
2293 : : a, BT_REAL, dr, REQUIRED);
2294 : :
2295 : 60888 : add_sym_1 ("idint", GFC_ISYM_INT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F77,
2296 : : NULL, gfc_simplify_idint, NULL,
2297 : : a, BT_REAL, dd, REQUIRED);
2298 : :
2299 : 60888 : make_generic ("int", GFC_ISYM_INT, GFC_STD_F77);
2300 : :
2301 : 60888 : add_sym_1 ("int2", GFC_ISYM_INT2, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_GNU,
2302 : : gfc_check_intconv, gfc_simplify_int2, gfc_resolve_int2,
2303 : : a, BT_REAL, dr, REQUIRED);
2304 : :
2305 : 60888 : make_alias ("short", GFC_STD_GNU);
2306 : :
2307 : 60888 : make_generic ("int2", GFC_ISYM_INT2, GFC_STD_GNU);
2308 : :
2309 : 60888 : add_sym_1 ("int8", GFC_ISYM_INT8, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_GNU,
2310 : : gfc_check_intconv, gfc_simplify_int8, gfc_resolve_int8,
2311 : : a, BT_REAL, dr, REQUIRED);
2312 : :
2313 : 60888 : make_generic ("int8", GFC_ISYM_INT8, GFC_STD_GNU);
2314 : :
2315 : 60888 : add_sym_1 ("long", GFC_ISYM_LONG, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_GNU,
2316 : : gfc_check_intconv, gfc_simplify_long, gfc_resolve_long,
2317 : : a, BT_REAL, dr, REQUIRED);
2318 : :
2319 : 60888 : make_generic ("long", GFC_ISYM_LONG, GFC_STD_GNU);
2320 : :
2321 : 60888 : add_sym_2 ("uint", GFC_ISYM_UINT, CLASS_ELEMENTAL, ACTUAL_NO, BT_UNSIGNED,
2322 : : di, GFC_STD_UNSIGNED, gfc_check_uint, gfc_simplify_uint,
2323 : : gfc_resolve_uint, a, BT_REAL, dr, REQUIRED, kind, BT_INTEGER, di,
2324 : : OPTIONAL);
2325 : :
2326 : 60888 : make_generic ("uint", GFC_ISYM_UINT, GFC_STD_GNU);
2327 : :
2328 : 60888 : add_sym_2 ("ior", GFC_ISYM_IOR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di,
2329 : : GFC_STD_F95,
2330 : : gfc_check_iand_ieor_ior, gfc_simplify_ior, gfc_resolve_ior,
2331 : : i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
2332 : :
2333 : 60888 : if (flag_dec_intrinsic_ints)
2334 : : {
2335 : 400 : make_alias ("bior", GFC_STD_GNU);
2336 : 400 : make_alias ("iior", GFC_STD_GNU);
2337 : 400 : make_alias ("jior", GFC_STD_GNU);
2338 : 400 : make_alias ("kior", GFC_STD_GNU);
2339 : : }
2340 : :
2341 : 60888 : make_generic ("ior", GFC_ISYM_IOR, GFC_STD_F95);
2342 : :
2343 : 60888 : add_sym_2 ("or", GFC_ISYM_OR, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
2344 : : dl, GFC_STD_GNU, gfc_check_and, gfc_simplify_or, gfc_resolve_or,
2345 : : i, BT_UNKNOWN, 0, REQUIRED, j, BT_UNKNOWN, 0, REQUIRED);
2346 : :
2347 : 60888 : make_generic ("or", GFC_ISYM_OR, GFC_STD_GNU);
2348 : :
2349 : 60888 : add_sym_3red ("iparity", GFC_ISYM_IPARITY, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F2008,
2350 : : gfc_check_transf_bit_intrins, gfc_simplify_iparity, gfc_resolve_iparity,
2351 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
2352 : : msk, BT_LOGICAL, dl, OPTIONAL);
2353 : :
2354 : 60888 : make_generic ("iparity", GFC_ISYM_IPARITY, GFC_STD_F2008);
2355 : :
2356 : : /* The following function is for G77 compatibility. */
2357 : 60888 : add_sym_1 ("irand", GFC_ISYM_IRAND, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2358 : : 4, GFC_STD_GNU, gfc_check_irand, NULL, NULL,
2359 : : i, BT_INTEGER, 4, OPTIONAL);
2360 : :
2361 : 60888 : make_generic ("irand", GFC_ISYM_IRAND, GFC_STD_GNU);
2362 : :
2363 : 60888 : add_sym_1 ("isatty", GFC_ISYM_ISATTY, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
2364 : : dl, GFC_STD_GNU, gfc_check_isatty, NULL, gfc_resolve_isatty,
2365 : : ut, BT_INTEGER, di, REQUIRED);
2366 : :
2367 : 60888 : make_generic ("isatty", GFC_ISYM_ISATTY, GFC_STD_GNU);
2368 : :
2369 : 60888 : add_sym_1 ("is_contiguous", GFC_ISYM_IS_CONTIGUOUS, CLASS_INQUIRY, ACTUAL_NO,
2370 : : BT_LOGICAL, dl, GFC_STD_F2008,
2371 : : gfc_check_is_contiguous, gfc_simplify_is_contiguous,
2372 : : gfc_resolve_is_contiguous,
2373 : : ar, BT_REAL, dr, REQUIRED);
2374 : :
2375 : 60888 : make_generic ("is_contiguous", GFC_ISYM_IS_CONTIGUOUS, GFC_STD_F2008);
2376 : :
2377 : 60888 : add_sym_1 ("is_iostat_end", GFC_ISYM_IS_IOSTAT_END,
2378 : : CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F2003,
2379 : : gfc_check_i, gfc_simplify_is_iostat_end, NULL,
2380 : : i, BT_INTEGER, 0, REQUIRED);
2381 : :
2382 : 60888 : make_generic ("is_iostat_end", GFC_ISYM_IS_IOSTAT_END, GFC_STD_F2003);
2383 : :
2384 : 60888 : add_sym_1 ("is_iostat_eor", GFC_ISYM_IS_IOSTAT_EOR,
2385 : : CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F2003,
2386 : : gfc_check_i, gfc_simplify_is_iostat_eor, NULL,
2387 : : i, BT_INTEGER, 0, REQUIRED);
2388 : :
2389 : 60888 : make_generic ("is_iostat_eor", GFC_ISYM_IS_IOSTAT_EOR, GFC_STD_F2003);
2390 : :
2391 : 60888 : add_sym_1 ("isnan", GFC_ISYM_ISNAN, CLASS_ELEMENTAL, ACTUAL_NO,
2392 : : BT_LOGICAL, dl, GFC_STD_GNU,
2393 : : gfc_check_isnan, gfc_simplify_isnan, NULL,
2394 : : x, BT_REAL, 0, REQUIRED);
2395 : :
2396 : 60888 : make_generic ("isnan", GFC_ISYM_ISNAN, GFC_STD_GNU);
2397 : :
2398 : 60888 : add_sym_2 ("rshift", GFC_ISYM_RSHIFT, CLASS_ELEMENTAL, ACTUAL_NO,
2399 : : BT_INTEGER, di, GFC_STD_GNU,
2400 : : gfc_check_ishft, gfc_simplify_rshift, gfc_resolve_rshift,
2401 : : i, BT_INTEGER, di, REQUIRED, sh, BT_INTEGER, di, REQUIRED);
2402 : :
2403 : 60888 : make_generic ("rshift", GFC_ISYM_RSHIFT, GFC_STD_GNU);
2404 : :
2405 : 60888 : add_sym_2 ("lshift", GFC_ISYM_LSHIFT, CLASS_ELEMENTAL, ACTUAL_NO,
2406 : : BT_INTEGER, di, GFC_STD_GNU,
2407 : : gfc_check_ishft, gfc_simplify_lshift, gfc_resolve_lshift,
2408 : : i, BT_INTEGER, di, REQUIRED, sh, BT_INTEGER, di, REQUIRED);
2409 : :
2410 : 60888 : make_generic ("lshift", GFC_ISYM_LSHIFT, GFC_STD_GNU);
2411 : :
2412 : 60888 : add_sym_2 ("ishft", GFC_ISYM_ISHFT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2413 : : gfc_check_ishft, gfc_simplify_ishft, gfc_resolve_ishft,
2414 : : i, BT_INTEGER, di, REQUIRED, sh, BT_INTEGER, di, REQUIRED);
2415 : :
2416 : 60888 : if (flag_dec_intrinsic_ints)
2417 : : {
2418 : 400 : make_alias ("bshft", GFC_STD_GNU);
2419 : 400 : make_alias ("iishft", GFC_STD_GNU);
2420 : 400 : make_alias ("jishft", GFC_STD_GNU);
2421 : 400 : make_alias ("kishft", GFC_STD_GNU);
2422 : : }
2423 : :
2424 : 60888 : make_generic ("ishft", GFC_ISYM_ISHFT, GFC_STD_F95);
2425 : :
2426 : 60888 : add_sym_3 ("ishftc", GFC_ISYM_ISHFTC, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2427 : : gfc_check_ishftc, gfc_simplify_ishftc, gfc_resolve_ishftc,
2428 : : i, BT_INTEGER, di, REQUIRED, sh, BT_INTEGER, di, REQUIRED,
2429 : : sz, BT_INTEGER, di, OPTIONAL);
2430 : :
2431 : 60888 : if (flag_dec_intrinsic_ints)
2432 : : {
2433 : 400 : make_alias ("bshftc", GFC_STD_GNU);
2434 : 400 : make_alias ("iishftc", GFC_STD_GNU);
2435 : 400 : make_alias ("jishftc", GFC_STD_GNU);
2436 : 400 : make_alias ("kishftc", GFC_STD_GNU);
2437 : : }
2438 : :
2439 : 60888 : make_generic ("ishftc", GFC_ISYM_ISHFTC, GFC_STD_F95);
2440 : :
2441 : 60888 : add_sym_2 ("kill", GFC_ISYM_KILL, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2442 : : di, GFC_STD_GNU, gfc_check_kill, NULL, NULL,
2443 : : pid, BT_INTEGER, di, REQUIRED, sig, BT_INTEGER, di, REQUIRED);
2444 : :
2445 : 60888 : make_generic ("kill", GFC_ISYM_KILL, GFC_STD_GNU);
2446 : :
2447 : 60888 : add_sym_1 ("kind", GFC_ISYM_KIND, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2448 : : gfc_check_kind, gfc_simplify_kind, NULL,
2449 : : x, BT_REAL, dr, REQUIRED);
2450 : :
2451 : 60888 : make_generic ("kind", GFC_ISYM_KIND, GFC_STD_F95);
2452 : :
2453 : 60888 : add_sym_3 ("lbound", GFC_ISYM_LBOUND, CLASS_INQUIRY, ACTUAL_NO,
2454 : : BT_INTEGER, di, GFC_STD_F95,
2455 : : gfc_check_lbound, gfc_simplify_lbound, gfc_resolve_lbound,
2456 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, di, OPTIONAL,
2457 : : kind, BT_INTEGER, di, OPTIONAL);
2458 : :
2459 : 60888 : make_generic ("lbound", GFC_ISYM_LBOUND, GFC_STD_F95);
2460 : :
2461 : 60888 : add_sym_3 ("lcobound", GFC_ISYM_LCOBOUND, CLASS_INQUIRY, ACTUAL_NO,
2462 : : BT_INTEGER, di, GFC_STD_F2008,
2463 : : gfc_check_lcobound, gfc_simplify_lcobound, gfc_resolve_lcobound,
2464 : : ca, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
2465 : : kind, BT_INTEGER, di, OPTIONAL);
2466 : :
2467 : 60888 : make_generic ("lcobound", GFC_ISYM_LCOBOUND, GFC_STD_F2008);
2468 : :
2469 : 60888 : add_sym_1 ("leadz", GFC_ISYM_LEADZ, CLASS_ELEMENTAL, ACTUAL_NO,
2470 : : BT_INTEGER, di, GFC_STD_F2008,
2471 : : gfc_check_i, gfc_simplify_leadz, NULL,
2472 : : i, BT_INTEGER, di, REQUIRED);
2473 : :
2474 : 60888 : make_generic ("leadz", GFC_ISYM_LEADZ, GFC_STD_F2008);
2475 : :
2476 : 60888 : add_sym_2 ("len", GFC_ISYM_LEN, CLASS_INQUIRY, ACTUAL_YES,
2477 : : BT_INTEGER, di, GFC_STD_F77,
2478 : : gfc_check_len_lentrim, gfc_simplify_len, gfc_resolve_len,
2479 : : stg, BT_CHARACTER, dc, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
2480 : :
2481 : 60888 : make_generic ("len", GFC_ISYM_LEN, GFC_STD_F77);
2482 : :
2483 : 60888 : add_sym_2 ("len_trim", GFC_ISYM_LEN_TRIM, CLASS_ELEMENTAL, ACTUAL_NO,
2484 : : BT_INTEGER, di, GFC_STD_F95,
2485 : : gfc_check_len_lentrim, gfc_simplify_len_trim, gfc_resolve_len_trim,
2486 : : stg, BT_CHARACTER, dc, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
2487 : :
2488 : 60888 : make_alias ("lnblnk", GFC_STD_GNU);
2489 : :
2490 : 60888 : make_generic ("len_trim", GFC_ISYM_LEN_TRIM, GFC_STD_F95);
2491 : :
2492 : 60888 : add_sym_1 ("lgamma", GFC_ISYM_LGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL,
2493 : : dr, GFC_STD_GNU,
2494 : : gfc_check_fn_r, gfc_simplify_lgamma, gfc_resolve_lgamma,
2495 : : x, BT_REAL, dr, REQUIRED);
2496 : :
2497 : 60888 : make_alias ("log_gamma", GFC_STD_F2008);
2498 : :
2499 : 60888 : add_sym_1 ("algama", GFC_ISYM_LGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
2500 : : gfc_check_fn_r, gfc_simplify_lgamma, gfc_resolve_lgamma,
2501 : : x, BT_REAL, dr, REQUIRED);
2502 : :
2503 : 60888 : add_sym_1 ("dlgama", GFC_ISYM_LGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
2504 : : gfc_check_fn_d, gfc_simplify_lgamma, gfc_resolve_lgamma,
2505 : : x, BT_REAL, dr, REQUIRED);
2506 : :
2507 : 60888 : make_generic ("log_gamma", GFC_ISYM_LGAMMA, GFC_STD_F2008);
2508 : :
2509 : :
2510 : 60888 : add_sym_2 ("lge", GFC_ISYM_LGE, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl,
2511 : : GFC_STD_F77, gfc_check_lge_lgt_lle_llt, gfc_simplify_lge, NULL,
2512 : : sta, BT_CHARACTER, dc, REQUIRED, stb, BT_CHARACTER, dc, REQUIRED);
2513 : :
2514 : 60888 : make_generic ("lge", GFC_ISYM_LGE, GFC_STD_F77);
2515 : :
2516 : 60888 : add_sym_2 ("lgt", GFC_ISYM_LGT, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl,
2517 : : GFC_STD_F77, gfc_check_lge_lgt_lle_llt, gfc_simplify_lgt, NULL,
2518 : : sta, BT_CHARACTER, dc, REQUIRED, stb, BT_CHARACTER, dc, REQUIRED);
2519 : :
2520 : 60888 : make_generic ("lgt", GFC_ISYM_LGT, GFC_STD_F77);
2521 : :
2522 : 60888 : add_sym_2 ("lle",GFC_ISYM_LLE, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl,
2523 : : GFC_STD_F77, gfc_check_lge_lgt_lle_llt, gfc_simplify_lle, NULL,
2524 : : sta, BT_CHARACTER, dc, REQUIRED, stb, BT_CHARACTER, dc, REQUIRED);
2525 : :
2526 : 60888 : make_generic ("lle", GFC_ISYM_LLE, GFC_STD_F77);
2527 : :
2528 : 60888 : add_sym_2 ("llt", GFC_ISYM_LLT, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl,
2529 : : GFC_STD_F77, gfc_check_lge_lgt_lle_llt, gfc_simplify_llt, NULL,
2530 : : sta, BT_CHARACTER, dc, REQUIRED, stb, BT_CHARACTER, dc, REQUIRED);
2531 : :
2532 : 60888 : make_generic ("llt", GFC_ISYM_LLT, GFC_STD_F77);
2533 : :
2534 : 60888 : add_sym_2 ("link", GFC_ISYM_LINK, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, di,
2535 : : GFC_STD_GNU, gfc_check_link, NULL, gfc_resolve_link,
2536 : : p1, BT_CHARACTER, dc, REQUIRED, p2, BT_CHARACTER, dc, REQUIRED);
2537 : :
2538 : 60888 : make_generic ("link", GFC_ISYM_LINK, GFC_STD_GNU);
2539 : :
2540 : 60888 : add_sym_1 ("log", GFC_ISYM_LOG, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77,
2541 : : gfc_check_fn_rc, gfc_simplify_log, gfc_resolve_log,
2542 : : x, BT_REAL, dr, REQUIRED);
2543 : :
2544 : 60888 : add_sym_1 ("alog", GFC_ISYM_LOG, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
2545 : : NULL, gfc_simplify_log, gfc_resolve_log,
2546 : : x, BT_REAL, dr, REQUIRED);
2547 : :
2548 : 60888 : add_sym_1 ("dlog", GFC_ISYM_LOG, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
2549 : : gfc_check_fn_d, gfc_simplify_log, gfc_resolve_log,
2550 : : x, BT_REAL, dd, REQUIRED);
2551 : :
2552 : 60888 : add_sym_1 ("clog", GFC_ISYM_LOG, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dz, GFC_STD_F77,
2553 : : NULL, gfc_simplify_log, gfc_resolve_log,
2554 : : x, BT_COMPLEX, dz, REQUIRED);
2555 : :
2556 : 60888 : add_sym_1 ("zlog", GFC_ISYM_LOG, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dd, GFC_STD_GNU,
2557 : : NULL, gfc_simplify_log, gfc_resolve_log,
2558 : : x, BT_COMPLEX, dd, REQUIRED);
2559 : :
2560 : 60888 : make_alias ("cdlog", GFC_STD_GNU);
2561 : :
2562 : 60888 : make_generic ("log", GFC_ISYM_LOG, GFC_STD_F77);
2563 : :
2564 : 60888 : add_sym_1 ("log10", GFC_ISYM_LOG10, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77,
2565 : : gfc_check_fn_r, gfc_simplify_log10, gfc_resolve_log10,
2566 : : x, BT_REAL, dr, REQUIRED);
2567 : :
2568 : 60888 : add_sym_1 ("alog10", GFC_ISYM_LOG10, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
2569 : : NULL, gfc_simplify_log10, gfc_resolve_log10,
2570 : : x, BT_REAL, dr, REQUIRED);
2571 : :
2572 : 60888 : add_sym_1 ("dlog10", GFC_ISYM_LOG10, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
2573 : : gfc_check_fn_d, gfc_simplify_log10, gfc_resolve_log10,
2574 : : x, BT_REAL, dd, REQUIRED);
2575 : :
2576 : 60888 : make_generic ("log10", GFC_ISYM_LOG10, GFC_STD_F77);
2577 : :
2578 : 60888 : add_sym_2 ("logical", GFC_ISYM_LOGICAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F95,
2579 : : gfc_check_logical, gfc_simplify_logical, gfc_resolve_logical,
2580 : : l, BT_LOGICAL, dl, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
2581 : :
2582 : 60888 : make_generic ("logical", GFC_ISYM_LOGICAL, GFC_STD_F95);
2583 : :
2584 : 60888 : add_sym_2_intent ("lstat", GFC_ISYM_LSTAT, CLASS_IMPURE, ACTUAL_NO,
2585 : : BT_INTEGER, di, GFC_STD_GNU,
2586 : : gfc_check_stat, NULL, gfc_resolve_lstat,
2587 : : nm, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
2588 : : vl, BT_INTEGER, di, REQUIRED, INTENT_OUT);
2589 : :
2590 : 60888 : make_generic ("lstat", GFC_ISYM_LSTAT, GFC_STD_GNU);
2591 : :
2592 : 60888 : add_sym_1 ("malloc", GFC_ISYM_MALLOC, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, ii,
2593 : : GFC_STD_GNU, gfc_check_malloc, NULL, NULL,
2594 : : sz, BT_INTEGER, di, REQUIRED);
2595 : :
2596 : 60888 : make_generic ("malloc", GFC_ISYM_MALLOC, GFC_STD_GNU);
2597 : :
2598 : 60888 : add_sym_2 ("maskl", GFC_ISYM_MASKL, CLASS_ELEMENTAL, ACTUAL_NO,
2599 : : BT_INTEGER, di, GFC_STD_F2008,
2600 : : gfc_check_mask, gfc_simplify_maskl, gfc_resolve_mask,
2601 : : i, BT_INTEGER, di, REQUIRED,
2602 : : kind, BT_INTEGER, di, OPTIONAL);
2603 : :
2604 : 60888 : make_generic ("maskl", GFC_ISYM_MASKL, GFC_STD_F2008);
2605 : :
2606 : 60888 : add_sym_2 ("maskr", GFC_ISYM_MASKR, CLASS_ELEMENTAL, ACTUAL_NO,
2607 : : BT_INTEGER, di, GFC_STD_F2008,
2608 : : gfc_check_mask, gfc_simplify_maskr, gfc_resolve_mask,
2609 : : i, BT_INTEGER, di, REQUIRED,
2610 : : kind, BT_INTEGER, di, OPTIONAL);
2611 : :
2612 : 60888 : make_generic ("maskr", GFC_ISYM_MASKR, GFC_STD_F2008);
2613 : :
2614 : 60888 : add_sym_2 ("umaskl", GFC_ISYM_UMASKL, CLASS_ELEMENTAL, ACTUAL_NO,
2615 : : BT_INTEGER, di, GFC_STD_F2008,
2616 : : gfc_check_mask, gfc_simplify_umaskl, gfc_resolve_umasklr,
2617 : : i, BT_INTEGER, di, REQUIRED,
2618 : : kind, BT_INTEGER, di, OPTIONAL);
2619 : :
2620 : 60888 : make_generic ("umaskl", GFC_ISYM_UMASKL, GFC_STD_F2008);
2621 : :
2622 : 60888 : add_sym_2 ("umaskr", GFC_ISYM_UMASKR, CLASS_ELEMENTAL, ACTUAL_NO,
2623 : : BT_INTEGER, di, GFC_STD_F2008,
2624 : : gfc_check_mask, gfc_simplify_umaskr, gfc_resolve_umasklr,
2625 : : i, BT_INTEGER, di, REQUIRED,
2626 : : kind, BT_INTEGER, di, OPTIONAL);
2627 : :
2628 : 60888 : make_generic ("umaskr", GFC_ISYM_UMASKR, GFC_STD_F2008);
2629 : :
2630 : 60888 : add_sym_2 ("matmul", GFC_ISYM_MATMUL, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
2631 : : gfc_check_matmul, gfc_simplify_matmul, gfc_resolve_matmul,
2632 : : ma, BT_REAL, dr, REQUIRED, mb, BT_REAL, dr, REQUIRED);
2633 : :
2634 : 60888 : make_generic ("matmul", GFC_ISYM_MATMUL, GFC_STD_F95);
2635 : :
2636 : : /* Note: amax0 is equivalent to real(max), max1 is equivalent to
2637 : : int(max). The max function must take at least two arguments. */
2638 : :
2639 : 60888 : add_sym_1m ("max", GFC_ISYM_MAX, CLASS_ELEMENTAL, ACTUAL_NO, BT_UNKNOWN, 0, GFC_STD_F77,
2640 : : gfc_check_min_max, gfc_simplify_max, gfc_resolve_max,
2641 : : a1, BT_UNKNOWN, dr, REQUIRED, a2, BT_UNKNOWN, dr, REQUIRED);
2642 : :
2643 : 60888 : add_sym_1m ("max0", GFC_ISYM_MAX, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F77,
2644 : : gfc_check_min_max_integer, gfc_simplify_max, NULL,
2645 : : a1, BT_INTEGER, di, REQUIRED, a2, BT_INTEGER, di, REQUIRED);
2646 : :
2647 : 60888 : add_sym_1m ("amax0", GFC_ISYM_MAX, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77,
2648 : : gfc_check_min_max_integer, gfc_simplify_max, NULL,
2649 : : a1, BT_INTEGER, di, REQUIRED, a2, BT_INTEGER, di, REQUIRED);
2650 : :
2651 : 60888 : add_sym_1m ("amax1", GFC_ISYM_MAX, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77,
2652 : : gfc_check_min_max_real, gfc_simplify_max, NULL,
2653 : : a1, BT_REAL, dr, REQUIRED, a2, BT_REAL, dr, REQUIRED);
2654 : :
2655 : 60888 : add_sym_1m ("max1", GFC_ISYM_MAX, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F77,
2656 : : gfc_check_min_max_real, gfc_simplify_max, NULL,
2657 : : a1, BT_REAL, dr, REQUIRED, a2, BT_REAL, dr, REQUIRED);
2658 : :
2659 : 60888 : add_sym_1m ("dmax1", GFC_ISYM_MAX, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_F77,
2660 : : gfc_check_min_max_double, gfc_simplify_max, NULL,
2661 : : a1, BT_REAL, dd, REQUIRED, a2, BT_REAL, dd, REQUIRED);
2662 : :
2663 : 60888 : make_generic ("max", GFC_ISYM_MAX, GFC_STD_F77);
2664 : :
2665 : 60888 : add_sym_1 ("maxexponent", GFC_ISYM_MAXEXPONENT, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER,
2666 : : di, GFC_STD_F95, gfc_check_fn_r, gfc_simplify_maxexponent, NULL,
2667 : : x, BT_UNKNOWN, dr, REQUIRED);
2668 : :
2669 : 60888 : make_generic ("maxexponent", GFC_ISYM_MAXEXPONENT, GFC_STD_F95);
2670 : :
2671 : 60888 : add_sym_5ml ("maxloc", GFC_ISYM_MAXLOC, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2672 : : gfc_check_minloc_maxloc, gfc_simplify_maxloc, gfc_resolve_maxloc,
2673 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
2674 : : msk, BT_LOGICAL, dl, OPTIONAL, kind, BT_INTEGER, di, OPTIONAL,
2675 : : bck, BT_LOGICAL, dl, OPTIONAL);
2676 : :
2677 : 60888 : make_generic ("maxloc", GFC_ISYM_MAXLOC, GFC_STD_F95);
2678 : :
2679 : 60888 : add_sym_6fl ("findloc", GFC_ISYM_FINDLOC, CLASS_TRANSFORMATIONAL, ACTUAL_NO,
2680 : : BT_INTEGER, di, GFC_STD_F2008,
2681 : : gfc_check_findloc, gfc_simplify_findloc, gfc_resolve_findloc,
2682 : : ar, BT_REAL, dr, REQUIRED, val, BT_REAL, dr, REQUIRED,
2683 : : dm, BT_INTEGER, ii, OPTIONAL, msk, BT_LOGICAL, dl, OPTIONAL,
2684 : : kind, BT_INTEGER, di, OPTIONAL, bck, BT_LOGICAL, dl, OPTIONAL);
2685 : :
2686 : 60888 : make_generic ("findloc", GFC_ISYM_FINDLOC, GFC_STD_F2008);
2687 : :
2688 : 60888 : add_sym_3red ("maxval", GFC_ISYM_MAXVAL, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
2689 : : gfc_check_minval_maxval, gfc_simplify_maxval, gfc_resolve_maxval,
2690 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
2691 : : msk, BT_LOGICAL, dl, OPTIONAL);
2692 : :
2693 : 60888 : make_generic ("maxval", GFC_ISYM_MAXVAL, GFC_STD_F95);
2694 : :
2695 : 60888 : add_sym_0 ("mclock", GFC_ISYM_MCLOCK, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, di,
2696 : : GFC_STD_GNU, NULL, NULL, gfc_resolve_mclock);
2697 : :
2698 : 60888 : make_generic ("mclock", GFC_ISYM_MCLOCK, GFC_STD_GNU);
2699 : :
2700 : 60888 : add_sym_0 ("mclock8", GFC_ISYM_MCLOCK8, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
2701 : : di, GFC_STD_GNU, NULL, NULL, gfc_resolve_mclock8);
2702 : :
2703 : 60888 : make_generic ("mclock8", GFC_ISYM_MCLOCK8, GFC_STD_GNU);
2704 : :
2705 : 60888 : add_sym_3 ("merge", GFC_ISYM_MERGE, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
2706 : : gfc_check_merge, gfc_simplify_merge, gfc_resolve_merge,
2707 : : ts, BT_REAL, dr, REQUIRED, fs, BT_REAL, dr, REQUIRED,
2708 : : msk, BT_LOGICAL, dl, REQUIRED);
2709 : :
2710 : 60888 : make_generic ("merge", GFC_ISYM_MERGE, GFC_STD_F95);
2711 : :
2712 : 60888 : add_sym_3 ("merge_bits", GFC_ISYM_MERGE_BITS, CLASS_ELEMENTAL, ACTUAL_NO,
2713 : : BT_INTEGER, di, GFC_STD_F2008,
2714 : : gfc_check_merge_bits, gfc_simplify_merge_bits,
2715 : : gfc_resolve_merge_bits,
2716 : : i, BT_INTEGER, di, REQUIRED,
2717 : : j, BT_INTEGER, di, REQUIRED,
2718 : : msk, BT_INTEGER, di, REQUIRED);
2719 : :
2720 : 60888 : make_generic ("merge_bits", GFC_ISYM_MERGE_BITS, GFC_STD_F2008);
2721 : :
2722 : : /* Note: amin0 is equivalent to real(min), min1 is equivalent to
2723 : : int(min). */
2724 : :
2725 : 60888 : add_sym_1m ("min", GFC_ISYM_MIN, CLASS_ELEMENTAL, ACTUAL_NO, BT_UNKNOWN, 0, GFC_STD_F77,
2726 : : gfc_check_min_max, gfc_simplify_min, gfc_resolve_min,
2727 : : a1, BT_REAL, dr, REQUIRED, a2, BT_REAL, dr, REQUIRED);
2728 : :
2729 : 60888 : add_sym_1m ("min0", GFC_ISYM_MIN, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F77,
2730 : : gfc_check_min_max_integer, gfc_simplify_min, NULL,
2731 : : a1, BT_INTEGER, di, REQUIRED, a2, BT_INTEGER, di, REQUIRED);
2732 : :
2733 : 60888 : add_sym_1m ("amin0", GFC_ISYM_MIN, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77,
2734 : : gfc_check_min_max_integer, gfc_simplify_min, NULL,
2735 : : a1, BT_INTEGER, di, REQUIRED, a2, BT_INTEGER, di, REQUIRED);
2736 : :
2737 : 60888 : add_sym_1m ("amin1", GFC_ISYM_MIN, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77,
2738 : : gfc_check_min_max_real, gfc_simplify_min, NULL,
2739 : : a1, BT_REAL, dr, REQUIRED, a2, BT_REAL, dr, REQUIRED);
2740 : :
2741 : 60888 : add_sym_1m ("min1", GFC_ISYM_MIN, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F77,
2742 : : gfc_check_min_max_real, gfc_simplify_min, NULL,
2743 : : a1, BT_REAL, dr, REQUIRED, a2, BT_REAL, dr, REQUIRED);
2744 : :
2745 : 60888 : add_sym_1m ("dmin1", GFC_ISYM_MIN, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_F77,
2746 : : gfc_check_min_max_double, gfc_simplify_min, NULL,
2747 : : a1, BT_REAL, dd, REQUIRED, a2, BT_REAL, dd, REQUIRED);
2748 : :
2749 : 60888 : make_generic ("min", GFC_ISYM_MIN, GFC_STD_F77);
2750 : :
2751 : 60888 : add_sym_1 ("minexponent", GFC_ISYM_MINEXPONENT, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER,
2752 : : di, GFC_STD_F95, gfc_check_fn_r, gfc_simplify_minexponent, NULL,
2753 : : x, BT_UNKNOWN, dr, REQUIRED);
2754 : :
2755 : 60888 : make_generic ("minexponent", GFC_ISYM_MINEXPONENT, GFC_STD_F95);
2756 : :
2757 : 60888 : add_sym_5ml ("minloc", GFC_ISYM_MINLOC, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2758 : : gfc_check_minloc_maxloc, gfc_simplify_minloc, gfc_resolve_minloc,
2759 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
2760 : : msk, BT_LOGICAL, dl, OPTIONAL, kind, BT_INTEGER, di, OPTIONAL,
2761 : : bck, BT_LOGICAL, dl, OPTIONAL);
2762 : :
2763 : 60888 : make_generic ("minloc", GFC_ISYM_MINLOC, GFC_STD_F95);
2764 : :
2765 : 60888 : add_sym_3red ("minval", GFC_ISYM_MINVAL, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
2766 : : gfc_check_minval_maxval, gfc_simplify_minval, gfc_resolve_minval,
2767 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
2768 : : msk, BT_LOGICAL, dl, OPTIONAL);
2769 : :
2770 : 60888 : make_generic ("minval", GFC_ISYM_MINVAL, GFC_STD_F95);
2771 : :
2772 : 60888 : add_sym_2 ("mod", GFC_ISYM_MOD, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER, di, GFC_STD_F77,
2773 : : gfc_check_mod, gfc_simplify_mod, gfc_resolve_mod,
2774 : : a, BT_INTEGER, di, REQUIRED, p, BT_INTEGER, di, REQUIRED);
2775 : :
2776 : 60888 : if (flag_dec_intrinsic_ints)
2777 : : {
2778 : 400 : make_alias ("bmod", GFC_STD_GNU);
2779 : 400 : make_alias ("imod", GFC_STD_GNU);
2780 : 400 : make_alias ("jmod", GFC_STD_GNU);
2781 : 400 : make_alias ("kmod", GFC_STD_GNU);
2782 : : }
2783 : :
2784 : 60888 : add_sym_2 ("amod", GFC_ISYM_MOD, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
2785 : : NULL, gfc_simplify_mod, gfc_resolve_mod,
2786 : : a, BT_REAL, dr, REQUIRED, p, BT_REAL, dr, REQUIRED);
2787 : :
2788 : 60888 : add_sym_2 ("dmod", GFC_ISYM_MOD, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
2789 : : gfc_check_x_yd, gfc_simplify_mod, gfc_resolve_mod,
2790 : : a, BT_REAL, dd, REQUIRED, p, BT_REAL, dd, REQUIRED);
2791 : :
2792 : 60888 : make_generic ("mod", GFC_ISYM_MOD, GFC_STD_F77);
2793 : :
2794 : 60888 : add_sym_2 ("modulo", GFC_ISYM_MODULO, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, di, GFC_STD_F95,
2795 : : gfc_check_mod, gfc_simplify_modulo, gfc_resolve_modulo,
2796 : : a, BT_REAL, di, REQUIRED, p, BT_REAL, di, REQUIRED);
2797 : :
2798 : 60888 : make_generic ("modulo", GFC_ISYM_MODULO, GFC_STD_F95);
2799 : :
2800 : 60888 : add_sym_2 ("nearest", GFC_ISYM_NEAREST, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
2801 : : gfc_check_nearest, gfc_simplify_nearest, gfc_resolve_nearest,
2802 : : x, BT_REAL, dr, REQUIRED, s, BT_REAL, dr, REQUIRED);
2803 : :
2804 : 60888 : make_generic ("nearest", GFC_ISYM_NEAREST, GFC_STD_F95);
2805 : :
2806 : 60888 : add_sym_1 ("new_line", GFC_ISYM_NEW_LINE, CLASS_INQUIRY, ACTUAL_NO, BT_CHARACTER, dc,
2807 : : GFC_STD_F2003, gfc_check_new_line, gfc_simplify_new_line, NULL,
2808 : : a, BT_CHARACTER, dc, REQUIRED);
2809 : :
2810 : 60888 : make_generic ("new_line", GFC_ISYM_NEW_LINE, GFC_STD_F2003);
2811 : :
2812 : 60888 : add_sym_2 ("nint", GFC_ISYM_NINT, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER, di, GFC_STD_F77,
2813 : : gfc_check_a_ikind, gfc_simplify_nint, gfc_resolve_nint,
2814 : : a, BT_REAL, dr, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
2815 : :
2816 : 60888 : add_sym_1 ("idnint", GFC_ISYM_NINT, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER, di, GFC_STD_F77,
2817 : : gfc_check_idnint, gfc_simplify_idnint, gfc_resolve_idnint,
2818 : : a, BT_REAL, dd, REQUIRED);
2819 : :
2820 : 60888 : make_generic ("nint", GFC_ISYM_NINT, GFC_STD_F77);
2821 : :
2822 : 60888 : add_sym_1 ("not", GFC_ISYM_NOT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2823 : : gfc_check_iu, gfc_simplify_not, gfc_resolve_not,
2824 : : i, BT_INTEGER, di, REQUIRED);
2825 : :
2826 : 60888 : if (flag_dec_intrinsic_ints)
2827 : : {
2828 : 400 : make_alias ("bnot", GFC_STD_GNU);
2829 : 400 : make_alias ("inot", GFC_STD_GNU);
2830 : 400 : make_alias ("jnot", GFC_STD_GNU);
2831 : 400 : make_alias ("knot", GFC_STD_GNU);
2832 : : }
2833 : :
2834 : 60888 : make_generic ("not", GFC_ISYM_NOT, GFC_STD_F95);
2835 : :
2836 : 60888 : add_sym_2 ("norm2", GFC_ISYM_NORM2, CLASS_TRANSFORMATIONAL, ACTUAL_NO,
2837 : : BT_REAL, dr, GFC_STD_F2008,
2838 : : gfc_check_norm2, gfc_simplify_norm2, gfc_resolve_norm2,
2839 : : x, BT_REAL, dr, REQUIRED,
2840 : : dm, BT_INTEGER, ii, OPTIONAL);
2841 : :
2842 : 60888 : make_generic ("norm2", GFC_ISYM_NORM2, GFC_STD_F2008);
2843 : :
2844 : 60888 : add_sym_1 ("null", GFC_ISYM_NULL, CLASS_TRANSFORMATIONAL, ACTUAL_NO,
2845 : : BT_INTEGER, di, GFC_STD_F95,
2846 : : gfc_check_null, gfc_simplify_null, NULL,
2847 : : mo, BT_INTEGER, di, OPTIONAL);
2848 : :
2849 : 60888 : make_generic ("null", GFC_ISYM_NULL, GFC_STD_F95);
2850 : :
2851 : 60888 : add_sym_2 ("num_images", GFC_ISYM_NUM_IMAGES, CLASS_TRANSFORMATIONAL,
2852 : : ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008,
2853 : : gfc_check_num_images, gfc_simplify_num_images, NULL,
2854 : : dist, BT_INTEGER, di, OPTIONAL,
2855 : : failed, BT_LOGICAL, dl, OPTIONAL);
2856 : :
2857 : 60888 : add_sym_3 ("out_of_range", GFC_ISYM_OUT_OF_RANGE, CLASS_ELEMENTAL, ACTUAL_NO,
2858 : : BT_LOGICAL, dl, GFC_STD_F2018,
2859 : : gfc_check_out_of_range, gfc_simplify_out_of_range, NULL,
2860 : : x, BT_REAL, dr, REQUIRED,
2861 : : mo, BT_INTEGER, di, REQUIRED,
2862 : : rd, BT_LOGICAL, dl, OPTIONAL);
2863 : :
2864 : 60888 : make_generic ("out_of_range", GFC_ISYM_OUT_OF_RANGE, GFC_STD_F2018);
2865 : :
2866 : 60888 : add_sym_3 ("pack", GFC_ISYM_PACK, CLASS_TRANSFORMATIONAL, ACTUAL_NO,
2867 : : BT_REAL, dr, GFC_STD_F95,
2868 : : gfc_check_pack, gfc_simplify_pack, gfc_resolve_pack,
2869 : : ar, BT_REAL, dr, REQUIRED, msk, BT_LOGICAL, dl, REQUIRED,
2870 : : v, BT_REAL, dr, OPTIONAL);
2871 : :
2872 : 60888 : make_generic ("pack", GFC_ISYM_PACK, GFC_STD_F95);
2873 : :
2874 : :
2875 : 60888 : add_sym_2 ("parity", GFC_ISYM_PARITY, CLASS_TRANSFORMATIONAL, ACTUAL_NO,
2876 : : BT_LOGICAL, dl, GFC_STD_F2008,
2877 : : gfc_check_parity, gfc_simplify_parity, gfc_resolve_parity,
2878 : : msk, BT_LOGICAL, dl, REQUIRED,
2879 : : dm, BT_INTEGER, ii, OPTIONAL);
2880 : :
2881 : 60888 : make_generic ("parity", GFC_ISYM_PARITY, GFC_STD_F2008);
2882 : :
2883 : 60888 : add_sym_1 ("popcnt", GFC_ISYM_POPCNT, CLASS_ELEMENTAL, ACTUAL_NO,
2884 : : BT_INTEGER, di, GFC_STD_F2008,
2885 : : gfc_check_iu, gfc_simplify_popcnt, NULL,
2886 : : i, BT_INTEGER, di, REQUIRED);
2887 : :
2888 : 60888 : make_generic ("popcnt", GFC_ISYM_POPCNT, GFC_STD_F2008);
2889 : :
2890 : 60888 : add_sym_1 ("poppar", GFC_ISYM_POPPAR, CLASS_ELEMENTAL, ACTUAL_NO,
2891 : : BT_INTEGER, di, GFC_STD_F2008,
2892 : : gfc_check_iu, gfc_simplify_poppar, NULL,
2893 : : i, BT_INTEGER, di, REQUIRED);
2894 : :
2895 : 60888 : make_generic ("poppar", GFC_ISYM_POPPAR, GFC_STD_F2008);
2896 : :
2897 : 60888 : add_sym_1 ("precision", GFC_ISYM_PRECISION, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2898 : : gfc_check_precision, gfc_simplify_precision, NULL,
2899 : : x, BT_UNKNOWN, 0, REQUIRED);
2900 : :
2901 : 60888 : make_generic ("precision", GFC_ISYM_PRECISION, GFC_STD_F95);
2902 : :
2903 : 60888 : add_sym_1_intent ("present", GFC_ISYM_PRESENT, CLASS_INQUIRY, ACTUAL_NO,
2904 : : BT_LOGICAL, dl, GFC_STD_F95, gfc_check_present, NULL, NULL,
2905 : : a, BT_REAL, dr, REQUIRED, INTENT_UNKNOWN);
2906 : :
2907 : 60888 : make_generic ("present", GFC_ISYM_PRESENT, GFC_STD_F95);
2908 : :
2909 : 60888 : add_sym_3red ("product", GFC_ISYM_PRODUCT, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
2910 : : gfc_check_product_sum, gfc_simplify_product, gfc_resolve_product,
2911 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
2912 : : msk, BT_LOGICAL, dl, OPTIONAL);
2913 : :
2914 : 60888 : make_generic ("product", GFC_ISYM_PRODUCT, GFC_STD_F95);
2915 : :
2916 : 60888 : add_sym_1 ("radix", GFC_ISYM_RADIX, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2917 : : gfc_check_radix, gfc_simplify_radix, NULL,
2918 : : x, BT_UNKNOWN, 0, REQUIRED);
2919 : :
2920 : 60888 : make_generic ("radix", GFC_ISYM_RADIX, GFC_STD_F95);
2921 : :
2922 : : /* The following function is for G77 compatibility. */
2923 : 60888 : add_sym_1 ("rand", GFC_ISYM_RAND, CLASS_IMPURE, ACTUAL_NO, BT_REAL,
2924 : : 4, GFC_STD_GNU, gfc_check_rand, NULL, NULL,
2925 : : i, BT_INTEGER, 4, OPTIONAL);
2926 : :
2927 : : /* Compatibility with HP FORTRAN 77/iX Reference. Note, rand() and ran()
2928 : : use slightly different shoddy multiplicative congruential PRNG. */
2929 : 60888 : make_alias ("ran", GFC_STD_GNU);
2930 : :
2931 : 60888 : make_generic ("rand", GFC_ISYM_RAND, GFC_STD_GNU);
2932 : :
2933 : 60888 : add_sym_1 ("range", GFC_ISYM_RANGE, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
2934 : : gfc_check_range, gfc_simplify_range, NULL,
2935 : : x, BT_REAL, dr, REQUIRED);
2936 : :
2937 : 60888 : make_generic ("range", GFC_ISYM_RANGE, GFC_STD_F95);
2938 : :
2939 : 60888 : add_sym_1 ("rank", GFC_ISYM_RANK, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di,
2940 : : GFC_STD_F2018, gfc_check_rank, gfc_simplify_rank, gfc_resolve_rank,
2941 : : a, BT_REAL, dr, REQUIRED);
2942 : 60888 : make_generic ("rank", GFC_ISYM_RANK, GFC_STD_F2018);
2943 : :
2944 : 60888 : add_sym_2 ("real", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77,
2945 : : gfc_check_real, gfc_simplify_real, gfc_resolve_real,
2946 : : a, BT_UNKNOWN, dr, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
2947 : :
2948 : 60888 : make_generic ("real", GFC_ISYM_REAL, GFC_STD_F77);
2949 : :
2950 : : /* This provides compatibility with g77. */
2951 : 60888 : add_sym_1 ("realpart", GFC_ISYM_REALPART, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
2952 : : gfc_check_fn_c, gfc_simplify_realpart, gfc_resolve_realpart,
2953 : : a, BT_UNKNOWN, dr, REQUIRED);
2954 : :
2955 : 60888 : make_generic ("realpart", GFC_ISYM_REALPART, GFC_STD_F77);
2956 : :
2957 : 60888 : add_sym_1 ("float", GFC_ISYM_FLOAT, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77,
2958 : : gfc_check_float, gfc_simplify_float, NULL,
2959 : : a, BT_INTEGER, di, REQUIRED);
2960 : :
2961 : 60888 : if (flag_dec_intrinsic_ints)
2962 : : {
2963 : 400 : make_alias ("floati", GFC_STD_GNU);
2964 : 400 : make_alias ("floatj", GFC_STD_GNU);
2965 : 400 : make_alias ("floatk", GFC_STD_GNU);
2966 : : }
2967 : :
2968 : 60888 : make_generic ("float", GFC_ISYM_FLOAT, GFC_STD_F77);
2969 : :
2970 : 60888 : add_sym_1 ("dfloat", GFC_ISYM_DFLOAT, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU,
2971 : : gfc_check_float, gfc_simplify_dble, gfc_resolve_dble,
2972 : : a, BT_REAL, dr, REQUIRED);
2973 : :
2974 : 60888 : make_generic ("dfloat", GFC_ISYM_DFLOAT, GFC_STD_F77);
2975 : :
2976 : 60888 : add_sym_1 ("sngl", GFC_ISYM_SNGL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77,
2977 : : gfc_check_sngl, gfc_simplify_sngl, NULL,
2978 : : a, BT_REAL, dd, REQUIRED);
2979 : :
2980 : 60888 : make_generic ("sngl", GFC_ISYM_SNGL, GFC_STD_F77);
2981 : :
2982 : 60888 : add_sym_6 ("reduce", GFC_ISYM_REDUCE, CLASS_TRANSFORMATIONAL, ACTUAL_NO,
2983 : : BT_REAL, dr, GFC_STD_F2018,
2984 : : gfc_check_reduce, NULL, gfc_resolve_reduce,
2985 : : ar, BT_REAL, dr, REQUIRED,
2986 : : op, BT_REAL, dr, REQUIRED,
2987 : : dm, BT_INTEGER, di, OPTIONAL,
2988 : : msk, BT_LOGICAL, dl, OPTIONAL,
2989 : : idy, BT_REAL, dr, OPTIONAL,
2990 : : odd, BT_LOGICAL, dl, OPTIONAL);
2991 : :
2992 : 60888 : make_generic ("reduce", GFC_ISYM_REDUCE, GFC_STD_F2018);
2993 : :
2994 : 60888 : add_sym_2 ("rename", GFC_ISYM_RENAME, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, di,
2995 : : GFC_STD_GNU, gfc_check_rename, NULL, gfc_resolve_rename,
2996 : : p1, BT_CHARACTER, dc, REQUIRED, p2, BT_CHARACTER, dc, REQUIRED);
2997 : :
2998 : 60888 : make_generic ("rename", GFC_ISYM_RENAME, GFC_STD_GNU);
2999 : :
3000 : 60888 : add_sym_2 ("repeat", GFC_ISYM_REPEAT, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_CHARACTER, dc, GFC_STD_F95,
3001 : : gfc_check_repeat, gfc_simplify_repeat, gfc_resolve_repeat,
3002 : : stg, BT_CHARACTER, dc, REQUIRED, ncopies, BT_INTEGER, di, REQUIRED);
3003 : :
3004 : 60888 : make_generic ("repeat", GFC_ISYM_REPEAT, GFC_STD_F95);
3005 : :
3006 : 60888 : add_sym_4 ("reshape", GFC_ISYM_RESHAPE, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
3007 : : gfc_check_reshape, gfc_simplify_reshape, gfc_resolve_reshape,
3008 : : src, BT_REAL, dr, REQUIRED, shp, BT_INTEGER, ii, REQUIRED,
3009 : : pad, BT_REAL, dr, OPTIONAL, ord, BT_INTEGER, ii, OPTIONAL);
3010 : :
3011 : 60888 : make_generic ("reshape", GFC_ISYM_RESHAPE, GFC_STD_F95);
3012 : :
3013 : 60888 : add_sym_1 ("rrspacing", GFC_ISYM_RRSPACING, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr,
3014 : : GFC_STD_F95, gfc_check_fn_r, gfc_simplify_rrspacing, gfc_resolve_rrspacing,
3015 : : x, BT_REAL, dr, REQUIRED);
3016 : :
3017 : 60888 : make_generic ("rrspacing", GFC_ISYM_RRSPACING, GFC_STD_F95);
3018 : :
3019 : 60888 : add_sym_2 ("same_type_as", GFC_ISYM_SAME_TYPE_AS, CLASS_INQUIRY, ACTUAL_NO,
3020 : : BT_LOGICAL, dl, GFC_STD_F2003,
3021 : : gfc_check_same_type_as, gfc_simplify_same_type_as, NULL,
3022 : : a, BT_UNKNOWN, 0, REQUIRED,
3023 : : b, BT_UNKNOWN, 0, REQUIRED);
3024 : :
3025 : 60888 : add_sym_2 ("scale", GFC_ISYM_SCALE, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
3026 : : gfc_check_scale, gfc_simplify_scale, gfc_resolve_scale,
3027 : : x, BT_REAL, dr, REQUIRED, i, BT_INTEGER, di, REQUIRED);
3028 : :
3029 : 60888 : make_generic ("scale", GFC_ISYM_SCALE, GFC_STD_F95);
3030 : :
3031 : 60888 : add_sym_4 ("scan", GFC_ISYM_SCAN, CLASS_ELEMENTAL, ACTUAL_NO,
3032 : : BT_INTEGER, di, GFC_STD_F95,
3033 : : gfc_check_scan, gfc_simplify_scan, gfc_resolve_scan,
3034 : : stg, BT_CHARACTER, dc, REQUIRED, set, BT_CHARACTER, dc, REQUIRED,
3035 : : bck, BT_LOGICAL, dl, OPTIONAL, kind, BT_INTEGER, di, OPTIONAL);
3036 : :
3037 : 60888 : make_generic ("scan", GFC_ISYM_SCAN, GFC_STD_F95);
3038 : :
3039 : : /* Added for G77 compatibility garbage. */
3040 : 60888 : add_sym_0 ("second", GFC_ISYM_SECOND, CLASS_IMPURE, ACTUAL_NO, BT_REAL,
3041 : : 4, GFC_STD_GNU, NULL, NULL, NULL);
3042 : :
3043 : 60888 : make_generic ("second", GFC_ISYM_SECOND, GFC_STD_GNU);
3044 : :
3045 : : /* Added for G77 compatibility. */
3046 : 60888 : add_sym_1 ("secnds", GFC_ISYM_SECNDS, CLASS_IMPURE, ACTUAL_NO, BT_REAL,
3047 : : dr, GFC_STD_GNU, gfc_check_secnds, NULL, gfc_resolve_secnds,
3048 : : x, BT_REAL, dr, REQUIRED);
3049 : :
3050 : 60888 : make_generic ("secnds", GFC_ISYM_SECNDS, GFC_STD_GNU);
3051 : :
3052 : 60888 : add_sym_1 ("selected_char_kind", GFC_ISYM_SC_KIND, CLASS_TRANSFORMATIONAL,
3053 : : ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2003,
3054 : : gfc_check_selected_char_kind, gfc_simplify_selected_char_kind,
3055 : : NULL, nm, BT_CHARACTER, dc, REQUIRED);
3056 : :
3057 : 60888 : make_generic ("selected_char_kind", GFC_ISYM_SC_KIND, GFC_STD_F2003);
3058 : :
3059 : 60888 : add_sym_1 ("selected_int_kind", GFC_ISYM_SI_KIND, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di,
3060 : : GFC_STD_F95, gfc_check_selected_int_kind,
3061 : : gfc_simplify_selected_int_kind, NULL, r, BT_INTEGER, di, REQUIRED);
3062 : :
3063 : 60888 : make_generic ("selected_int_kind", GFC_ISYM_SI_KIND, GFC_STD_F95);
3064 : :
3065 : 60888 : add_sym_1 ("selected_unsigned_kind", GFC_ISYM_SU_KIND,
3066 : : CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di,
3067 : : GFC_STD_UNSIGNED, gfc_check_selected_int_kind,
3068 : : gfc_simplify_selected_unsigned_kind, NULL, r, BT_INTEGER, di,
3069 : : REQUIRED);
3070 : :
3071 : 60888 : make_generic ("selected_unsigned_kind", GFC_ISYM_SU_KIND, GFC_STD_GNU);
3072 : :
3073 : 60888 : add_sym_1 ("selected_logical_kind", GFC_ISYM_SL_KIND, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di,
3074 : : GFC_STD_F2023, /* it has the same requirements */ gfc_check_selected_int_kind,
3075 : : gfc_simplify_selected_logical_kind, NULL, r, BT_INTEGER, di, REQUIRED);
3076 : :
3077 : 60888 : make_generic ("selected_logical_kind", GFC_ISYM_SL_KIND, GFC_STD_F2023);
3078 : :
3079 : 60888 : add_sym_3 ("selected_real_kind", GFC_ISYM_SR_KIND, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di,
3080 : : GFC_STD_F95, gfc_check_selected_real_kind,
3081 : : gfc_simplify_selected_real_kind, NULL,
3082 : : p, BT_INTEGER, di, OPTIONAL, r, BT_INTEGER, di, OPTIONAL,
3083 : : "radix", BT_INTEGER, di, OPTIONAL);
3084 : :
3085 : 60888 : make_generic ("selected_real_kind", GFC_ISYM_SR_KIND, GFC_STD_F95);
3086 : :
3087 : 60888 : add_sym_2 ("set_exponent", GFC_ISYM_SET_EXPONENT, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
3088 : : gfc_check_set_exponent, gfc_simplify_set_exponent,
3089 : : gfc_resolve_set_exponent,
3090 : : x, BT_REAL, dr, REQUIRED, i, BT_INTEGER, di, REQUIRED);
3091 : :
3092 : 60888 : make_generic ("set_exponent", GFC_ISYM_SET_EXPONENT, GFC_STD_F95);
3093 : :
3094 : 60888 : add_sym_2 ("shape", GFC_ISYM_SHAPE, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
3095 : : gfc_check_shape, gfc_simplify_shape, gfc_resolve_shape,
3096 : : src, BT_REAL, dr, REQUIRED,
3097 : : kind, BT_INTEGER, di, OPTIONAL);
3098 : :
3099 : 60888 : make_generic ("shape", GFC_ISYM_SHAPE, GFC_STD_F95);
3100 : :
3101 : 60888 : add_sym_2 ("shifta", GFC_ISYM_SHIFTA, CLASS_ELEMENTAL, ACTUAL_NO,
3102 : : BT_INTEGER, di, GFC_STD_F2008,
3103 : : gfc_check_shift, gfc_simplify_shifta, gfc_resolve_shift,
3104 : : i, BT_INTEGER, di, REQUIRED,
3105 : : sh, BT_INTEGER, di, REQUIRED);
3106 : :
3107 : 60888 : make_generic ("shifta", GFC_ISYM_SHIFTA, GFC_STD_F2008);
3108 : :
3109 : 60888 : add_sym_2 ("shiftl", GFC_ISYM_SHIFTL, CLASS_ELEMENTAL, ACTUAL_NO,
3110 : : BT_INTEGER, di, GFC_STD_F2008,
3111 : : gfc_check_shift, gfc_simplify_shiftl, gfc_resolve_shift,
3112 : : i, BT_INTEGER, di, REQUIRED,
3113 : : sh, BT_INTEGER, di, REQUIRED);
3114 : :
3115 : 60888 : make_generic ("shiftl", GFC_ISYM_SHIFTL, GFC_STD_F2008);
3116 : :
3117 : 60888 : add_sym_2 ("shiftr", GFC_ISYM_SHIFTR, CLASS_ELEMENTAL, ACTUAL_NO,
3118 : : BT_INTEGER, di, GFC_STD_F2008,
3119 : : gfc_check_shift, gfc_simplify_shiftr, gfc_resolve_shift,
3120 : : i, BT_INTEGER, di, REQUIRED,
3121 : : sh, BT_INTEGER, di, REQUIRED);
3122 : :
3123 : 60888 : make_generic ("shiftr", GFC_ISYM_SHIFTR, GFC_STD_F2008);
3124 : :
3125 : 60888 : add_sym_2 ("sign", GFC_ISYM_SIGN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
3126 : : gfc_check_sign, gfc_simplify_sign, gfc_resolve_sign,
3127 : : a, BT_REAL, dr, REQUIRED, b, BT_REAL, dr, REQUIRED);
3128 : :
3129 : 60888 : add_sym_2 ("isign", GFC_ISYM_SIGN, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER, di, GFC_STD_F77,
3130 : : NULL, gfc_simplify_sign, gfc_resolve_sign,
3131 : : a, BT_INTEGER, di, REQUIRED, b, BT_INTEGER, di, REQUIRED);
3132 : :
3133 : 60888 : add_sym_2 ("dsign", GFC_ISYM_SIGN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
3134 : : gfc_check_x_yd, gfc_simplify_sign, gfc_resolve_sign,
3135 : : a, BT_REAL, dd, REQUIRED, b, BT_REAL, dd, REQUIRED);
3136 : :
3137 : 60888 : make_generic ("sign", GFC_ISYM_SIGN, GFC_STD_F77);
3138 : :
3139 : 60888 : add_sym_2 ("signal", GFC_ISYM_SIGNAL, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
3140 : : di, GFC_STD_GNU, gfc_check_signal, NULL, gfc_resolve_signal,
3141 : : num, BT_INTEGER, di, REQUIRED, han, BT_VOID, 0, REQUIRED);
3142 : :
3143 : 60888 : make_generic ("signal", GFC_ISYM_SIGNAL, GFC_STD_GNU);
3144 : :
3145 : 60888 : add_sym_1 ("sin", GFC_ISYM_SIN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
3146 : : gfc_check_fn_rc, gfc_simplify_sin, gfc_resolve_sin,
3147 : : x, BT_REAL, dr, REQUIRED);
3148 : :
3149 : 60888 : add_sym_1 ("dsin", GFC_ISYM_SIN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
3150 : : gfc_check_fn_d, gfc_simplify_sin, gfc_resolve_sin,
3151 : : x, BT_REAL, dd, REQUIRED);
3152 : :
3153 : 60888 : add_sym_1 ("csin", GFC_ISYM_SIN, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dz, GFC_STD_F77,
3154 : : NULL, gfc_simplify_sin, gfc_resolve_sin,
3155 : : x, BT_COMPLEX, dz, REQUIRED);
3156 : :
3157 : 60888 : add_sym_1 ("zsin", GFC_ISYM_SIN, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dd, GFC_STD_GNU,
3158 : : NULL, gfc_simplify_sin, gfc_resolve_sin,
3159 : : x, BT_COMPLEX, dd, REQUIRED);
3160 : :
3161 : 60888 : make_alias ("cdsin", GFC_STD_GNU);
3162 : :
3163 : 60888 : make_generic ("sin", GFC_ISYM_SIN, GFC_STD_F77);
3164 : :
3165 : 60888 : add_sym_1 ("sinh", GFC_ISYM_SINH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
3166 : : gfc_check_fn_rc2008, gfc_simplify_sinh, gfc_resolve_sinh,
3167 : : x, BT_REAL, dr, REQUIRED);
3168 : :
3169 : 60888 : add_sym_1 ("dsinh", GFC_ISYM_SINH,CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
3170 : : gfc_check_fn_d, gfc_simplify_sinh, gfc_resolve_sinh,
3171 : : x, BT_REAL, dd, REQUIRED);
3172 : :
3173 : 60888 : make_generic ("sinh", GFC_ISYM_SINH, GFC_STD_F77);
3174 : :
3175 : 60888 : add_sym_3 ("size", GFC_ISYM_SIZE, CLASS_INQUIRY, ACTUAL_NO,
3176 : : BT_INTEGER, di, GFC_STD_F95,
3177 : : gfc_check_size, gfc_simplify_size, gfc_resolve_size,
3178 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
3179 : : kind, BT_INTEGER, di, OPTIONAL);
3180 : :
3181 : 60888 : make_generic ("size", GFC_ISYM_SIZE, GFC_STD_F95);
3182 : :
3183 : : /* Obtain the stride for a given dimensions; to be used only internally.
3184 : : "make_from_module" makes it inaccessible for external users. */
3185 : 60888 : add_sym_2 (GFC_PREFIX ("stride"), GFC_ISYM_STRIDE, CLASS_INQUIRY, ACTUAL_NO,
3186 : : BT_INTEGER, gfc_index_integer_kind, GFC_STD_GNU,
3187 : : NULL, NULL, gfc_resolve_stride,
3188 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL);
3189 : 60888 : make_from_module();
3190 : :
3191 : 60888 : add_sym_1 ("sizeof", GFC_ISYM_SIZEOF, CLASS_INQUIRY, ACTUAL_NO,
3192 : : BT_INTEGER, ii, GFC_STD_GNU,
3193 : : gfc_check_sizeof, gfc_simplify_sizeof, NULL,
3194 : : x, BT_UNKNOWN, 0, REQUIRED);
3195 : :
3196 : 60888 : make_generic ("sizeof", GFC_ISYM_SIZEOF, GFC_STD_GNU);
3197 : :
3198 : : /* The following functions are part of ISO_C_BINDING. */
3199 : 60888 : add_sym_2 ("c_associated", GFC_ISYM_C_ASSOCIATED, CLASS_INQUIRY, ACTUAL_NO,
3200 : : BT_LOGICAL, dl, GFC_STD_F2003, gfc_check_c_associated, NULL, NULL,
3201 : : c_ptr_1, BT_VOID, 0, REQUIRED,
3202 : : c_ptr_2, BT_VOID, 0, OPTIONAL);
3203 : 60888 : make_from_module();
3204 : :
3205 : 60888 : add_sym_1 ("c_loc", GFC_ISYM_C_LOC, CLASS_INQUIRY, ACTUAL_NO,
3206 : : BT_VOID, 0, GFC_STD_F2003,
3207 : : gfc_check_c_loc, NULL, gfc_resolve_c_loc,
3208 : : x, BT_UNKNOWN, 0, REQUIRED);
3209 : 60888 : make_from_module();
3210 : :
3211 : 60888 : add_sym_1 ("c_funloc", GFC_ISYM_C_FUNLOC, CLASS_INQUIRY, ACTUAL_NO,
3212 : : BT_VOID, 0, GFC_STD_F2003,
3213 : : gfc_check_c_funloc, NULL, gfc_resolve_c_funloc,
3214 : : x, BT_UNKNOWN, 0, REQUIRED);
3215 : 60888 : make_from_module();
3216 : :
3217 : 60888 : add_sym_2 ("f_c_string", GFC_ISYM_F_C_STRING, CLASS_TRANSFORMATIONAL,
3218 : : ACTUAL_NO,
3219 : : BT_CHARACTER, dc, GFC_STD_F2023,
3220 : : gfc_check_f_c_string, NULL, NULL,
3221 : : stg, BT_CHARACTER, dc, REQUIRED,
3222 : : "asis", BT_CHARACTER, dc, OPTIONAL);
3223 : 60888 : make_from_module();
3224 : :
3225 : 60888 : add_sym_1 ("c_sizeof", GFC_ISYM_C_SIZEOF, CLASS_INQUIRY, ACTUAL_NO,
3226 : : BT_INTEGER, gfc_index_integer_kind, GFC_STD_F2008,
3227 : : gfc_check_c_sizeof, gfc_simplify_sizeof, NULL,
3228 : : x, BT_UNKNOWN, 0, REQUIRED);
3229 : 60888 : make_from_module();
3230 : :
3231 : : /* COMPILER_OPTIONS and COMPILER_VERSION are part of ISO_FORTRAN_ENV. */
3232 : 60888 : add_sym_0 ("compiler_options", GFC_ISYM_COMPILER_OPTIONS, CLASS_INQUIRY,
3233 : : ACTUAL_NO, BT_CHARACTER, dc, GFC_STD_F2008,
3234 : : NULL, gfc_simplify_compiler_options, NULL);
3235 : 60888 : make_from_module();
3236 : :
3237 : 60888 : add_sym_0 ("compiler_version", GFC_ISYM_COMPILER_VERSION, CLASS_INQUIRY,
3238 : : ACTUAL_NO, BT_CHARACTER, dc, GFC_STD_F2008,
3239 : : NULL, gfc_simplify_compiler_version, NULL);
3240 : 60888 : make_from_module();
3241 : :
3242 : 60888 : add_sym_1 ("spacing", GFC_ISYM_SPACING, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr,
3243 : : GFC_STD_F95, gfc_check_fn_r, gfc_simplify_spacing, gfc_resolve_spacing,
3244 : : x, BT_REAL, dr, REQUIRED);
3245 : :
3246 : 60888 : make_generic ("spacing", GFC_ISYM_SPACING, GFC_STD_F95);
3247 : :
3248 : 60888 : add_sym_3 ("spread", GFC_ISYM_SPREAD, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
3249 : : gfc_check_spread, gfc_simplify_spread, gfc_resolve_spread,
3250 : : src, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, REQUIRED,
3251 : : ncopies, BT_INTEGER, di, REQUIRED);
3252 : :
3253 : 60888 : make_generic ("spread", GFC_ISYM_SPREAD, GFC_STD_F95);
3254 : :
3255 : 60888 : add_sym_1 ("sqrt", GFC_ISYM_SQRT, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
3256 : : gfc_check_fn_rc, gfc_simplify_sqrt, gfc_resolve_sqrt,
3257 : : x, BT_REAL, dr, REQUIRED);
3258 : :
3259 : 60888 : add_sym_1 ("dsqrt", GFC_ISYM_SQRT, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
3260 : : gfc_check_fn_d, gfc_simplify_sqrt, gfc_resolve_sqrt,
3261 : : x, BT_REAL, dd, REQUIRED);
3262 : :
3263 : 60888 : add_sym_1 ("csqrt", GFC_ISYM_SQRT, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dz, GFC_STD_F77,
3264 : : NULL, gfc_simplify_sqrt, gfc_resolve_sqrt,
3265 : : x, BT_COMPLEX, dz, REQUIRED);
3266 : :
3267 : 60888 : add_sym_1 ("zsqrt", GFC_ISYM_SQRT, CLASS_ELEMENTAL, ACTUAL_YES, BT_COMPLEX, dd, GFC_STD_GNU,
3268 : : NULL, gfc_simplify_sqrt, gfc_resolve_sqrt,
3269 : : x, BT_COMPLEX, dd, REQUIRED);
3270 : :
3271 : 60888 : make_alias ("cdsqrt", GFC_STD_GNU);
3272 : :
3273 : 60888 : make_generic ("sqrt", GFC_ISYM_SQRT, GFC_STD_F77);
3274 : :
3275 : 60888 : add_sym_2_intent ("stat", GFC_ISYM_STAT, CLASS_IMPURE, ACTUAL_NO,
3276 : : BT_INTEGER, di, GFC_STD_GNU,
3277 : : gfc_check_stat, NULL, gfc_resolve_stat,
3278 : : nm, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
3279 : : vl, BT_INTEGER, di, REQUIRED, INTENT_OUT);
3280 : :
3281 : 60888 : make_generic ("stat", GFC_ISYM_STAT, GFC_STD_GNU);
3282 : :
3283 : 60888 : add_sym_2 ("stopped_images", GFC_ISYM_STOPPED_IMAGES, CLASS_TRANSFORMATIONAL,
3284 : : ACTUAL_NO, BT_INTEGER, dd, GFC_STD_F2018,
3285 : : gfc_check_failed_or_stopped_images,
3286 : : gfc_simplify_failed_or_stopped_images,
3287 : : gfc_resolve_stopped_images, team, BT_VOID, di, OPTIONAL,
3288 : : kind, BT_INTEGER, di, OPTIONAL);
3289 : :
3290 : 60888 : add_sym_2 ("storage_size", GFC_ISYM_STORAGE_SIZE, CLASS_INQUIRY, ACTUAL_NO,
3291 : : BT_INTEGER, di, GFC_STD_F2008,
3292 : : gfc_check_storage_size, gfc_simplify_storage_size,
3293 : : gfc_resolve_storage_size,
3294 : : a, BT_UNKNOWN, 0, REQUIRED,
3295 : : kind, BT_INTEGER, di, OPTIONAL);
3296 : :
3297 : 60888 : add_sym_3red ("sum", GFC_ISYM_SUM, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
3298 : : gfc_check_product_sum, gfc_simplify_sum, gfc_resolve_sum,
3299 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
3300 : : msk, BT_LOGICAL, dl, OPTIONAL);
3301 : :
3302 : 60888 : make_generic ("sum", GFC_ISYM_SUM, GFC_STD_F95);
3303 : :
3304 : 60888 : add_sym_2 ("symlnk", GFC_ISYM_SYMLNK, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, di,
3305 : : GFC_STD_GNU, gfc_check_symlnk, NULL, gfc_resolve_symlnk,
3306 : : p1, BT_CHARACTER, dc, REQUIRED, p2, BT_CHARACTER, dc, REQUIRED);
3307 : :
3308 : 60888 : make_generic ("symlnk", GFC_ISYM_SYMLNK, GFC_STD_GNU);
3309 : :
3310 : 60888 : add_sym_1 ("system", GFC_ISYM_SYSTEM, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, di,
3311 : : GFC_STD_GNU, NULL, NULL, NULL,
3312 : : com, BT_CHARACTER, dc, REQUIRED);
3313 : :
3314 : 60888 : make_generic ("system", GFC_ISYM_SYSTEM, GFC_STD_GNU);
3315 : :
3316 : 60888 : add_sym_1 ("tan", GFC_ISYM_TAN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
3317 : : gfc_check_fn_rc2008, gfc_simplify_tan, gfc_resolve_tan,
3318 : : x, BT_REAL, dr, REQUIRED);
3319 : :
3320 : 60888 : add_sym_1 ("dtan", GFC_ISYM_TAN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
3321 : : gfc_check_fn_d, gfc_simplify_tan, gfc_resolve_tan,
3322 : : x, BT_REAL, dd, REQUIRED);
3323 : :
3324 : 60888 : make_generic ("tan", GFC_ISYM_TAN, GFC_STD_F77);
3325 : :
3326 : 60888 : add_sym_1 ("tanh", GFC_ISYM_TANH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
3327 : : gfc_check_fn_rc2008, gfc_simplify_tanh, gfc_resolve_tanh,
3328 : : x, BT_REAL, dr, REQUIRED);
3329 : :
3330 : 60888 : add_sym_1 ("dtanh", GFC_ISYM_TANH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
3331 : : gfc_check_fn_d, gfc_simplify_tanh, gfc_resolve_tanh,
3332 : : x, BT_REAL, dd, REQUIRED);
3333 : :
3334 : 60888 : make_generic ("tanh", GFC_ISYM_TANH, GFC_STD_F77);
3335 : :
3336 : 60888 : add_sym_1 ("team_number", GFC_ISYM_TEAM_NUMBER, CLASS_TRANSFORMATIONAL,
3337 : : ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2018,
3338 : : gfc_check_team_number, NULL, gfc_resolve_team_number,
3339 : : team, BT_DERIVED, di, OPTIONAL);
3340 : :
3341 : 60888 : add_sym_3 ("this_image", GFC_ISYM_THIS_IMAGE, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008,
3342 : : gfc_check_this_image, gfc_simplify_this_image, gfc_resolve_this_image,
3343 : : ca, BT_REAL, dr, OPTIONAL, dm, BT_INTEGER, ii, OPTIONAL,
3344 : : dist, BT_INTEGER, di, OPTIONAL);
3345 : :
3346 : 60888 : add_sym_0 ("time", GFC_ISYM_TIME, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
3347 : : di, GFC_STD_GNU, NULL, NULL, gfc_resolve_time);
3348 : :
3349 : 60888 : make_generic ("time", GFC_ISYM_TIME, GFC_STD_GNU);
3350 : :
3351 : 60888 : add_sym_0 ("time8", GFC_ISYM_TIME8, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
3352 : : di, GFC_STD_GNU, NULL, NULL, gfc_resolve_time8);
3353 : :
3354 : 60888 : make_generic ("time8", GFC_ISYM_TIME8, GFC_STD_GNU);
3355 : :
3356 : 60888 : add_sym_1 ("tiny", GFC_ISYM_TINY, CLASS_INQUIRY, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
3357 : : gfc_check_fn_r, gfc_simplify_tiny, NULL, x, BT_REAL, dr, REQUIRED);
3358 : :
3359 : 60888 : make_generic ("tiny", GFC_ISYM_TINY, GFC_STD_F95);
3360 : :
3361 : 60888 : add_sym_1 ("trailz", GFC_ISYM_TRAILZ, CLASS_ELEMENTAL, ACTUAL_NO,
3362 : : BT_INTEGER, di, GFC_STD_F2008,
3363 : : gfc_check_i, gfc_simplify_trailz, NULL,
3364 : : i, BT_INTEGER, di, REQUIRED);
3365 : :
3366 : 60888 : make_generic ("trailz", GFC_ISYM_TRAILZ, GFC_STD_F2008);
3367 : :
3368 : 60888 : add_sym_3 ("transfer", GFC_ISYM_TRANSFER, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
3369 : : gfc_check_transfer, gfc_simplify_transfer, gfc_resolve_transfer,
3370 : : src, BT_REAL, dr, REQUIRED, mo, BT_REAL, dr, REQUIRED,
3371 : : sz, BT_INTEGER, di, OPTIONAL);
3372 : :
3373 : 60888 : make_generic ("transfer", GFC_ISYM_TRANSFER, GFC_STD_F95);
3374 : :
3375 : 60888 : add_sym_1 ("transpose", GFC_ISYM_TRANSPOSE, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
3376 : : gfc_check_transpose, gfc_simplify_transpose, gfc_resolve_transpose,
3377 : : m, BT_REAL, dr, REQUIRED);
3378 : :
3379 : 60888 : make_generic ("transpose", GFC_ISYM_TRANSPOSE, GFC_STD_F95);
3380 : :
3381 : 60888 : add_sym_1 ("trim", GFC_ISYM_TRIM, CLASS_TRANSFORMATIONAL, ACTUAL_NO,
3382 : : BT_CHARACTER, dc, GFC_STD_F95,
3383 : : gfc_check_trim, gfc_simplify_trim, gfc_resolve_trim,
3384 : : stg, BT_CHARACTER, dc, REQUIRED);
3385 : :
3386 : 60888 : make_generic ("trim", GFC_ISYM_TRIM, GFC_STD_F95);
3387 : :
3388 : 60888 : add_sym_1 ("ttynam", GFC_ISYM_TTYNAM, CLASS_IMPURE, ACTUAL_NO, BT_CHARACTER,
3389 : : 0, GFC_STD_GNU, gfc_check_ttynam, NULL, gfc_resolve_ttynam,
3390 : : ut, BT_INTEGER, di, REQUIRED);
3391 : :
3392 : 60888 : make_generic ("ttynam", GFC_ISYM_TTYNAM, GFC_STD_GNU);
3393 : :
3394 : 60888 : add_sym_3 ("ubound", GFC_ISYM_UBOUND, CLASS_INQUIRY, ACTUAL_NO,
3395 : : BT_INTEGER, di, GFC_STD_F95,
3396 : : gfc_check_ubound, gfc_simplify_ubound, gfc_resolve_ubound,
3397 : : ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
3398 : : kind, BT_INTEGER, di, OPTIONAL);
3399 : :
3400 : 60888 : make_generic ("ubound", GFC_ISYM_UBOUND, GFC_STD_F95);
3401 : :
3402 : 60888 : add_sym_3 ("ucobound", GFC_ISYM_UCOBOUND, CLASS_INQUIRY, ACTUAL_NO,
3403 : : BT_INTEGER, di, GFC_STD_F2008,
3404 : : gfc_check_ucobound, gfc_simplify_ucobound, gfc_resolve_ucobound,
3405 : : ca, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL,
3406 : : kind, BT_INTEGER, di, OPTIONAL);
3407 : :
3408 : 60888 : make_generic ("ucobound", GFC_ISYM_UCOBOUND, GFC_STD_F2008);
3409 : :
3410 : : /* g77 compatibility for UMASK. */
3411 : 60888 : add_sym_1 ("umask", GFC_ISYM_UMASK, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, di,
3412 : : GFC_STD_GNU, gfc_check_umask, NULL, gfc_resolve_umask,
3413 : : msk, BT_INTEGER, di, REQUIRED);
3414 : :
3415 : 60888 : make_generic ("umask", GFC_ISYM_UMASK, GFC_STD_GNU);
3416 : :
3417 : : /* g77 compatibility for UNLINK. */
3418 : 60888 : add_sym_1 ("unlink", GFC_ISYM_UNLINK, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
3419 : : di, GFC_STD_GNU, gfc_check_unlink, NULL, gfc_resolve_unlink,
3420 : : "path", BT_CHARACTER, dc, REQUIRED);
3421 : :
3422 : 60888 : make_generic ("unlink", GFC_ISYM_UNLINK, GFC_STD_GNU);
3423 : :
3424 : 60888 : add_sym_3 ("unpack", GFC_ISYM_UNPACK, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
3425 : : gfc_check_unpack, gfc_simplify_unpack, gfc_resolve_unpack,
3426 : : v, BT_REAL, dr, REQUIRED, msk, BT_LOGICAL, dl, REQUIRED,
3427 : : f, BT_REAL, dr, REQUIRED);
3428 : :
3429 : 60888 : make_generic ("unpack", GFC_ISYM_UNPACK, GFC_STD_F95);
3430 : :
3431 : 60888 : add_sym_4 ("verify", GFC_ISYM_VERIFY, CLASS_ELEMENTAL, ACTUAL_NO,
3432 : : BT_INTEGER, di, GFC_STD_F95,
3433 : : gfc_check_verify, gfc_simplify_verify, gfc_resolve_verify,
3434 : : stg, BT_CHARACTER, dc, REQUIRED, set, BT_CHARACTER, dc, REQUIRED,
3435 : : bck, BT_LOGICAL, dl, OPTIONAL, kind, BT_INTEGER, di, OPTIONAL);
3436 : :
3437 : 60888 : make_generic ("verify", GFC_ISYM_VERIFY, GFC_STD_F95);
3438 : :
3439 : 60888 : add_sym_1 ("loc", GFC_ISYM_LOC, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, ii,
3440 : : GFC_STD_GNU, gfc_check_loc, NULL, gfc_resolve_loc,
3441 : : x, BT_UNKNOWN, 0, REQUIRED);
3442 : :
3443 : 60888 : make_generic ("loc", GFC_ISYM_LOC, GFC_STD_GNU);
3444 : :
3445 : :
3446 : : /* The degree trigonometric functions were added as part of the DEC
3447 : : Fortran compatibility effort, and were hidden behind a -fdec-math
3448 : : option. Fortran 2023 has added some of these functions to Fortran
3449 : : standard as generic subprogram, e.g., acosd() is added while dacosd()
3450 : : is not. So, update GFC_STD_GNU to GFC_STD_F2023 for the generic
3451 : : functions. */
3452 : :
3453 : 60888 : add_sym_1 ("acosd", GFC_ISYM_ACOSD, CLASS_ELEMENTAL, ACTUAL_YES,
3454 : : BT_REAL, dr, GFC_STD_F2023,
3455 : : gfc_check_fn_r, gfc_simplify_acosd, gfc_resolve_trigd,
3456 : : x, BT_REAL, dr, REQUIRED);
3457 : :
3458 : 60888 : make_generic ("acosd", GFC_ISYM_ACOSD, GFC_STD_F2023);
3459 : :
3460 : 60888 : add_sym_1 ("dacosd", GFC_ISYM_ACOSD, CLASS_ELEMENTAL, ACTUAL_YES,
3461 : : BT_REAL, dd, GFC_STD_GNU,
3462 : : gfc_check_fn_d, gfc_simplify_acosd, gfc_resolve_trigd,
3463 : : x, BT_REAL, dd, REQUIRED);
3464 : :
3465 : 60888 : add_sym_1 ("asind", GFC_ISYM_ASIND, CLASS_ELEMENTAL, ACTUAL_YES,
3466 : : BT_REAL, dr, GFC_STD_F2023,
3467 : : gfc_check_fn_r, gfc_simplify_asind, gfc_resolve_trigd,
3468 : : x, BT_REAL, dr, REQUIRED);
3469 : :
3470 : 60888 : make_generic ("asind", GFC_ISYM_ASIND, GFC_STD_F2023);
3471 : :
3472 : 60888 : add_sym_1 ("dasind", GFC_ISYM_ASIND, CLASS_ELEMENTAL, ACTUAL_YES,
3473 : : BT_REAL, dd, GFC_STD_GNU,
3474 : : gfc_check_fn_d, gfc_simplify_asind, gfc_resolve_trigd,
3475 : : x, BT_REAL, dd, REQUIRED);
3476 : :
3477 : 60888 : add_sym_1 ("atand", GFC_ISYM_ATAND, CLASS_ELEMENTAL, ACTUAL_YES,
3478 : : BT_REAL, dr, GFC_STD_F2023,
3479 : : gfc_check_fn_r, gfc_simplify_atand, gfc_resolve_trigd,
3480 : : x, BT_REAL, dr, REQUIRED);
3481 : :
3482 : 60888 : make_generic ("atand", GFC_ISYM_ATAND, GFC_STD_F2023);
3483 : :
3484 : 60888 : add_sym_1 ("datand", GFC_ISYM_ATAND, CLASS_ELEMENTAL, ACTUAL_YES,
3485 : : BT_REAL, dd, GFC_STD_GNU,
3486 : : gfc_check_fn_d, gfc_simplify_atand, gfc_resolve_trigd,
3487 : : x, BT_REAL, dd, REQUIRED);
3488 : :
3489 : 60888 : add_sym_2 ("atan2d", GFC_ISYM_ATAN2D, CLASS_ELEMENTAL, ACTUAL_YES,
3490 : : BT_REAL, dr, GFC_STD_F2023,
3491 : : gfc_check_atan2, gfc_simplify_atan2d, gfc_resolve_trigd2,
3492 : : y, BT_REAL, dr, REQUIRED,
3493 : : x, BT_REAL, dr, REQUIRED);
3494 : :
3495 : 60888 : make_generic ("atan2d", GFC_ISYM_ATAN2D, GFC_STD_F2023);
3496 : :
3497 : 60888 : add_sym_2 ("datan2d", GFC_ISYM_ATAN2D, CLASS_ELEMENTAL, ACTUAL_YES,
3498 : : BT_REAL, dd, GFC_STD_GNU,
3499 : : gfc_check_datan2, gfc_simplify_atan2d, gfc_resolve_trigd2,
3500 : : y, BT_REAL, dd, REQUIRED,
3501 : : x, BT_REAL, dd, REQUIRED);
3502 : :
3503 : 60888 : add_sym_1 ("cosd", GFC_ISYM_COSD, CLASS_ELEMENTAL, ACTUAL_YES,
3504 : : BT_REAL, dr, GFC_STD_F2023,
3505 : : gfc_check_fn_r, gfc_simplify_cosd, gfc_resolve_trigd,
3506 : : x, BT_REAL, dr, REQUIRED);
3507 : :
3508 : 60888 : make_generic ("cosd", GFC_ISYM_COSD, GFC_STD_F2023);
3509 : :
3510 : 60888 : add_sym_1 ("dcosd", GFC_ISYM_COSD, CLASS_ELEMENTAL, ACTUAL_YES,
3511 : : BT_REAL, dd, GFC_STD_GNU,
3512 : : gfc_check_fn_d, gfc_simplify_cosd, gfc_resolve_trigd,
3513 : : x, BT_REAL, dd, REQUIRED);
3514 : :
3515 : 60888 : add_sym_1 ("cotan", GFC_ISYM_COTAN, CLASS_ELEMENTAL, ACTUAL_YES,
3516 : : BT_REAL, dr, GFC_STD_GNU,
3517 : : gfc_check_fn_rc2008, gfc_simplify_cotan, gfc_resolve_trigd,
3518 : : x, BT_REAL, dr, REQUIRED);
3519 : :
3520 : 60888 : add_sym_1 ("dcotan", GFC_ISYM_COTAN, CLASS_ELEMENTAL, ACTUAL_YES,
3521 : : BT_REAL, dd, GFC_STD_GNU,
3522 : : gfc_check_fn_d, gfc_simplify_cotan, gfc_resolve_trigd,
3523 : : x, BT_REAL, dd, REQUIRED);
3524 : :
3525 : 60888 : add_sym_1 ("ccotan", GFC_ISYM_COTAN, CLASS_ELEMENTAL, ACTUAL_YES,
3526 : : BT_COMPLEX, dz, GFC_STD_GNU,
3527 : : NULL, gfc_simplify_cotan, gfc_resolve_trigd,
3528 : : x, BT_COMPLEX, dz, REQUIRED);
3529 : :
3530 : 60888 : add_sym_1 ("zcotan", GFC_ISYM_COTAN, CLASS_ELEMENTAL, ACTUAL_YES,
3531 : : BT_COMPLEX, dd, GFC_STD_GNU,
3532 : : NULL, gfc_simplify_cotan, gfc_resolve_trigd,
3533 : : x, BT_COMPLEX, dd, REQUIRED);
3534 : :
3535 : 60888 : make_generic ("cotan", GFC_ISYM_COTAN, GFC_STD_GNU);
3536 : :
3537 : 60888 : add_sym_1 ("cotand", GFC_ISYM_COTAND, CLASS_ELEMENTAL, ACTUAL_YES,
3538 : : BT_REAL, dr, GFC_STD_GNU,
3539 : : gfc_check_fn_r, gfc_simplify_cotand, gfc_resolve_trigd,
3540 : : x, BT_REAL, dr, REQUIRED);
3541 : :
3542 : 60888 : add_sym_1 ("dcotand", GFC_ISYM_COTAND, CLASS_ELEMENTAL, ACTUAL_YES,
3543 : : BT_REAL, dd, GFC_STD_GNU,
3544 : : gfc_check_fn_d, gfc_simplify_cotand, gfc_resolve_trigd,
3545 : : x, BT_REAL, dd, REQUIRED);
3546 : :
3547 : 60888 : make_generic ("cotand", GFC_ISYM_COTAND, GFC_STD_GNU);
3548 : :
3549 : 60888 : add_sym_1 ("sind", GFC_ISYM_SIND, CLASS_ELEMENTAL, ACTUAL_YES,
3550 : : BT_REAL, dr, GFC_STD_F2023,
3551 : : gfc_check_fn_r, gfc_simplify_sind, gfc_resolve_trigd,
3552 : : x, BT_REAL, dr, REQUIRED);
3553 : :
3554 : 60888 : make_generic ("sind", GFC_ISYM_SIND, GFC_STD_F2023);
3555 : :
3556 : 60888 : add_sym_1 ("dsind", GFC_ISYM_SIND, CLASS_ELEMENTAL, ACTUAL_YES,
3557 : : BT_REAL, dd, GFC_STD_GNU,
3558 : : gfc_check_fn_d, gfc_simplify_sind, gfc_resolve_trigd,
3559 : : x, BT_REAL, dd, REQUIRED);
3560 : :
3561 : 60888 : add_sym_1 ("tand", GFC_ISYM_TAND, CLASS_ELEMENTAL, ACTUAL_YES,
3562 : : BT_REAL, dr, GFC_STD_F2023,
3563 : : gfc_check_fn_r, gfc_simplify_tand, gfc_resolve_trigd,
3564 : : x, BT_REAL, dr, REQUIRED);
3565 : :
3566 : 60888 : make_generic ("tand", GFC_ISYM_TAND, GFC_STD_F2023);
3567 : :
3568 : 60888 : add_sym_1 ("dtand", GFC_ISYM_TAND, CLASS_ELEMENTAL, ACTUAL_YES,
3569 : : BT_REAL, dd, GFC_STD_GNU,
3570 : : gfc_check_fn_d, gfc_simplify_tand, gfc_resolve_trigd,
3571 : : x, BT_REAL, dd, REQUIRED);
3572 : :
3573 : : /* The following function is internally used for coarray libray functions.
3574 : : "make_from_module" makes it inaccessible for external users. */
3575 : 60888 : add_sym_1 (GFC_PREFIX ("caf_get"), GFC_ISYM_CAF_GET, CLASS_IMPURE, ACTUAL_NO,
3576 : : BT_REAL, dr, GFC_STD_GNU, NULL, NULL, NULL,
3577 : : x, BT_REAL, dr, REQUIRED);
3578 : 60888 : make_from_module();
3579 : :
3580 : 60888 : add_sym_3 (GFC_PREFIX ("caf_is_present_on_remote"),
3581 : : GFC_ISYM_CAF_IS_PRESENT_ON_REMOTE, CLASS_IMPURE, ACTUAL_NO,
3582 : : BT_LOGICAL, dl, GFC_STD_GNU, NULL, NULL, NULL, ca, BT_VOID, di,
3583 : : REQUIRED, val, BT_INTEGER, di, REQUIRED, i, BT_INTEGER, di,
3584 : : REQUIRED);
3585 : 60888 : make_from_module ();
3586 : 60888 : }
3587 : :
3588 : :
3589 : : /* Add intrinsic subroutines. */
3590 : :
3591 : : static void
3592 : 60888 : add_subroutines (void)
3593 : : {
3594 : : /* Argument names. These are used as argument keywords and so need to
3595 : : match the documentation. Please keep this list in sorted order. */
3596 : 60888 : static const char
3597 : : *a = "a", *c_ = "c", *c = "count", *cm = "count_max", *com = "command",
3598 : : *cr = "count_rate", *dt = "date", *errmsg = "errmsg", *f = "from",
3599 : : *fp = "frompos", *gt = "get", *h = "harvest", *han = "handler",
3600 : : *length = "length", *ln = "len", *md = "mode", *msk = "mask",
3601 : : *name = "name", *num = "number", *of = "offset", *old = "old",
3602 : : *p1 = "path1", *p2 = "path2", *pid = "pid", *pos = "pos",
3603 : : *pt = "put", *ptr = "ptr", *res = "result",
3604 : : *result_image = "result_image", *sec = "seconds", *sig = "sig",
3605 : : *st = "status", *stat = "stat", *sz = "size", *t = "to",
3606 : : *tm = "time", *tp = "topos", *trim_name = "trim_name", *ut = "unit",
3607 : : *val = "value", *vl = "values", *whence = "whence", *zn = "zone";
3608 : :
3609 : 60888 : int di, dr, dc, dl, ii;
3610 : :
3611 : 60888 : di = gfc_default_integer_kind;
3612 : 60888 : dr = gfc_default_real_kind;
3613 : 60888 : dc = gfc_default_character_kind;
3614 : 60888 : dl = gfc_default_logical_kind;
3615 : 60888 : ii = gfc_index_integer_kind;
3616 : :
3617 : 60888 : add_sym_0s ("abort", GFC_ISYM_ABORT, GFC_STD_GNU, NULL);
3618 : :
3619 : 60888 : make_noreturn();
3620 : :
3621 : 60888 : add_sym_3s ("atomic_define", GFC_ISYM_ATOMIC_DEF, CLASS_ATOMIC,
3622 : : BT_UNKNOWN, 0, GFC_STD_F2008,
3623 : : gfc_check_atomic_def, NULL, gfc_resolve_atomic_def,
3624 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3625 : : "value", BT_INTEGER, di, REQUIRED, INTENT_IN,
3626 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3627 : :
3628 : 60888 : add_sym_3s ("atomic_ref", GFC_ISYM_ATOMIC_REF, CLASS_ATOMIC,
3629 : : BT_UNKNOWN, 0, GFC_STD_F2008,
3630 : : gfc_check_atomic_ref, NULL, gfc_resolve_atomic_ref,
3631 : : "value", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3632 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_IN,
3633 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3634 : :
3635 : 60888 : add_sym_5s ("atomic_cas", GFC_ISYM_ATOMIC_CAS, CLASS_ATOMIC,
3636 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3637 : : gfc_check_atomic_cas, NULL, NULL,
3638 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_INOUT,
3639 : : "old", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3640 : : "compare", BT_INTEGER, di, REQUIRED, INTENT_IN,
3641 : : "new", BT_INTEGER, di, REQUIRED, INTENT_IN,
3642 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3643 : :
3644 : 60888 : add_sym_3s ("atomic_add", GFC_ISYM_ATOMIC_ADD, CLASS_ATOMIC,
3645 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3646 : : gfc_check_atomic_op, NULL, NULL,
3647 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3648 : : "value", BT_INTEGER, di, REQUIRED, INTENT_IN,
3649 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3650 : :
3651 : 60888 : add_sym_3s ("atomic_and", GFC_ISYM_ATOMIC_AND, CLASS_ATOMIC,
3652 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3653 : : gfc_check_atomic_op, NULL, NULL,
3654 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3655 : : "value", BT_INTEGER, di, REQUIRED, INTENT_IN,
3656 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3657 : :
3658 : 60888 : add_sym_3s ("atomic_or", GFC_ISYM_ATOMIC_OR, CLASS_ATOMIC,
3659 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3660 : : gfc_check_atomic_op, NULL, NULL,
3661 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3662 : : "value", BT_INTEGER, di, REQUIRED, INTENT_IN,
3663 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3664 : :
3665 : 60888 : add_sym_3s ("atomic_xor", GFC_ISYM_ATOMIC_XOR, CLASS_ATOMIC,
3666 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3667 : : gfc_check_atomic_op, NULL, NULL,
3668 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3669 : : "value", BT_INTEGER, di, REQUIRED, INTENT_IN,
3670 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3671 : :
3672 : 60888 : add_sym_4s ("atomic_fetch_add", GFC_ISYM_ATOMIC_FETCH_ADD, CLASS_ATOMIC,
3673 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3674 : : gfc_check_atomic_fetch_op, NULL, NULL,
3675 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3676 : : "value", BT_INTEGER, di, REQUIRED, INTENT_IN,
3677 : : "old", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3678 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3679 : :
3680 : 60888 : add_sym_4s ("atomic_fetch_and", GFC_ISYM_ATOMIC_FETCH_AND, CLASS_ATOMIC,
3681 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3682 : : gfc_check_atomic_fetch_op, NULL, NULL,
3683 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3684 : : "value", BT_INTEGER, di, REQUIRED, INTENT_IN,
3685 : : "old", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3686 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3687 : :
3688 : 60888 : add_sym_4s ("atomic_fetch_or", GFC_ISYM_ATOMIC_FETCH_OR, CLASS_ATOMIC,
3689 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3690 : : gfc_check_atomic_fetch_op, NULL, NULL,
3691 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3692 : : "value", BT_INTEGER, di, REQUIRED, INTENT_IN,
3693 : : "old", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3694 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3695 : :
3696 : 60888 : add_sym_4s ("atomic_fetch_xor", GFC_ISYM_ATOMIC_FETCH_XOR, CLASS_ATOMIC,
3697 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3698 : : gfc_check_atomic_fetch_op, NULL, NULL,
3699 : : "atom", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3700 : : "value", BT_INTEGER, di, REQUIRED, INTENT_IN,
3701 : : "old", BT_INTEGER, di, REQUIRED, INTENT_OUT,
3702 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3703 : :
3704 : 60888 : add_sym_0s ("backtrace", GFC_ISYM_BACKTRACE, GFC_STD_GNU, NULL);
3705 : :
3706 : 60888 : add_sym_1s ("cpu_time", GFC_ISYM_CPU_TIME, CLASS_IMPURE, BT_UNKNOWN, 0,
3707 : : GFC_STD_F95, gfc_check_cpu_time, NULL, gfc_resolve_cpu_time,
3708 : : tm, BT_REAL, dr, REQUIRED, INTENT_OUT);
3709 : :
3710 : 60888 : add_sym_3s ("event_query", GFC_ISYM_EVENT_QUERY, CLASS_ATOMIC,
3711 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3712 : : gfc_check_event_query, NULL, gfc_resolve_event_query,
3713 : : "event", BT_INTEGER, di, REQUIRED, INTENT_IN,
3714 : : c, BT_INTEGER, di, OPTIONAL, INTENT_IN,
3715 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3716 : :
3717 : : /* More G77 compatibility garbage. */
3718 : 60888 : add_sym_2s ("ctime", GFC_ISYM_CTIME, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3719 : : gfc_check_ctime_sub, NULL, gfc_resolve_ctime_sub,
3720 : : tm, BT_INTEGER, di, REQUIRED, INTENT_IN,
3721 : : res, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
3722 : :
3723 : 60888 : add_sym_1s ("idate", GFC_ISYM_IDATE, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3724 : : gfc_check_itime_idate, NULL, gfc_resolve_idate,
3725 : : vl, BT_INTEGER, 4, REQUIRED, INTENT_OUT);
3726 : :
3727 : 60888 : add_sym_1s ("itime", GFC_ISYM_ITIME, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3728 : : gfc_check_itime_idate, NULL, gfc_resolve_itime,
3729 : : vl, BT_INTEGER, 4, REQUIRED, INTENT_OUT);
3730 : :
3731 : 60888 : add_sym_2s ("ltime", GFC_ISYM_LTIME, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3732 : : gfc_check_ltime_gmtime, NULL, gfc_resolve_ltime,
3733 : : tm, BT_INTEGER, di, REQUIRED, INTENT_IN,
3734 : : vl, BT_INTEGER, di, REQUIRED, INTENT_OUT);
3735 : :
3736 : 60888 : add_sym_2s ("gmtime", GFC_ISYM_GMTIME, CLASS_IMPURE, BT_UNKNOWN, 0,
3737 : : GFC_STD_GNU, gfc_check_ltime_gmtime, NULL, gfc_resolve_gmtime,
3738 : : tm, BT_INTEGER, di, REQUIRED, INTENT_IN,
3739 : : vl, BT_INTEGER, di, REQUIRED, INTENT_OUT);
3740 : :
3741 : 60888 : add_sym_1s ("second", GFC_ISYM_SECOND, CLASS_IMPURE, BT_UNKNOWN, 0,
3742 : : GFC_STD_GNU, gfc_check_second_sub, NULL, gfc_resolve_second_sub,
3743 : : tm, BT_REAL, dr, REQUIRED, INTENT_OUT);
3744 : :
3745 : 60888 : add_sym_2s ("chdir", GFC_ISYM_CHDIR, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3746 : : gfc_check_chdir_sub, NULL, gfc_resolve_chdir_sub,
3747 : : name, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
3748 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3749 : :
3750 : 60888 : add_sym_3s ("chmod", GFC_ISYM_CHMOD, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3751 : : gfc_check_chmod_sub, NULL, gfc_resolve_chmod_sub,
3752 : : name, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
3753 : : md, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
3754 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3755 : :
3756 : 60888 : add_sym_4s ("date_and_time", GFC_ISYM_DATE_AND_TIME, CLASS_IMPURE, BT_UNKNOWN,
3757 : : 0, GFC_STD_F95, gfc_check_date_and_time, NULL, NULL,
3758 : : dt, BT_CHARACTER, dc, OPTIONAL, INTENT_OUT,
3759 : : tm, BT_CHARACTER, dc, OPTIONAL, INTENT_OUT,
3760 : : zn, BT_CHARACTER, dc, OPTIONAL, INTENT_OUT,
3761 : : vl, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3762 : :
3763 : : /* More G77 compatibility garbage. */
3764 : 60888 : add_sym_2s ("etime", GFC_ISYM_ETIME, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3765 : : gfc_check_dtime_etime_sub, NULL, gfc_resolve_etime_sub,
3766 : : vl, BT_REAL, 4, REQUIRED, INTENT_OUT,
3767 : : tm, BT_REAL, 4, REQUIRED, INTENT_OUT);
3768 : :
3769 : 60888 : add_sym_2s ("dtime", GFC_ISYM_DTIME, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3770 : : gfc_check_dtime_etime_sub, NULL, gfc_resolve_dtime_sub,
3771 : : vl, BT_REAL, 4, REQUIRED, INTENT_OUT,
3772 : : tm, BT_REAL, 4, REQUIRED, INTENT_OUT);
3773 : :
3774 : 60888 : add_sym_5s ("execute_command_line", GFC_ISYM_EXECUTE_COMMAND_LINE,
3775 : : CLASS_IMPURE , BT_UNKNOWN, 0, GFC_STD_F2008,
3776 : : NULL, NULL, gfc_resolve_execute_command_line,
3777 : : "command", BT_CHARACTER, dc, REQUIRED, INTENT_IN,
3778 : : "wait", BT_LOGICAL, dl, OPTIONAL, INTENT_IN,
3779 : : "exitstat", BT_INTEGER, di, OPTIONAL, INTENT_INOUT,
3780 : : "cmdstat", BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3781 : : "cmdmsg", BT_CHARACTER, dc, OPTIONAL, INTENT_INOUT);
3782 : :
3783 : 60888 : add_sym_1s ("fdate", GFC_ISYM_FDATE, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3784 : : gfc_check_fdate_sub, NULL, gfc_resolve_fdate_sub,
3785 : : dt, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
3786 : :
3787 : 60888 : add_sym_1s ("gerror", GFC_ISYM_GERROR, CLASS_IMPURE, BT_UNKNOWN,
3788 : : 0, GFC_STD_GNU, gfc_check_gerror, NULL, gfc_resolve_gerror,
3789 : : res, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
3790 : :
3791 : 60888 : add_sym_2s ("getcwd", GFC_ISYM_GETCWD, CLASS_IMPURE, BT_UNKNOWN, 0,
3792 : : GFC_STD_GNU, gfc_check_getcwd_sub, NULL, gfc_resolve_getcwd_sub,
3793 : : c, BT_CHARACTER, dc, REQUIRED, INTENT_OUT,
3794 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3795 : :
3796 : 60888 : add_sym_2s ("getenv", GFC_ISYM_GETENV, CLASS_IMPURE, BT_UNKNOWN,
3797 : : 0, GFC_STD_GNU, NULL, NULL, NULL,
3798 : : name, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
3799 : : val, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
3800 : :
3801 : 60888 : add_sym_2s ("getarg", GFC_ISYM_GETARG, CLASS_IMPURE, BT_UNKNOWN,
3802 : : 0, GFC_STD_GNU, gfc_check_getarg, NULL, gfc_resolve_getarg,
3803 : : pos, BT_INTEGER, di, REQUIRED, INTENT_IN,
3804 : : val, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
3805 : :
3806 : 60888 : add_sym_1s ("getlog", GFC_ISYM_GETLOG, CLASS_IMPURE, BT_UNKNOWN,
3807 : : 0, GFC_STD_GNU, gfc_check_getlog, NULL, gfc_resolve_getlog,
3808 : : c, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
3809 : :
3810 : : /* F2003 commandline routines. */
3811 : :
3812 : 60888 : add_sym_3s ("get_command", GFC_ISYM_GET_COMMAND, CLASS_IMPURE,
3813 : : BT_UNKNOWN, 0, GFC_STD_F2003,
3814 : : NULL, NULL, gfc_resolve_get_command,
3815 : : com, BT_CHARACTER, dc, OPTIONAL, INTENT_OUT,
3816 : : length, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3817 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3818 : :
3819 : 60888 : add_sym_4s ("get_command_argument", GFC_ISYM_GET_COMMAND_ARGUMENT,
3820 : : CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_F2003, NULL, NULL,
3821 : : gfc_resolve_get_command_argument,
3822 : : num, BT_INTEGER, di, REQUIRED, INTENT_IN,
3823 : : val, BT_CHARACTER, dc, OPTIONAL, INTENT_OUT,
3824 : : length, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3825 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3826 : :
3827 : : /* F2003 subroutine to get environment variables. */
3828 : :
3829 : 60888 : add_sym_5s ("get_environment_variable", GFC_ISYM_GET_ENVIRONMENT_VARIABLE,
3830 : : CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_F2003,
3831 : : NULL, NULL, gfc_resolve_get_environment_variable,
3832 : : name, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
3833 : : val, BT_CHARACTER, dc, OPTIONAL, INTENT_OUT,
3834 : : length, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3835 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3836 : : trim_name, BT_LOGICAL, dl, OPTIONAL, INTENT_IN);
3837 : :
3838 : 60888 : add_sym_2s ("move_alloc", GFC_ISYM_MOVE_ALLOC, CLASS_PURE, BT_UNKNOWN, 0,
3839 : : GFC_STD_F2003,
3840 : : gfc_check_move_alloc, NULL, NULL,
3841 : : f, BT_UNKNOWN, 0, REQUIRED, INTENT_INOUT,
3842 : : t, BT_UNKNOWN, 0, REQUIRED, INTENT_OUT);
3843 : :
3844 : 60888 : add_sym_5s ("mvbits", GFC_ISYM_MVBITS, CLASS_ELEMENTAL, BT_UNKNOWN, 0,
3845 : : GFC_STD_F95, gfc_check_mvbits, NULL, gfc_resolve_mvbits,
3846 : : f, BT_INTEGER, di, REQUIRED, INTENT_IN,
3847 : : fp, BT_INTEGER, di, REQUIRED, INTENT_IN,
3848 : : ln, BT_INTEGER, di, REQUIRED, INTENT_IN,
3849 : : t, BT_INTEGER, di, REQUIRED, INTENT_INOUT,
3850 : : tp, BT_INTEGER, di, REQUIRED, INTENT_IN);
3851 : :
3852 : 60888 : if (flag_dec_intrinsic_ints)
3853 : : {
3854 : 400 : make_alias ("bmvbits", GFC_STD_GNU);
3855 : 400 : make_alias ("imvbits", GFC_STD_GNU);
3856 : 400 : make_alias ("jmvbits", GFC_STD_GNU);
3857 : 400 : make_alias ("kmvbits", GFC_STD_GNU);
3858 : : }
3859 : :
3860 : 60888 : add_sym_2s ("random_init", GFC_ISYM_RANDOM_INIT, CLASS_IMPURE,
3861 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3862 : : gfc_check_random_init, NULL, gfc_resolve_random_init,
3863 : : "repeatable", BT_LOGICAL, dl, REQUIRED, INTENT_IN,
3864 : : "image_distinct", BT_LOGICAL, dl, REQUIRED, INTENT_IN);
3865 : :
3866 : 60888 : add_sym_1s ("random_number", GFC_ISYM_RANDOM_NUMBER, CLASS_IMPURE,
3867 : : BT_UNKNOWN, 0, GFC_STD_F95,
3868 : : gfc_check_random_number, NULL, gfc_resolve_random_number,
3869 : : h, BT_REAL, dr, REQUIRED, INTENT_OUT);
3870 : :
3871 : 60888 : add_sym_3s ("random_seed", GFC_ISYM_RANDOM_SEED, CLASS_IMPURE,
3872 : : BT_UNKNOWN, 0, GFC_STD_F95,
3873 : : gfc_check_random_seed, NULL, gfc_resolve_random_seed,
3874 : : sz, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3875 : : pt, BT_INTEGER, di, OPTIONAL, INTENT_IN,
3876 : : gt, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3877 : :
3878 : : /* The following subroutines are part of ISO_C_BINDING. */
3879 : :
3880 : 60888 : add_sym_3s ("c_f_pointer", GFC_ISYM_C_F_POINTER, CLASS_IMPURE, BT_UNKNOWN, 0,
3881 : : GFC_STD_F2003, gfc_check_c_f_pointer, NULL, NULL,
3882 : : "cptr", BT_VOID, 0, REQUIRED, INTENT_IN,
3883 : : "fptr", BT_UNKNOWN, 0, REQUIRED, INTENT_OUT,
3884 : : "shape", BT_INTEGER, di, OPTIONAL, INTENT_IN);
3885 : 60888 : make_from_module();
3886 : :
3887 : 60888 : add_sym_2s ("c_f_procpointer", GFC_ISYM_C_F_PROCPOINTER, CLASS_IMPURE,
3888 : : BT_UNKNOWN, 0, GFC_STD_F2003, gfc_check_c_f_procpointer,
3889 : : NULL, NULL,
3890 : : "cptr", BT_VOID, 0, REQUIRED, INTENT_IN,
3891 : : "fptr", BT_UNKNOWN, 0, REQUIRED, INTENT_OUT);
3892 : 60888 : make_from_module();
3893 : :
3894 : : /* Internal subroutine for emitting a runtime error. */
3895 : :
3896 : 60888 : add_sym_1p ("fe_runtime_error", GFC_ISYM_FE_RUNTIME_ERROR, CLASS_IMPURE,
3897 : : BT_UNKNOWN, 0, GFC_STD_GNU,
3898 : : gfc_check_fe_runtime_error, NULL, gfc_resolve_fe_runtime_error,
3899 : : "msg", BT_CHARACTER, dc, REQUIRED, INTENT_IN);
3900 : :
3901 : 60888 : make_noreturn ();
3902 : 60888 : make_vararg ();
3903 : 60888 : make_from_module ();
3904 : :
3905 : : /* Coarray collectives. */
3906 : 60888 : add_sym_4s ("co_broadcast", GFC_ISYM_CO_BROADCAST, CLASS_IMPURE,
3907 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3908 : : gfc_check_co_broadcast, NULL, NULL,
3909 : : a, BT_REAL, dr, REQUIRED, INTENT_INOUT,
3910 : : "source_image", BT_INTEGER, di, REQUIRED, INTENT_IN,
3911 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3912 : : errmsg, BT_CHARACTER, dc, OPTIONAL, INTENT_INOUT);
3913 : :
3914 : 60888 : add_sym_4s ("co_max", GFC_ISYM_CO_MAX, CLASS_IMPURE,
3915 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3916 : : gfc_check_co_minmax, NULL, NULL,
3917 : : a, BT_REAL, dr, REQUIRED, INTENT_INOUT,
3918 : : result_image, BT_INTEGER, di, OPTIONAL, INTENT_IN,
3919 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3920 : : errmsg, BT_CHARACTER, dc, OPTIONAL, INTENT_INOUT);
3921 : :
3922 : 60888 : add_sym_4s ("co_min", GFC_ISYM_CO_MIN, CLASS_IMPURE,
3923 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3924 : : gfc_check_co_minmax, NULL, NULL,
3925 : : a, BT_REAL, dr, REQUIRED, INTENT_INOUT,
3926 : : result_image, BT_INTEGER, di, OPTIONAL, INTENT_IN,
3927 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3928 : : errmsg, BT_CHARACTER, dc, OPTIONAL, INTENT_INOUT);
3929 : :
3930 : 60888 : add_sym_4s ("co_sum", GFC_ISYM_CO_SUM, CLASS_IMPURE,
3931 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3932 : : gfc_check_co_sum, NULL, NULL,
3933 : : a, BT_REAL, dr, REQUIRED, INTENT_INOUT,
3934 : : result_image, BT_INTEGER, di, OPTIONAL, INTENT_IN,
3935 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3936 : : errmsg, BT_CHARACTER, dc, OPTIONAL, INTENT_INOUT);
3937 : :
3938 : 60888 : add_sym_5s ("co_reduce", GFC_ISYM_CO_REDUCE, CLASS_IMPURE,
3939 : : BT_UNKNOWN, 0, GFC_STD_F2018,
3940 : : gfc_check_co_reduce, NULL, NULL,
3941 : : a, BT_REAL, dr, REQUIRED, INTENT_INOUT,
3942 : : "operation", BT_INTEGER, di, REQUIRED, INTENT_IN,
3943 : : result_image, BT_INTEGER, di, OPTIONAL, INTENT_IN,
3944 : : stat, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
3945 : : errmsg, BT_CHARACTER, dc, OPTIONAL, INTENT_INOUT);
3946 : :
3947 : :
3948 : : /* The following subroutine is internally used for coarray libray functions.
3949 : : "make_from_module" makes it inaccessible for external users. */
3950 : 60888 : add_sym_2s (GFC_PREFIX ("caf_send"), GFC_ISYM_CAF_SEND, CLASS_IMPURE,
3951 : : BT_UNKNOWN, 0, GFC_STD_GNU, NULL, NULL, NULL,
3952 : : "x", BT_REAL, dr, REQUIRED, INTENT_OUT,
3953 : : "y", BT_REAL, dr, REQUIRED, INTENT_IN);
3954 : 60888 : make_from_module();
3955 : :
3956 : 60888 : add_sym_2s (GFC_PREFIX ("caf_sendget"), GFC_ISYM_CAF_SENDGET, CLASS_IMPURE,
3957 : : BT_UNKNOWN, 0, GFC_STD_GNU, NULL, NULL, NULL, "x", BT_REAL, dr,
3958 : : REQUIRED, INTENT_OUT, "y", BT_REAL, dr, REQUIRED, INTENT_IN);
3959 : 60888 : make_from_module ();
3960 : :
3961 : : /* More G77 compatibility garbage. */
3962 : 60888 : add_sym_3s ("alarm", GFC_ISYM_ALARM, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3963 : : gfc_check_alarm_sub, NULL, gfc_resolve_alarm_sub,
3964 : : sec, BT_INTEGER, di, REQUIRED, INTENT_IN,
3965 : : han, BT_UNKNOWN, 0, REQUIRED, INTENT_IN,
3966 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3967 : :
3968 : 60888 : add_sym_1s ("srand", GFC_ISYM_SRAND, CLASS_IMPURE, BT_UNKNOWN,
3969 : : di, GFC_STD_GNU, gfc_check_srand, NULL, gfc_resolve_srand,
3970 : : "seed", BT_INTEGER, 4, REQUIRED, INTENT_IN);
3971 : :
3972 : 60888 : add_sym_1s ("exit", GFC_ISYM_EXIT, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3973 : : gfc_check_exit, NULL, gfc_resolve_exit,
3974 : : st, BT_INTEGER, di, OPTIONAL, INTENT_IN);
3975 : :
3976 : 60888 : make_noreturn();
3977 : :
3978 : 60888 : add_sym_3s ("fgetc", GFC_ISYM_FGETC, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3979 : : gfc_check_fgetputc_sub, NULL, gfc_resolve_fgetc_sub,
3980 : : ut, BT_INTEGER, di, REQUIRED, INTENT_IN,
3981 : : c_, BT_CHARACTER, dc, REQUIRED, INTENT_OUT,
3982 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3983 : :
3984 : 60888 : add_sym_2s ("fget", GFC_ISYM_FGET, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3985 : : gfc_check_fgetput_sub, NULL, gfc_resolve_fget_sub,
3986 : : c_, BT_CHARACTER, dc, REQUIRED, INTENT_OUT,
3987 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3988 : :
3989 : 60888 : add_sym_1s ("flush", GFC_ISYM_FLUSH, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3990 : : gfc_check_flush, NULL, gfc_resolve_flush,
3991 : : ut, BT_INTEGER, di, OPTIONAL, INTENT_IN);
3992 : :
3993 : 60888 : add_sym_3s ("fputc", GFC_ISYM_FPUTC, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
3994 : : gfc_check_fgetputc_sub, NULL, gfc_resolve_fputc_sub,
3995 : : ut, BT_INTEGER, di, REQUIRED, INTENT_IN,
3996 : : c_, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
3997 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
3998 : :
3999 : 60888 : add_sym_2s ("fput", GFC_ISYM_FPUT, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4000 : : gfc_check_fgetput_sub, NULL, gfc_resolve_fput_sub,
4001 : : c_, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4002 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4003 : :
4004 : 60888 : add_sym_1s ("free", GFC_ISYM_FREE, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4005 : : gfc_check_free, NULL, NULL,
4006 : : ptr, BT_INTEGER, ii, REQUIRED, INTENT_INOUT);
4007 : :
4008 : 60888 : add_sym_4s ("fseek", GFC_ISYM_FSEEK, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4009 : : gfc_check_fseek_sub, NULL, gfc_resolve_fseek_sub,
4010 : : ut, BT_INTEGER, di, REQUIRED, INTENT_IN,
4011 : : of, BT_INTEGER, di, REQUIRED, INTENT_IN,
4012 : : whence, BT_INTEGER, di, REQUIRED, INTENT_IN,
4013 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4014 : :
4015 : 60888 : add_sym_2s ("ftell", GFC_ISYM_FTELL, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4016 : : gfc_check_ftell_sub, NULL, gfc_resolve_ftell_sub,
4017 : : ut, BT_INTEGER, di, REQUIRED, INTENT_IN,
4018 : : of, BT_INTEGER, ii, REQUIRED, INTENT_OUT);
4019 : :
4020 : 60888 : add_sym_2s ("hostnm", GFC_ISYM_HOSTNM, CLASS_IMPURE, BT_UNKNOWN, 0,
4021 : : GFC_STD_GNU, gfc_check_hostnm_sub, NULL, gfc_resolve_hostnm_sub,
4022 : : c, BT_CHARACTER, dc, REQUIRED, INTENT_OUT,
4023 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4024 : :
4025 : 60888 : add_sym_3s ("kill", GFC_ISYM_KILL, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4026 : : gfc_check_kill_sub, NULL, NULL,
4027 : : pid, BT_INTEGER, di, REQUIRED, INTENT_IN,
4028 : : sig, BT_INTEGER, di, REQUIRED, INTENT_IN,
4029 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4030 : :
4031 : 60888 : add_sym_3s ("link", GFC_ISYM_LINK, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4032 : : gfc_check_link_sub, NULL, gfc_resolve_link_sub,
4033 : : p1, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4034 : : p2, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4035 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4036 : :
4037 : 60888 : add_sym_1s ("perror", GFC_ISYM_PERROR, CLASS_IMPURE, BT_UNKNOWN,
4038 : : 0, GFC_STD_GNU, gfc_check_perror, NULL, gfc_resolve_perror,
4039 : : "string", BT_CHARACTER, dc, REQUIRED, INTENT_IN);
4040 : :
4041 : 60888 : add_sym_3s ("rename", GFC_ISYM_RENAME, CLASS_IMPURE, BT_UNKNOWN, 0,
4042 : : GFC_STD_GNU, gfc_check_rename_sub, NULL, gfc_resolve_rename_sub,
4043 : : p1, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4044 : : p2, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4045 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4046 : :
4047 : 60888 : add_sym_1s ("sleep", GFC_ISYM_SLEEP, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4048 : : gfc_check_sleep_sub, NULL, gfc_resolve_sleep_sub,
4049 : : sec, BT_INTEGER, di, REQUIRED, INTENT_IN);
4050 : :
4051 : 60888 : add_sym_3s ("fstat", GFC_ISYM_FSTAT, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4052 : : gfc_check_fstat_sub, NULL, gfc_resolve_fstat_sub,
4053 : : ut, BT_INTEGER, di, REQUIRED, INTENT_IN,
4054 : : vl, BT_INTEGER, di, REQUIRED, INTENT_OUT,
4055 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4056 : :
4057 : 60888 : add_sym_3s ("lstat", GFC_ISYM_LSTAT, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4058 : : gfc_check_stat_sub, NULL, gfc_resolve_lstat_sub,
4059 : : name, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4060 : : vl, BT_INTEGER, di, REQUIRED, INTENT_OUT,
4061 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4062 : :
4063 : 60888 : add_sym_3s ("stat", GFC_ISYM_STAT, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4064 : : gfc_check_stat_sub, NULL, gfc_resolve_stat_sub,
4065 : : name, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4066 : : vl, BT_INTEGER, di, REQUIRED, INTENT_OUT,
4067 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4068 : :
4069 : 60888 : add_sym_3s ("signal", GFC_ISYM_SIGNAL, CLASS_IMPURE, BT_UNKNOWN, 0,
4070 : : GFC_STD_GNU, gfc_check_signal_sub, NULL, gfc_resolve_signal_sub,
4071 : : num, BT_INTEGER, di, REQUIRED, INTENT_IN,
4072 : : han, BT_UNKNOWN, 0, REQUIRED, INTENT_IN,
4073 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4074 : :
4075 : 60888 : add_sym_3s ("symlnk", GFC_ISYM_SYMLINK, CLASS_IMPURE, BT_UNKNOWN, 0,
4076 : : GFC_STD_GNU, gfc_check_symlnk_sub, NULL, gfc_resolve_symlnk_sub,
4077 : : p1, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4078 : : p2, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4079 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4080 : :
4081 : 60888 : add_sym_2s ("system", GFC_ISYM_SYSTEM, CLASS_IMPURE, BT_UNKNOWN,
4082 : : 0, GFC_STD_GNU, NULL, NULL, gfc_resolve_system_sub,
4083 : : com, BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4084 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4085 : :
4086 : 60888 : add_sym_3s ("system_clock", GFC_ISYM_SYSTEM_CLOCK, CLASS_IMPURE,
4087 : : BT_UNKNOWN, 0, GFC_STD_F95,
4088 : : gfc_check_system_clock, NULL, gfc_resolve_system_clock,
4089 : : c, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
4090 : : cr, BT_INTEGER, di, OPTIONAL, INTENT_OUT,
4091 : : cm, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4092 : :
4093 : 60888 : add_sym_2s ("ttynam", GFC_ISYM_TTYNAM, CLASS_IMPURE, BT_UNKNOWN, 0,
4094 : : GFC_STD_GNU, gfc_check_ttynam_sub, NULL, gfc_resolve_ttynam_sub,
4095 : : ut, BT_INTEGER, di, REQUIRED, INTENT_IN,
4096 : : name, BT_CHARACTER, dc, REQUIRED, INTENT_OUT);
4097 : :
4098 : 60888 : add_sym_2s ("umask", GFC_ISYM_UMASK, CLASS_IMPURE, BT_UNKNOWN, 0, GFC_STD_GNU,
4099 : : gfc_check_umask_sub, NULL, gfc_resolve_umask_sub,
4100 : : msk, BT_INTEGER, di, REQUIRED, INTENT_IN,
4101 : : old, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4102 : :
4103 : 60888 : add_sym_2s ("unlink", GFC_ISYM_UNLINK, CLASS_IMPURE, BT_UNKNOWN, 0,
4104 : : GFC_STD_GNU, gfc_check_unlink_sub, NULL, gfc_resolve_unlink_sub,
4105 : : "path", BT_CHARACTER, dc, REQUIRED, INTENT_IN,
4106 : : st, BT_INTEGER, di, OPTIONAL, INTENT_OUT);
4107 : 60888 : }
4108 : :
4109 : :
4110 : : /* Add a function to the list of conversion symbols. */
4111 : :
4112 : : static void
4113 : 14792610 : add_conv (bt from_type, int from_kind, bt to_type, int to_kind, int standard)
4114 : : {
4115 : 14792610 : gfc_typespec from, to;
4116 : 14792610 : gfc_intrinsic_sym *sym;
4117 : :
4118 : 14792610 : if (sizing == SZ_CONVS)
4119 : : {
4120 : 7396305 : nconv++;
4121 : 7396305 : return;
4122 : : }
4123 : :
4124 : 7396305 : gfc_clear_ts (&from);
4125 : 7396305 : from.type = from_type;
4126 : 7396305 : from.kind = from_kind;
4127 : :
4128 : 7396305 : gfc_clear_ts (&to);
4129 : 7396305 : to.type = to_type;
4130 : 7396305 : to.kind = to_kind;
4131 : :
4132 : 7396305 : sym = conversion + nconv;
4133 : :
4134 : 7396305 : sym->name = conv_name (&from, &to);
4135 : 7396305 : sym->lib_name = sym->name;
4136 : 7396305 : sym->simplify.cc = gfc_convert_constant;
4137 : 7396305 : sym->standard = standard;
4138 : 7396305 : sym->elemental = 1;
4139 : 7396305 : sym->pure = 1;
4140 : 7396305 : sym->conversion = 1;
4141 : 7396305 : sym->ts = to;
4142 : 7396305 : sym->id = GFC_ISYM_CONVERSION;
4143 : :
4144 : 7396305 : nconv++;
4145 : : }
4146 : :
4147 : :
4148 : : /* Create gfc_intrinsic_sym nodes for all intrinsic conversion
4149 : : functions by looping over the kind tables. */
4150 : :
4151 : : static void
4152 : 60888 : add_conversions (void)
4153 : : {
4154 : 60888 : int i, j;
4155 : :
4156 : : /* Integer-Integer conversions. */
4157 : 364514 : for (i = 0; gfc_integer_kinds[i].kind != 0; i++)
4158 : 1818500 : for (j = 0; gfc_integer_kinds[j].kind != 0; j++)
4159 : : {
4160 : 1514874 : if (i == j)
4161 : 303626 : continue;
4162 : :
4163 : 1211248 : add_conv (BT_INTEGER, gfc_integer_kinds[i].kind,
4164 : : BT_INTEGER, gfc_integer_kinds[j].kind, GFC_STD_F77);
4165 : : }
4166 : :
4167 : : /* Integer-Real/Complex conversions. */
4168 : 364514 : for (i = 0; gfc_integer_kinds[i].kind != 0; i++)
4169 : 1518130 : for (j = 0; gfc_real_kinds[j].kind != 0; j++)
4170 : : {
4171 : 1214504 : add_conv (BT_INTEGER, gfc_integer_kinds[i].kind,
4172 : : BT_REAL, gfc_real_kinds[j].kind, GFC_STD_F77);
4173 : :
4174 : 1214504 : add_conv (BT_REAL, gfc_real_kinds[j].kind,
4175 : : BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_F77);
4176 : :
4177 : 1214504 : add_conv (BT_INTEGER, gfc_integer_kinds[i].kind,
4178 : : BT_COMPLEX, gfc_real_kinds[j].kind, GFC_STD_F77);
4179 : :
4180 : 1214504 : add_conv (BT_COMPLEX, gfc_real_kinds[j].kind,
4181 : : BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_F77);
4182 : : }
4183 : :
4184 : 60888 : if (flag_unsigned)
4185 : : {
4186 : 2784 : for (i = 0; gfc_unsigned_kinds[i].kind != 0; i++)
4187 : 13920 : for (j = 0; gfc_unsigned_kinds[j].kind != 0; j++)
4188 : 11600 : if (i != j)
4189 : 9280 : add_conv (BT_UNSIGNED, gfc_unsigned_kinds[i].kind,
4190 : : BT_UNSIGNED, gfc_unsigned_kinds[j].kind, GFC_STD_GNU);
4191 : : }
4192 : :
4193 : 60888 : if ((gfc_option.allow_std & GFC_STD_LEGACY) != 0)
4194 : : {
4195 : : /* Hollerith-Integer conversions. */
4196 : 355862 : for (i = 0; gfc_integer_kinds[i].kind != 0; i++)
4197 : 296416 : add_conv (BT_HOLLERITH, gfc_default_character_kind,
4198 : : BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_LEGACY);
4199 : : /* Hollerith-Real conversions. */
4200 : 297230 : for (i = 0; gfc_real_kinds[i].kind != 0; i++)
4201 : 237784 : add_conv (BT_HOLLERITH, gfc_default_character_kind,
4202 : : BT_REAL, gfc_real_kinds[i].kind, GFC_STD_LEGACY);
4203 : : /* Hollerith-Complex conversions. */
4204 : 297230 : for (i = 0; gfc_real_kinds[i].kind != 0; i++)
4205 : 237784 : add_conv (BT_HOLLERITH, gfc_default_character_kind,
4206 : : BT_COMPLEX, gfc_real_kinds[i].kind, GFC_STD_LEGACY);
4207 : :
4208 : : /* Hollerith-Character conversions. */
4209 : 59446 : add_conv (BT_HOLLERITH, gfc_default_character_kind, BT_CHARACTER,
4210 : : gfc_default_character_kind, GFC_STD_LEGACY);
4211 : :
4212 : : /* Hollerith-Logical conversions. */
4213 : 415308 : for (i = 0; gfc_logical_kinds[i].kind != 0; i++)
4214 : 296416 : add_conv (BT_HOLLERITH, gfc_default_character_kind,
4215 : : BT_LOGICAL, gfc_logical_kinds[i].kind, GFC_STD_LEGACY);
4216 : : }
4217 : :
4218 : : /* Real/Complex - Real/Complex conversions. */
4219 : 304440 : for (i = 0; gfc_real_kinds[i].kind != 0; i++)
4220 : 1217760 : for (j = 0; gfc_real_kinds[j].kind != 0; j++)
4221 : : {
4222 : 974208 : if (i != j)
4223 : : {
4224 : 730656 : add_conv (BT_REAL, gfc_real_kinds[i].kind,
4225 : : BT_REAL, gfc_real_kinds[j].kind, GFC_STD_F77);
4226 : :
4227 : 730656 : add_conv (BT_COMPLEX, gfc_real_kinds[i].kind,
4228 : : BT_COMPLEX, gfc_real_kinds[j].kind, GFC_STD_F77);
4229 : : }
4230 : :
4231 : 974208 : add_conv (BT_REAL, gfc_real_kinds[i].kind,
4232 : : BT_COMPLEX, gfc_real_kinds[j].kind, GFC_STD_F77);
4233 : :
4234 : 974208 : add_conv (BT_COMPLEX, gfc_real_kinds[i].kind,
4235 : : BT_REAL, gfc_real_kinds[j].kind, GFC_STD_F77);
4236 : : }
4237 : :
4238 : : /* Logical/Logical kind conversion. */
4239 : 364514 : for (i = 0; gfc_logical_kinds[i].kind; i++)
4240 : 1818500 : for (j = 0; gfc_logical_kinds[j].kind; j++)
4241 : : {
4242 : 1514874 : if (i == j)
4243 : 303626 : continue;
4244 : :
4245 : 1211248 : add_conv (BT_LOGICAL, gfc_logical_kinds[i].kind,
4246 : : BT_LOGICAL, gfc_logical_kinds[j].kind, GFC_STD_F77);
4247 : : }
4248 : :
4249 : : /* Integer-Logical and Logical-Integer conversions. */
4250 : 60888 : if ((gfc_option.allow_std & GFC_STD_LEGACY) != 0)
4251 : 355862 : for (i=0; gfc_integer_kinds[i].kind; i++)
4252 : 1775240 : for (j=0; gfc_logical_kinds[j].kind; j++)
4253 : : {
4254 : 1478824 : add_conv (BT_INTEGER, gfc_integer_kinds[i].kind,
4255 : : BT_LOGICAL, gfc_logical_kinds[j].kind, GFC_STD_LEGACY);
4256 : 1478824 : add_conv (BT_LOGICAL, gfc_logical_kinds[j].kind,
4257 : : BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_LEGACY);
4258 : : }
4259 : :
4260 : : /* DEC legacy feature allows character conversions similar to Hollerith
4261 : : conversions - the character data will transferred on a byte by byte
4262 : : basis. */
4263 : 60888 : if (flag_dec_char_conversions)
4264 : : {
4265 : : /* Character-Integer conversions. */
4266 : 2532 : for (i = 0; gfc_integer_kinds[i].kind != 0; i++)
4267 : 2110 : add_conv (BT_CHARACTER, gfc_default_character_kind,
4268 : : BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_LEGACY);
4269 : : /* Character-Real conversions. */
4270 : 2110 : for (i = 0; gfc_real_kinds[i].kind != 0; i++)
4271 : 1688 : add_conv (BT_CHARACTER, gfc_default_character_kind,
4272 : : BT_REAL, gfc_real_kinds[i].kind, GFC_STD_LEGACY);
4273 : : /* Character-Complex conversions. */
4274 : 2110 : for (i = 0; gfc_real_kinds[i].kind != 0; i++)
4275 : 1688 : add_conv (BT_CHARACTER, gfc_default_character_kind,
4276 : : BT_COMPLEX, gfc_real_kinds[i].kind, GFC_STD_LEGACY);
4277 : : /* Character-Logical conversions. */
4278 : 2532 : for (i = 0; gfc_logical_kinds[i].kind != 0; i++)
4279 : 2110 : add_conv (BT_CHARACTER, gfc_default_character_kind,
4280 : : BT_LOGICAL, gfc_logical_kinds[i].kind, GFC_STD_LEGACY);
4281 : : }
4282 : 60888 : }
4283 : :
4284 : :
4285 : : static void
4286 : 30444 : add_char_conversions (void)
4287 : : {
4288 : 30444 : int n, i, j;
4289 : :
4290 : : /* Count possible conversions. */
4291 : 91332 : for (i = 0; gfc_character_kinds[i].kind != 0; i++)
4292 : 182664 : for (j = 0; gfc_character_kinds[j].kind != 0; j++)
4293 : 121776 : if (i != j)
4294 : 60888 : ncharconv++;
4295 : :
4296 : : /* Allocate memory. */
4297 : 30444 : char_conversions = XCNEWVEC (gfc_intrinsic_sym, ncharconv);
4298 : :
4299 : : /* Add the conversions themselves. */
4300 : 30444 : n = 0;
4301 : 91332 : for (i = 0; gfc_character_kinds[i].kind != 0; i++)
4302 : 182664 : for (j = 0; gfc_character_kinds[j].kind != 0; j++)
4303 : : {
4304 : 121776 : gfc_typespec from, to;
4305 : :
4306 : 121776 : if (i == j)
4307 : 60888 : continue;
4308 : :
4309 : 60888 : gfc_clear_ts (&from);
4310 : 60888 : from.type = BT_CHARACTER;
4311 : 60888 : from.kind = gfc_character_kinds[i].kind;
4312 : :
4313 : 60888 : gfc_clear_ts (&to);
4314 : 60888 : to.type = BT_CHARACTER;
4315 : 60888 : to.kind = gfc_character_kinds[j].kind;
4316 : :
4317 : 60888 : char_conversions[n].name = conv_name (&from, &to);
4318 : 60888 : char_conversions[n].lib_name = char_conversions[n].name;
4319 : 60888 : char_conversions[n].simplify.cc = gfc_convert_char_constant;
4320 : 60888 : char_conversions[n].standard = GFC_STD_F2003;
4321 : 60888 : char_conversions[n].elemental = 1;
4322 : 60888 : char_conversions[n].pure = 1;
4323 : 60888 : char_conversions[n].conversion = 0;
4324 : 60888 : char_conversions[n].ts = to;
4325 : 60888 : char_conversions[n].id = GFC_ISYM_CONVERSION;
4326 : :
4327 : 60888 : n++;
4328 : : }
4329 : 30444 : }
4330 : :
4331 : :
4332 : : /* Initialize the table of intrinsics. */
4333 : : void
4334 : 30444 : gfc_intrinsic_init_1 (void)
4335 : : {
4336 : 30444 : nargs = nfunc = nsub = nconv = 0;
4337 : :
4338 : : /* Create a namespace to hold the resolved intrinsic symbols. */
4339 : 30444 : gfc_intrinsic_namespace = gfc_get_namespace (NULL, 0);
4340 : :
4341 : 30444 : sizing = SZ_FUNCS;
4342 : 30444 : add_functions ();
4343 : 30444 : sizing = SZ_SUBS;
4344 : 30444 : add_subroutines ();
4345 : 30444 : sizing = SZ_CONVS;
4346 : 30444 : add_conversions ();
4347 : :
4348 : 30444 : functions = XCNEWVAR (struct gfc_intrinsic_sym,
4349 : : sizeof (gfc_intrinsic_sym) * (nfunc + nsub)
4350 : : + sizeof (gfc_intrinsic_arg) * nargs);
4351 : :
4352 : 30444 : next_sym = functions;
4353 : 30444 : subroutines = functions + nfunc;
4354 : :
4355 : 30444 : conversion = XCNEWVEC (gfc_intrinsic_sym, nconv);
4356 : :
4357 : 30444 : next_arg = ((gfc_intrinsic_arg *) (subroutines + nsub)) - 1;
4358 : :
4359 : 30444 : sizing = SZ_NOTHING;
4360 : 30444 : nconv = 0;
4361 : :
4362 : 30444 : add_functions ();
4363 : 30444 : add_subroutines ();
4364 : 30444 : add_conversions ();
4365 : :
4366 : : /* Character conversion intrinsics need to be treated separately. */
4367 : 30444 : add_char_conversions ();
4368 : 30444 : }
4369 : :
4370 : :
4371 : : void
4372 : 30427 : gfc_intrinsic_done_1 (void)
4373 : : {
4374 : 30427 : free (functions);
4375 : 30427 : free (conversion);
4376 : 30427 : free (char_conversions);
4377 : 30427 : gfc_free_namespace (gfc_intrinsic_namespace);
4378 : 30427 : }
4379 : :
4380 : :
4381 : : /******** Subroutines to check intrinsic interfaces ***********/
4382 : :
4383 : : /* Given a formal argument list, remove any NULL arguments that may
4384 : : have been left behind by a sort against some formal argument list. */
4385 : :
4386 : : static void
4387 : 347746 : remove_nullargs (gfc_actual_arglist **ap)
4388 : : {
4389 : 347746 : gfc_actual_arglist *head, *tail, *next;
4390 : :
4391 : 347746 : tail = NULL;
4392 : :
4393 : 815687 : for (head = *ap; head; head = next)
4394 : : {
4395 : 467941 : next = head->next;
4396 : :
4397 : 467941 : if (head->expr == NULL && !head->label)
4398 : : {
4399 : 346 : head->next = NULL;
4400 : 346 : gfc_free_actual_arglist (head);
4401 : : }
4402 : : else
4403 : : {
4404 : 467595 : if (tail == NULL)
4405 : 344107 : *ap = head;
4406 : : else
4407 : 123488 : tail->next = head;
4408 : :
4409 : 467595 : tail = head;
4410 : 467595 : tail->next = NULL;
4411 : : }
4412 : : }
4413 : :
4414 : 347746 : if (tail == NULL)
4415 : 3639 : *ap = NULL;
4416 : 347746 : }
4417 : :
4418 : :
4419 : : static void
4420 : 603755 : set_intrinsic_dummy_arg (gfc_dummy_arg *&dummy_arg,
4421 : : gfc_intrinsic_arg *intrinsic)
4422 : : {
4423 : 603755 : if (dummy_arg == NULL)
4424 : 560141 : dummy_arg = gfc_get_dummy_arg ();
4425 : :
4426 : 603755 : dummy_arg->intrinsicness = GFC_INTRINSIC_DUMMY_ARG;
4427 : 603755 : dummy_arg->u.intrinsic = intrinsic;
4428 : 603755 : }
4429 : :
4430 : :
4431 : : /* Given an actual arglist and a formal arglist, sort the actual
4432 : : arglist so that its arguments are in a one-to-one correspondence
4433 : : with the format arglist. Arguments that are not present are given
4434 : : a blank gfc_actual_arglist structure. If something is obviously
4435 : : wrong (say, a missing required argument) we abort sorting and
4436 : : return false. */
4437 : :
4438 : : static bool
4439 : 306627 : sort_actual (const char *name, gfc_actual_arglist **ap,
4440 : : gfc_intrinsic_arg *formal, locus *where)
4441 : : {
4442 : 306627 : gfc_actual_arglist *actual, *a;
4443 : 306627 : gfc_intrinsic_arg *f;
4444 : :
4445 : 306627 : remove_nullargs (ap);
4446 : 306627 : actual = *ap;
4447 : :
4448 : 306627 : auto_vec<gfc_intrinsic_arg *> dummy_args;
4449 : 306627 : auto_vec<gfc_actual_arglist *> ordered_actual_args;
4450 : :
4451 : 915711 : for (f = formal; f; f = f->next)
4452 : 609084 : dummy_args.safe_push (f);
4453 : :
4454 : 612916 : ordered_actual_args.safe_grow_cleared (dummy_args.length (),
4455 : : /* exact = */true);
4456 : :
4457 : 306627 : f = formal;
4458 : 306627 : a = actual;
4459 : :
4460 : 306627 : if (f == NULL && a == NULL) /* No arguments */
4461 : : return true;
4462 : :
4463 : : /* ALLOCATED has two mutually exclusive keywords, but only one
4464 : : can be present at time and neither is optional. */
4465 : 306289 : if (strcmp (name, "allocated") == 0)
4466 : : {
4467 : 6747 : if (!a)
4468 : : {
4469 : 1 : gfc_error ("ALLOCATED intrinsic at %L requires an array or scalar "
4470 : : "allocatable entity", where);
4471 : 1 : return false;
4472 : : }
4473 : :
4474 : 6746 : if (a->name)
4475 : : {
4476 : 28 : if (strcmp (a->name, "scalar") == 0)
4477 : : {
4478 : 14 : if (a->next)
4479 : 1 : goto whoops;
4480 : 13 : if (a->expr->rank != 0)
4481 : : {
4482 : 1 : gfc_error ("Scalar entity required at %L", &a->expr->where);
4483 : 1 : return false;
4484 : : }
4485 : : return true;
4486 : : }
4487 : 14 : else if (strcmp (a->name, "array") == 0)
4488 : : {
4489 : 14 : if (a->next)
4490 : 1 : goto whoops;
4491 : 13 : if (a->expr->rank == 0)
4492 : : {
4493 : 1 : gfc_error ("Array entity required at %L", &a->expr->where);
4494 : 1 : return false;
4495 : : }
4496 : : return true;
4497 : : }
4498 : : else
4499 : : {
4500 : 0 : gfc_error ("Invalid keyword %qs in %qs intrinsic function at %L",
4501 : 0 : a->name, name, &a->expr->where);
4502 : 0 : return false;
4503 : : }
4504 : : }
4505 : : }
4506 : :
4507 : 382996 : for (int i = 0;; i++)
4508 : : { /* Put the nonkeyword arguments in a 1:1 correspondence */
4509 : 689256 : if (f == NULL)
4510 : : break;
4511 : 535903 : if (a == NULL)
4512 : 126897 : goto optional;
4513 : :
4514 : 409006 : if (a->name != NULL)
4515 : 26010 : goto keywords;
4516 : :
4517 : 382996 : ordered_actual_args[i] = a;
4518 : :
4519 : 382996 : f = f->next;
4520 : 382996 : a = a->next;
4521 : : }
4522 : :
4523 : 153353 : if (a == NULL)
4524 : 148639 : goto do_sort;
4525 : :
4526 : 4714 : whoops:
4527 : 4716 : gfc_error ("Too many arguments in call to %qs at %L", name, where);
4528 : 4716 : return false;
4529 : :
4530 : 26010 : keywords:
4531 : : /* Associate the remaining actual arguments, all of which have
4532 : : to be keyword arguments. */
4533 : 61272 : for (; a; a = a->next)
4534 : : {
4535 : : int idx;
4536 : 90390 : FOR_EACH_VEC_ELT (dummy_args, idx, f)
4537 : 90384 : if (strcmp (a->name, f->name) == 0)
4538 : : break;
4539 : :
4540 : 35268 : if (f == NULL)
4541 : : {
4542 : 6 : if (a->name[0] == '%')
4543 : 5 : gfc_error ("The argument list functions %%VAL, %%LOC or %%REF "
4544 : : "are not allowed in this context at %L", where);
4545 : : else
4546 : 1 : gfc_error ("Cannot find keyword named %qs in call to %qs at %L",
4547 : : a->name, name, where);
4548 : 6 : return false;
4549 : : }
4550 : :
4551 : 35262 : if (ordered_actual_args[idx] != NULL)
4552 : : {
4553 : 0 : gfc_error ("Argument %qs appears twice in call to %qs at %L",
4554 : 0 : f->name, name, where);
4555 : 0 : return false;
4556 : : }
4557 : 35262 : ordered_actual_args[idx] = a;
4558 : : }
4559 : :
4560 : 26004 : optional:
4561 : : /* At this point, all unmatched formal args must be optional. */
4562 : : int idx;
4563 : 557680 : FOR_EACH_VEC_ELT (dummy_args, idx, f)
4564 : : {
4565 : 405024 : if (ordered_actual_args[idx] == NULL && f->optional == 0)
4566 : : {
4567 : 245 : gfc_error ("Missing actual argument %qs in call to %qs at %L",
4568 : 245 : f->name, name, where);
4569 : 245 : return false;
4570 : : }
4571 : : }
4572 : :
4573 : : do_sort:
4574 : : /* Using the formal argument list, string the actual argument list
4575 : : together in a way that corresponds with the formal list. */
4576 : : actual = NULL;
4577 : :
4578 : 905050 : FOR_EACH_VEC_ELT (dummy_args, idx, f)
4579 : : {
4580 : 603760 : a = ordered_actual_args[idx];
4581 : 603760 : if (a && a->label != NULL)
4582 : : {
4583 : 5 : gfc_error ("ALTERNATE RETURN not permitted at %L", where);
4584 : 5 : return false;
4585 : : }
4586 : :
4587 : 190530 : if (a == NULL)
4588 : 190530 : a = gfc_get_actual_arglist ();
4589 : :
4590 : 603755 : set_intrinsic_dummy_arg (a->associated_dummy, f);
4591 : :
4592 : 603755 : if (actual == NULL)
4593 : 301293 : *ap = a;
4594 : : else
4595 : 302462 : actual->next = a;
4596 : :
4597 : 603755 : actual = a;
4598 : : }
4599 : 301290 : actual->next = NULL; /* End the sorted argument list. */
4600 : :
4601 : 301290 : return true;
4602 : 306627 : }
4603 : :
4604 : :
4605 : : /* Compare an actual argument list with an intrinsic's formal argument
4606 : : list. The lists are checked for agreement of type. We don't check
4607 : : for arrayness here. */
4608 : :
4609 : : static bool
4610 : 34709 : check_arglist (gfc_actual_arglist **ap, gfc_intrinsic_sym *sym,
4611 : : int error_flag)
4612 : : {
4613 : 34709 : gfc_actual_arglist *actual;
4614 : 34709 : gfc_intrinsic_arg *formal;
4615 : 34709 : int i;
4616 : :
4617 : 34709 : formal = sym->formal;
4618 : 34709 : actual = *ap;
4619 : :
4620 : 34709 : i = 0;
4621 : 39106 : for (; formal; formal = formal->next, actual = actual->next, i++)
4622 : : {
4623 : 34905 : gfc_typespec ts;
4624 : :
4625 : 34905 : if (actual->expr == NULL)
4626 : 90 : continue;
4627 : :
4628 : 34815 : ts = formal->ts;
4629 : :
4630 : : /* A kind of 0 means we don't check for kind. */
4631 : 34815 : if (ts.kind == 0)
4632 : 515 : ts.kind = actual->expr->ts.kind;
4633 : :
4634 : 34815 : if (!gfc_compare_types (&ts, &actual->expr->ts))
4635 : : {
4636 : 30503 : if (error_flag)
4637 : 13 : gfc_error ("In call to %qs at %L, type mismatch in argument "
4638 : : "%qs; pass %qs to %qs", gfc_current_intrinsic,
4639 : 13 : &actual->expr->where,
4640 : 13 : gfc_current_intrinsic_arg[i]->name,
4641 : : gfc_typename (actual->expr),
4642 : : gfc_dummy_typename (&formal->ts));
4643 : 30508 : return false;
4644 : : }
4645 : :
4646 : : /* F2018, p. 328: An argument to an intrinsic procedure other than
4647 : : ASSOCIATED, NULL, or PRESENT shall be a data object. An EXPR_NULL
4648 : : is not a data object. */
4649 : 4312 : if (actual->expr->expr_type == EXPR_NULL
4650 : 4 : && (!(sym->id == GFC_ISYM_ASSOCIATED
4651 : 2 : || sym->id == GFC_ISYM_NULL
4652 : : || sym->id == GFC_ISYM_PRESENT)))
4653 : : {
4654 : 2 : gfc_invalid_null_arg (actual->expr);
4655 : 2 : return false;
4656 : : }
4657 : :
4658 : : /* If the formal argument is INTENT([IN]OUT), check for definability. */
4659 : 4310 : if (formal->intent == INTENT_INOUT || formal->intent == INTENT_OUT)
4660 : : {
4661 : 116 : const char* context = (error_flag
4662 : 116 : ? _("actual argument to INTENT = OUT/INOUT")
4663 : 116 : : NULL);
4664 : :
4665 : : /* No pointer arguments for intrinsics. */
4666 : 116 : if (!gfc_check_vardef_context (actual->expr, false, false, false, context))
4667 : : return false;
4668 : : }
4669 : : }
4670 : :
4671 : : return true;
4672 : : }
4673 : :
4674 : :
4675 : : /* Given a pointer to an intrinsic symbol and an expression node that
4676 : : represent the function call to that subroutine, figure out the type
4677 : : of the result. This may involve calling a resolution subroutine. */
4678 : :
4679 : : static void
4680 : 376138 : resolve_intrinsic (gfc_intrinsic_sym *specific, gfc_expr *e)
4681 : : {
4682 : 376138 : gfc_expr *a1, *a2, *a3, *a4, *a5, *a6;
4683 : 376138 : gfc_actual_arglist *arg;
4684 : :
4685 : 376138 : if (specific->resolve.f1 == NULL)
4686 : : {
4687 : 86553 : if (e->value.function.name == NULL)
4688 : 25998 : e->value.function.name = specific->lib_name;
4689 : :
4690 : 86553 : if (e->ts.type == BT_UNKNOWN)
4691 : 25185 : e->ts = specific->ts;
4692 : 86553 : return;
4693 : : }
4694 : :
4695 : 289585 : arg = e->value.function.actual;
4696 : :
4697 : : /* Special case hacks for MIN and MAX. */
4698 : 289585 : if (specific->resolve.f1m == gfc_resolve_max
4699 : 286878 : || specific->resolve.f1m == gfc_resolve_min)
4700 : : {
4701 : 4187 : (*specific->resolve.f1m) (e, arg);
4702 : 4187 : return;
4703 : : }
4704 : :
4705 : 285398 : if (arg == NULL)
4706 : : {
4707 : 225 : (*specific->resolve.f0) (e);
4708 : 225 : return;
4709 : : }
4710 : :
4711 : 285173 : a1 = arg->expr;
4712 : 285173 : arg = arg->next;
4713 : :
4714 : 285173 : if (arg == NULL)
4715 : : {
4716 : 61847 : (*specific->resolve.f1) (e, a1);
4717 : 61847 : return;
4718 : : }
4719 : :
4720 : 223326 : a2 = arg->expr;
4721 : 223326 : arg = arg->next;
4722 : :
4723 : 223326 : if (arg == NULL)
4724 : : {
4725 : 119352 : (*specific->resolve.f2) (e, a1, a2);
4726 : 119352 : return;
4727 : : }
4728 : :
4729 : 103974 : a3 = arg->expr;
4730 : 103974 : arg = arg->next;
4731 : :
4732 : 103974 : if (arg == NULL)
4733 : : {
4734 : 82649 : (*specific->resolve.f3) (e, a1, a2, a3);
4735 : 82649 : return;
4736 : : }
4737 : :
4738 : 21325 : a4 = arg->expr;
4739 : 21325 : arg = arg->next;
4740 : :
4741 : 21325 : if (arg == NULL)
4742 : : {
4743 : 7125 : (*specific->resolve.f4) (e, a1, a2, a3, a4);
4744 : 7125 : return;
4745 : : }
4746 : :
4747 : 14200 : a5 = arg->expr;
4748 : 14200 : arg = arg->next;
4749 : :
4750 : 14200 : if (arg == NULL)
4751 : : {
4752 : 12774 : (*specific->resolve.f5) (e, a1, a2, a3, a4, a5);
4753 : 12774 : return;
4754 : : }
4755 : :
4756 : 1426 : a6 = arg->expr;
4757 : 1426 : arg = arg->next;
4758 : :
4759 : 1426 : if (arg == NULL)
4760 : : {
4761 : 1426 : (*specific->resolve.f6) (e, a1, a2, a3, a4, a5, a6);
4762 : 1426 : return;
4763 : : }
4764 : :
4765 : 0 : gfc_internal_error ("resolve_intrinsic(): Too many args for intrinsic");
4766 : : }
4767 : :
4768 : :
4769 : : /* Given an intrinsic symbol node and an expression node, call the
4770 : : simplification function (if there is one), perhaps replacing the
4771 : : expression with something simpler. We return false on an error
4772 : : of the simplification, true if the simplification worked, even
4773 : : if nothing has changed in the expression itself. */
4774 : :
4775 : : static bool
4776 : 875740 : do_simplify (gfc_intrinsic_sym *specific, gfc_expr *e)
4777 : : {
4778 : 875740 : gfc_expr *result, *a1, *a2, *a3, *a4, *a5, *a6;
4779 : 875740 : gfc_actual_arglist *arg;
4780 : 875740 : int old_errorcount = errorcount;
4781 : :
4782 : : /* Max and min require special handling due to the variable number
4783 : : of args. */
4784 : 875740 : if (specific->simplify.f1 == gfc_simplify_min)
4785 : : {
4786 : 1872 : result = gfc_simplify_min (e);
4787 : 1872 : goto finish;
4788 : : }
4789 : :
4790 : 873868 : if (specific->simplify.f1 == gfc_simplify_max)
4791 : : {
4792 : 4083 : result = gfc_simplify_max (e);
4793 : 4083 : goto finish;
4794 : : }
4795 : :
4796 : 869785 : if (specific->simplify.f1 == NULL)
4797 : : {
4798 : 59566 : result = NULL;
4799 : 59566 : goto finish;
4800 : : }
4801 : :
4802 : 810219 : arg = e->value.function.actual;
4803 : :
4804 : 810219 : if (arg == NULL)
4805 : : {
4806 : 18 : result = (*specific->simplify.f0) ();
4807 : 18 : goto finish;
4808 : : }
4809 : :
4810 : 810201 : a1 = arg->expr;
4811 : 810201 : arg = arg->next;
4812 : :
4813 : 810201 : if (specific->simplify.cc == gfc_convert_constant
4814 : 680177 : || specific->simplify.cc == gfc_convert_char_constant)
4815 : : {
4816 : 130192 : result = specific->simplify.cc (a1, specific->ts.type, specific->ts.kind);
4817 : 130192 : goto finish;
4818 : : }
4819 : :
4820 : 680009 : if (arg == NULL)
4821 : 86115 : result = (*specific->simplify.f1) (a1);
4822 : : else
4823 : : {
4824 : 593894 : a2 = arg->expr;
4825 : 593894 : arg = arg->next;
4826 : :
4827 : 593894 : if (arg == NULL)
4828 : 460259 : result = (*specific->simplify.f2) (a1, a2);
4829 : : else
4830 : : {
4831 : 133635 : a3 = arg->expr;
4832 : 133635 : arg = arg->next;
4833 : :
4834 : 133635 : if (arg == NULL)
4835 : 105716 : result = (*specific->simplify.f3) (a1, a2, a3);
4836 : : else
4837 : : {
4838 : 27919 : a4 = arg->expr;
4839 : 27919 : arg = arg->next;
4840 : :
4841 : 27919 : if (arg == NULL)
4842 : 13638 : result = (*specific->simplify.f4) (a1, a2, a3, a4);
4843 : : else
4844 : : {
4845 : 14281 : a5 = arg->expr;
4846 : 14281 : arg = arg->next;
4847 : :
4848 : 14281 : if (arg == NULL)
4849 : 12973 : result = (*specific->simplify.f5) (a1, a2, a3, a4, a5);
4850 : : else
4851 : : {
4852 : 1308 : a6 = arg->expr;
4853 : 1308 : arg = arg->next;
4854 : :
4855 : 1308 : if (arg == NULL)
4856 : 1308 : result = (*specific->simplify.f6)
4857 : 1308 : (a1, a2, a3, a4, a5, a6);
4858 : : else
4859 : 0 : gfc_internal_error
4860 : 0 : ("do_simplify(): Too many args for intrinsic");
4861 : : }
4862 : : }
4863 : : }
4864 : : }
4865 : : }
4866 : :
4867 : 875740 : finish:
4868 : 875740 : if (result == &gfc_bad_expr)
4869 : : {
4870 : 128 : if (errorcount == old_errorcount
4871 : 128 : && (!gfc_buffered_p () || !gfc_error_flag_test ()))
4872 : 3 : gfc_error ("Cannot simplify expression at %L", &e->where);
4873 : 128 : return false;
4874 : : }
4875 : :
4876 : 875612 : if (result == NULL)
4877 : 376138 : resolve_intrinsic (specific, e); /* Must call at run-time */
4878 : : else
4879 : : {
4880 : 499474 : result->where = e->where;
4881 : 499474 : gfc_replace_expr (e, result);
4882 : : }
4883 : :
4884 : : return true;
4885 : : }
4886 : :
4887 : :
4888 : : /* Initialize the gfc_current_intrinsic_arg[] array for the benefit of
4889 : : error messages. This subroutine returns false if a subroutine
4890 : : has more than MAX_INTRINSIC_ARGS, in which case the actual argument
4891 : : list cannot match any intrinsic. */
4892 : :
4893 : : static void
4894 : 309107 : init_arglist (gfc_intrinsic_sym *isym)
4895 : : {
4896 : 309107 : gfc_intrinsic_arg *formal;
4897 : 309107 : int i;
4898 : :
4899 : 309107 : gfc_current_intrinsic = isym->name;
4900 : :
4901 : 309107 : i = 0;
4902 : 923151 : for (formal = isym->formal; formal; formal = formal->next)
4903 : : {
4904 : 614044 : if (i >= MAX_INTRINSIC_ARGS)
4905 : 0 : gfc_internal_error ("init_arglist(): too many arguments");
4906 : 614044 : gfc_current_intrinsic_arg[i++] = formal;
4907 : : }
4908 : 309107 : }
4909 : :
4910 : :
4911 : : /* Given a pointer to an intrinsic symbol and an expression consisting
4912 : : of a function call, see if the function call is consistent with the
4913 : : intrinsic's formal argument list. Return true if the expression
4914 : : and intrinsic match, false otherwise. */
4915 : :
4916 : : static bool
4917 : 302903 : check_specific (gfc_intrinsic_sym *specific, gfc_expr *expr, int error_flag)
4918 : : {
4919 : 302903 : gfc_actual_arglist *arg, **ap;
4920 : 302903 : bool t;
4921 : :
4922 : 302903 : ap = &expr->value.function.actual;
4923 : :
4924 : 302903 : init_arglist (specific);
4925 : :
4926 : : /* Don't attempt to sort the argument list for min or max. */
4927 : 302903 : if (specific->check.f1m == gfc_check_min_max
4928 : 302903 : || specific->check.f1m == gfc_check_min_max_integer
4929 : 302860 : || specific->check.f1m == gfc_check_min_max_real
4930 : 302822 : || specific->check.f1m == gfc_check_min_max_double)
4931 : : {
4932 : 91 : if (!do_ts29113_check (specific, *ap))
4933 : : return false;
4934 : 91 : return (*specific->check.f1m) (*ap);
4935 : : }
4936 : :
4937 : 302812 : if (!sort_actual (specific->name, ap, specific->formal, &expr->where))
4938 : : return false;
4939 : :
4940 : 297846 : if (!do_ts29113_check (specific, *ap))
4941 : : return false;
4942 : :
4943 : 297786 : if (specific->check.f5ml == gfc_check_minloc_maxloc)
4944 : : /* This is special because we might have to reorder the argument list. */
4945 : 10307 : t = gfc_check_minloc_maxloc (*ap);
4946 : 287479 : else if (specific->check.f6fl == gfc_check_findloc)
4947 : 865 : t = gfc_check_findloc (*ap);
4948 : 286614 : else if (specific->check.f3red == gfc_check_minval_maxval)
4949 : : /* This is also special because we also might have to reorder the
4950 : : argument list. */
4951 : 4048 : t = gfc_check_minval_maxval (*ap);
4952 : 282566 : else if (specific->check.f3red == gfc_check_product_sum)
4953 : : /* Same here. The difference to the previous case is that we allow a
4954 : : general numeric type. */
4955 : 2820 : t = gfc_check_product_sum (*ap);
4956 : 279746 : else if (specific->check.f3red == gfc_check_transf_bit_intrins)
4957 : : /* Same as for PRODUCT and SUM, but different checks. */
4958 : 531 : t = gfc_check_transf_bit_intrins (*ap);
4959 : : else
4960 : : {
4961 : 279215 : if (specific->check.f1 == NULL)
4962 : : {
4963 : 34437 : t = check_arglist (ap, specific, error_flag);
4964 : 34437 : if (t)
4965 : 3943 : expr->ts = specific->ts;
4966 : : }
4967 : : else
4968 : 244778 : t = do_check (specific, *ap);
4969 : : }
4970 : :
4971 : : /* Check conformance of elemental intrinsics. */
4972 : 267292 : if (t && specific->elemental)
4973 : : {
4974 : 77443 : int n = 0;
4975 : 77443 : gfc_expr *first_expr;
4976 : 77443 : arg = expr->value.function.actual;
4977 : :
4978 : : /* There is no elemental intrinsic without arguments. */
4979 : 77443 : gcc_assert(arg != NULL);
4980 : 77443 : first_expr = arg->expr;
4981 : :
4982 : 196461 : for ( ; arg && arg->expr; arg = arg->next, n++)
4983 : 119019 : if (!gfc_check_conformance (first_expr, arg->expr,
4984 : 119019 : _("arguments '%s' and '%s' for "
4985 : : "intrinsic '%s'"),
4986 : 119019 : gfc_current_intrinsic_arg[0]->name,
4987 : 119019 : gfc_current_intrinsic_arg[n]->name,
4988 : : gfc_current_intrinsic))
4989 : : return false;
4990 : : }
4991 : :
4992 : 287160 : if (!t)
4993 : 41119 : remove_nullargs (ap);
4994 : :
4995 : : return t;
4996 : : }
4997 : :
4998 : :
4999 : : /* Check whether an intrinsic belongs to whatever standard the user
5000 : : has chosen, taking also into account -fall-intrinsics. Here, no
5001 : : warning/error is emitted; but if symstd is not NULL, it is pointed to a
5002 : : textual representation of the symbols standard status (like
5003 : : "new in Fortran 2008", "a GNU extension" or "obsolescent in Fortran 95") that
5004 : : can be used to construct a detailed warning/error message in case of
5005 : : a false. */
5006 : :
5007 : : bool
5008 : 807495 : gfc_check_intrinsic_standard (const gfc_intrinsic_sym* isym,
5009 : : const char** symstd, bool silent, locus where)
5010 : : {
5011 : 807495 : const char* symstd_msg;
5012 : :
5013 : : /* For -fall-intrinsics, just succeed. */
5014 : 807495 : if (flag_all_intrinsics)
5015 : : return true;
5016 : :
5017 : : /* Find the symbol's standard message for later usage. */
5018 : 807433 : switch (isym->standard)
5019 : : {
5020 : 142385 : case GFC_STD_F77:
5021 : 142385 : symstd_msg = _("available since Fortran 77");
5022 : 142385 : break;
5023 : :
5024 : 0 : case GFC_STD_F95_OBS:
5025 : 0 : symstd_msg = _("obsolescent in Fortran 95");
5026 : 0 : break;
5027 : :
5028 : 0 : case GFC_STD_F95_DEL:
5029 : 0 : symstd_msg = _("deleted in Fortran 95");
5030 : 0 : break;
5031 : :
5032 : 539778 : case GFC_STD_F95:
5033 : 539778 : symstd_msg = _("new in Fortran 95");
5034 : 539778 : break;
5035 : :
5036 : 18174 : case GFC_STD_F2003:
5037 : 18174 : symstd_msg = _("new in Fortran 2003");
5038 : 18174 : break;
5039 : :
5040 : 65027 : case GFC_STD_F2008:
5041 : 65027 : symstd_msg = _("new in Fortran 2008");
5042 : 65027 : break;
5043 : :
5044 : 7957 : case GFC_STD_F2018:
5045 : 7957 : symstd_msg = _("new in Fortran 2018");
5046 : 7957 : break;
5047 : :
5048 : 5495 : case GFC_STD_F2023:
5049 : 5495 : symstd_msg = _("new in Fortran 2023");
5050 : 5495 : break;
5051 : :
5052 : 27975 : case GFC_STD_GNU:
5053 : 27975 : symstd_msg = _("a GNU Fortran extension");
5054 : 27975 : break;
5055 : :
5056 : 0 : case GFC_STD_LEGACY:
5057 : 0 : symstd_msg = _("for backward compatibility");
5058 : 0 : break;
5059 : :
5060 : 642 : case GFC_STD_UNSIGNED:
5061 : 642 : symstd_msg = _("unsigned");
5062 : 642 : break;
5063 : :
5064 : 0 : default:
5065 : 0 : gfc_internal_error ("Invalid standard code on intrinsic %qs (%d)",
5066 : 0 : isym->name, isym->standard);
5067 : : }
5068 : :
5069 : : /* If warning about the standard, warn and succeed. */
5070 : 807433 : if (gfc_option.warn_std & isym->standard)
5071 : : {
5072 : : /* Do only print a warning if not a GNU extension. */
5073 : 19011 : if (!silent && isym->standard != GFC_STD_GNU)
5074 : 0 : gfc_warning (0, "Intrinsic %qs (%s) used at %L",
5075 : 0 : isym->name, symstd_msg, &where);
5076 : :
5077 : 19011 : return true;
5078 : : }
5079 : :
5080 : : /* If allowing the symbol's standard, succeed, too. */
5081 : 788422 : if (gfc_option.allow_std & isym->standard)
5082 : : return true;
5083 : :
5084 : : /* Otherwise, fail. */
5085 : 183 : if (symstd)
5086 : 181 : *symstd = symstd_msg;
5087 : : return false;
5088 : : }
5089 : :
5090 : :
5091 : : /* See if a function call corresponds to an intrinsic function call.
5092 : : We return:
5093 : :
5094 : : MATCH_YES if the call corresponds to an intrinsic, simplification
5095 : : is done if possible.
5096 : :
5097 : : MATCH_NO if the call does not correspond to an intrinsic
5098 : :
5099 : : MATCH_ERROR if the call corresponds to an intrinsic but there was an
5100 : : error during the simplification process.
5101 : :
5102 : : The error_flag parameter enables an error reporting. */
5103 : :
5104 : : match
5105 : 785910 : gfc_intrinsic_func_interface (gfc_expr *expr, int error_flag)
5106 : : {
5107 : 785910 : gfc_symbol *sym;
5108 : 785910 : gfc_intrinsic_sym *isym, *specific;
5109 : 785910 : gfc_actual_arglist *actual;
5110 : 785910 : int flag;
5111 : :
5112 : 785910 : if (expr->value.function.isym != NULL)
5113 : 526121 : return (!do_simplify(expr->value.function.isym, expr))
5114 : 526121 : ? MATCH_ERROR : MATCH_YES;
5115 : :
5116 : 259789 : if (!error_flag)
5117 : 1113 : gfc_push_suppress_errors ();
5118 : 259789 : flag = 0;
5119 : :
5120 : 626959 : for (actual = expr->value.function.actual; actual; actual = actual->next)
5121 : 367170 : if (actual->expr != NULL)
5122 : 734340 : flag |= (actual->expr->ts.type != BT_INTEGER
5123 : 589050 : && actual->expr->ts.type != BT_CHARACTER);
5124 : :
5125 : 259789 : sym = expr->symtree->n.sym;
5126 : :
5127 : 259789 : if (sym->intmod_sym_id)
5128 : : {
5129 : 6329 : gfc_isym_id id = gfc_isym_id_by_intmod_sym (sym);
5130 : 6329 : isym = specific = gfc_intrinsic_function_by_id (id);
5131 : : }
5132 : : else
5133 : 253460 : isym = specific = gfc_find_function (sym->name);
5134 : :
5135 : 259789 : if (isym == NULL)
5136 : : {
5137 : 0 : if (!error_flag)
5138 : 0 : gfc_pop_suppress_errors ();
5139 : 0 : return MATCH_NO;
5140 : : }
5141 : :
5142 : 259789 : if ((isym->id == GFC_ISYM_REAL || isym->id == GFC_ISYM_DBLE
5143 : : || isym->id == GFC_ISYM_CMPLX || isym->id == GFC_ISYM_FLOAT
5144 : : || isym->id == GFC_ISYM_SNGL || isym->id == GFC_ISYM_DFLOAT)
5145 : 6047 : && gfc_init_expr_flag
5146 : 326 : && !gfc_notify_std (GFC_STD_F2003, "Function %qs as initialization "
5147 : : "expression at %L", sym->name, &expr->where))
5148 : : {
5149 : 5 : if (!error_flag)
5150 : 0 : gfc_pop_suppress_errors ();
5151 : 5 : return MATCH_ERROR;
5152 : : }
5153 : :
5154 : : /* F95, 7.1.6.1: Only transformational functions REPEAT, RESHAPE,
5155 : : SELECTED_INT_KIND, SELECTED_REAL_KIND, TRANSFER, and TRIM are allowed in
5156 : : initialization expressions. */
5157 : :
5158 : 259784 : if (gfc_init_expr_flag && isym->transformational)
5159 : : {
5160 : 2701 : gfc_isym_id id = isym->id;
5161 : 2701 : if (id != GFC_ISYM_REPEAT && id != GFC_ISYM_RESHAPE
5162 : 4494 : && id != GFC_ISYM_SI_KIND && id != GFC_ISYM_SR_KIND
5163 : 1793 : && id != GFC_ISYM_SL_KIND && id != GFC_ISYM_TRANSFER
5164 : 1211 : && id != GFC_ISYM_TRIM
5165 : 3659 : && !gfc_notify_std (GFC_STD_F2003, "Transformational function %qs "
5166 : : "at %L is invalid in an initialization "
5167 : : "expression", sym->name, &expr->where))
5168 : : {
5169 : 2 : if (!error_flag)
5170 : 0 : gfc_pop_suppress_errors ();
5171 : :
5172 : 2 : return MATCH_ERROR;
5173 : : }
5174 : : }
5175 : :
5176 : 259782 : gfc_current_intrinsic_where = &expr->where;
5177 : :
5178 : : /* Bypass the generic list for min, max and ISO_C_Binding's c_loc. */
5179 : 259782 : if (isym->check.f1m == gfc_check_min_max)
5180 : : {
5181 : 2389 : init_arglist (isym);
5182 : :
5183 : 2389 : if (isym->check.f1m(expr->value.function.actual))
5184 : 2368 : goto got_specific;
5185 : :
5186 : 21 : if (!error_flag)
5187 : 0 : gfc_pop_suppress_errors ();
5188 : 21 : return MATCH_NO;
5189 : : }
5190 : :
5191 : : /* If the function is generic, check all of its specific
5192 : : incarnations. If the generic name is also a specific, we check
5193 : : that name last, so that any error message will correspond to the
5194 : : specific. */
5195 : 257393 : gfc_push_suppress_errors ();
5196 : :
5197 : 257393 : if (isym->generic)
5198 : : {
5199 : 290773 : for (specific = isym->specific_head; specific;
5200 : 45510 : specific = specific->next)
5201 : : {
5202 : 54470 : if (specific == isym)
5203 : 0 : continue;
5204 : 54470 : if (check_specific (specific, expr, 0))
5205 : : {
5206 : 8960 : gfc_pop_suppress_errors ();
5207 : 8960 : goto got_specific;
5208 : : }
5209 : : }
5210 : : }
5211 : :
5212 : 248433 : gfc_pop_suppress_errors ();
5213 : :
5214 : 248433 : if (!check_specific (isym, expr, error_flag))
5215 : : {
5216 : 665 : if (!error_flag)
5217 : 21 : gfc_pop_suppress_errors ();
5218 : 665 : return MATCH_NO;
5219 : : }
5220 : :
5221 : : specific = isym;
5222 : :
5223 : 259096 : got_specific:
5224 : 259096 : expr->value.function.isym = specific;
5225 : 259096 : if (!error_flag)
5226 : 1092 : gfc_pop_suppress_errors ();
5227 : :
5228 : 259096 : if (!do_simplify (specific, expr))
5229 : : return MATCH_ERROR;
5230 : :
5231 : : /* F95, 7.1.6.1, Initialization expressions
5232 : : (4) An elemental intrinsic function reference of type integer or
5233 : : character where each argument is an initialization expression
5234 : : of type integer or character
5235 : :
5236 : : F2003, 7.1.7 Initialization expression
5237 : : (4) A reference to an elemental standard intrinsic function,
5238 : : where each argument is an initialization expression */
5239 : :
5240 : 8374 : if (gfc_init_expr_flag && isym->elemental && flag
5241 : 260166 : && !gfc_notify_std (GFC_STD_F2003, "Elemental function as "
5242 : : "initialization expression with non-integer/non-"
5243 : : "character arguments at %L", &expr->where))
5244 : : return MATCH_ERROR;
5245 : :
5246 : 259036 : if (sym->attr.flavor == FL_UNKNOWN)
5247 : : {
5248 : 81 : sym->attr.function = 1;
5249 : 81 : sym->attr.intrinsic = 1;
5250 : 81 : sym->attr.flavor = FL_PROCEDURE;
5251 : : }
5252 : 259036 : if (sym->attr.flavor == FL_PROCEDURE)
5253 : : {
5254 : 259036 : sym->attr.function = 1;
5255 : 259036 : sym->attr.proc = PROC_INTRINSIC;
5256 : : }
5257 : :
5258 : 259036 : if (!sym->module)
5259 : 62406 : gfc_intrinsic_symbol (sym);
5260 : :
5261 : : /* Have another stab at simplification since elemental intrinsics with array
5262 : : actual arguments would be missed by the calls above to do_simplify. */
5263 : 259036 : if (isym->elemental)
5264 : 79902 : gfc_simplify_expr (expr, 1);
5265 : :
5266 : : return MATCH_YES;
5267 : : }
5268 : :
5269 : :
5270 : : /* See if a CALL statement corresponds to an intrinsic subroutine.
5271 : : Returns MATCH_YES if the subroutine corresponds to an intrinsic,
5272 : : MATCH_NO if not, and MATCH_ERROR if there was an error (but did
5273 : : correspond). */
5274 : :
5275 : : match
5276 : 3815 : gfc_intrinsic_sub_interface (gfc_code *c, int error_flag)
5277 : : {
5278 : 3815 : gfc_intrinsic_sym *isym;
5279 : 3815 : const char *name;
5280 : :
5281 : 3815 : name = c->symtree->n.sym->name;
5282 : :
5283 : 3815 : if (c->symtree->n.sym->intmod_sym_id)
5284 : : {
5285 : 686 : gfc_isym_id id;
5286 : 686 : id = gfc_isym_id_by_intmod_sym (c->symtree->n.sym);
5287 : 686 : isym = gfc_intrinsic_subroutine_by_id (id);
5288 : : }
5289 : : else
5290 : 3129 : isym = gfc_find_subroutine (name);
5291 : 3815 : if (isym == NULL)
5292 : : return MATCH_NO;
5293 : :
5294 : 3815 : if (!error_flag)
5295 : 4 : gfc_push_suppress_errors ();
5296 : :
5297 : 3815 : init_arglist (isym);
5298 : :
5299 : 3815 : if (!isym->vararg && !sort_actual (name, &c->ext.actual, isym->formal, &c->loc))
5300 : 9 : goto fail;
5301 : :
5302 : 3806 : if (!do_ts29113_check (isym, c->ext.actual))
5303 : 0 : goto fail;
5304 : :
5305 : 3806 : if (isym->check.f1 != NULL)
5306 : : {
5307 : 3534 : if (!do_check (isym, c->ext.actual))
5308 : 271 : goto fail;
5309 : : }
5310 : : else
5311 : : {
5312 : 272 : if (!check_arglist (&c->ext.actual, isym, 1))
5313 : 14 : goto fail;
5314 : : }
5315 : :
5316 : : /* The subroutine corresponds to an intrinsic. Allow errors to be
5317 : : seen at this point. */
5318 : 3520 : if (!error_flag)
5319 : 3 : gfc_pop_suppress_errors ();
5320 : :
5321 : 3520 : c->resolved_isym = isym;
5322 : 3520 : if (isym->resolve.s1 != NULL)
5323 : 2036 : isym->resolve.s1 (c);
5324 : : else
5325 : : {
5326 : 1484 : c->resolved_sym = gfc_get_intrinsic_sub_symbol (isym->lib_name);
5327 : 1484 : c->resolved_sym->attr.elemental = isym->elemental;
5328 : : }
5329 : :
5330 : 3520 : if (gfc_do_concurrent_flag && !isym->pure)
5331 : : {
5332 : 1 : gfc_error ("Subroutine call to intrinsic %qs in DO CONCURRENT "
5333 : : "block at %L is not PURE", name, &c->loc);
5334 : 1 : return MATCH_ERROR;
5335 : : }
5336 : :
5337 : 3519 : if (!isym->pure && gfc_pure (NULL))
5338 : : {
5339 : 0 : gfc_error ("Subroutine call to intrinsic %qs at %L is not PURE", name,
5340 : : &c->loc);
5341 : 0 : return MATCH_ERROR;
5342 : : }
5343 : :
5344 : 3519 : if (!isym->pure)
5345 : 2781 : gfc_unset_implicit_pure (NULL);
5346 : :
5347 : 3519 : c->resolved_sym->attr.noreturn = isym->noreturn;
5348 : :
5349 : 3519 : return MATCH_YES;
5350 : :
5351 : 294 : fail:
5352 : 294 : if (!error_flag)
5353 : 1 : gfc_pop_suppress_errors ();
5354 : : return MATCH_NO;
5355 : : }
5356 : :
5357 : :
5358 : : /* Call gfc_convert_type() with warning enabled. */
5359 : :
5360 : : bool
5361 : 25322 : gfc_convert_type (gfc_expr *expr, gfc_typespec *ts, int eflag)
5362 : : {
5363 : 25322 : return gfc_convert_type_warn (expr, ts, eflag, 1);
5364 : : }
5365 : :
5366 : :
5367 : : /* Try to convert an expression (in place) from one type to another.
5368 : : 'eflag' controls the behavior on error.
5369 : :
5370 : : The possible values are:
5371 : :
5372 : : 1 Generate a gfc_error()
5373 : : 2 Generate a gfc_internal_error().
5374 : :
5375 : : 'wflag' controls the warning related to conversion.
5376 : :
5377 : : 'array' indicates whether the conversion is in an array constructor.
5378 : : Non-standard conversion from character to numeric not allowed if true.
5379 : : */
5380 : :
5381 : : bool
5382 : 126828 : gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag,
5383 : : bool array)
5384 : : {
5385 : 126828 : gfc_intrinsic_sym *sym;
5386 : 126828 : gfc_typespec from_ts;
5387 : 126828 : locus old_where;
5388 : 126828 : gfc_expr *new_expr;
5389 : 126828 : int rank;
5390 : 126828 : mpz_t *shape;
5391 : 253656 : bool is_char_constant = (expr->expr_type == EXPR_CONSTANT)
5392 : 126828 : && (expr->ts.type == BT_CHARACTER);
5393 : :
5394 : 126828 : from_ts = expr->ts; /* expr->ts gets clobbered */
5395 : :
5396 : 126828 : if (ts->type == BT_UNKNOWN)
5397 : 0 : goto bad;
5398 : :
5399 : 126828 : expr->do_not_warn = ! wflag;
5400 : :
5401 : : /* NULL and zero size arrays get their type here, unless they already have a
5402 : : typespec. */
5403 : 126828 : if ((expr->expr_type == EXPR_NULL
5404 : 123755 : || (expr->expr_type == EXPR_ARRAY && expr->value.constructor == NULL))
5405 : 3524 : && expr->ts.type == BT_UNKNOWN)
5406 : : {
5407 : : /* Sometimes the RHS acquire the type. */
5408 : 3073 : expr->ts = *ts;
5409 : 3073 : return true;
5410 : : }
5411 : :
5412 : 123755 : if (expr->ts.type == BT_UNKNOWN)
5413 : 214 : goto bad;
5414 : :
5415 : : /* In building an array constructor, gfortran can end up here when no
5416 : : conversion is required for an intrinsic type. We need to let derived
5417 : : types drop through. */
5418 : 123541 : if (from_ts.type != BT_DERIVED && from_ts.type != BT_CLASS
5419 : 123503 : && (from_ts.type == ts->type && from_ts.kind == ts->kind))
5420 : : return true;
5421 : :
5422 : 122475 : if ((expr->ts.type == BT_DERIVED || expr->ts.type == BT_CLASS)
5423 : 38 : && (ts->type == BT_DERIVED || ts->type == BT_CLASS)
5424 : 122535 : && gfc_compare_types (ts, &expr->ts))
5425 : : return true;
5426 : :
5427 : : /* If array is true then conversion is in an array constructor where
5428 : : non-standard conversion is not allowed. */
5429 : 3556 : if (array && from_ts.type == BT_CHARACTER
5430 : 122529 : && (gfc_numeric_ts (ts) || ts->type == BT_LOGICAL))
5431 : 32 : goto bad;
5432 : :
5433 : 122465 : sym = find_conv (&expr->ts, ts);
5434 : 122465 : if (sym == NULL)
5435 : 82 : goto bad;
5436 : :
5437 : : /* At this point, a conversion is necessary. A warning may be needed. */
5438 : 122383 : if ((gfc_option.warn_std & sym->standard) != 0)
5439 : : {
5440 : 462 : const char *type_name = is_char_constant ? gfc_typename (expr)
5441 : 318 : : gfc_typename (&from_ts);
5442 : 462 : gfc_warning_now (0, "Extension: Conversion from %s to %s at %L",
5443 : : type_name, gfc_dummy_typename (ts),
5444 : : &expr->where);
5445 : : }
5446 : 121921 : else if (wflag)
5447 : : {
5448 : 34438 : if (flag_range_check && expr->expr_type == EXPR_CONSTANT
5449 : 24593 : && from_ts.type == ts->type)
5450 : : {
5451 : : /* Do nothing. Constants of the same type are range-checked
5452 : : elsewhere. If a value too large for the target type is
5453 : : assigned, an error is generated. Not checking here avoids
5454 : : duplications of warnings/errors.
5455 : : If range checking was disabled, but -Wconversion enabled,
5456 : : a non range checked warning is generated below. */
5457 : : }
5458 : 2318 : else if (flag_dec_char_conversions && from_ts.type == BT_CHARACTER
5459 : 21264 : && (gfc_numeric_ts (ts) || ts->type == BT_LOGICAL))
5460 : : {
5461 : 603 : const char *type_name = is_char_constant ? gfc_typename (expr)
5462 : 0 : : gfc_typename (&from_ts);
5463 : 603 : gfc_warning_now (OPT_Wconversion, "Nonstandard conversion from %s "
5464 : : "to %s at %L", type_name, gfc_typename (ts),
5465 : : &expr->where);
5466 : : }
5467 : 20058 : else if (from_ts.type == ts->type
5468 : 15371 : || (from_ts.type == BT_INTEGER && ts->type == BT_REAL)
5469 : 3185 : || (from_ts.type == BT_INTEGER && ts->type == BT_COMPLEX)
5470 : 2850 : || (from_ts.type == BT_REAL && ts->type == BT_COMPLEX)
5471 : 2156 : || (from_ts.type == BT_UNSIGNED && ts->type == BT_UNSIGNED))
5472 : : {
5473 : : /* Larger kinds can hold values of smaller kinds without problems.
5474 : : Hence, only warn if target kind is smaller than the source
5475 : : kind - or if -Wconversion-extra is specified. LOGICAL values
5476 : : will always fit regardless of kind so ignore conversion. */
5477 : 17902 : if (expr->expr_type != EXPR_CONSTANT
5478 : 8790 : && ts->type != BT_LOGICAL)
5479 : : {
5480 : 8471 : if (warn_conversion && from_ts.kind > ts->kind)
5481 : 4 : gfc_warning_now (OPT_Wconversion, "Possible change of value in "
5482 : : "conversion from %s to %s at %L",
5483 : : gfc_typename (&from_ts), gfc_typename (ts),
5484 : : &expr->where);
5485 : : else
5486 : 8467 : gfc_warning_now (OPT_Wconversion_extra, "Conversion from %s to %s "
5487 : : "at %L", gfc_typename (&from_ts),
5488 : : gfc_typename (ts), &expr->where);
5489 : : }
5490 : : }
5491 : 2156 : else if ((from_ts.type == BT_REAL && ts->type == BT_INTEGER)
5492 : 2156 : || (from_ts.type == BT_COMPLEX && ts->type == BT_INTEGER)
5493 : 1378 : || (from_ts.type == BT_COMPLEX && ts->type == BT_REAL))
5494 : : {
5495 : : /* Conversion from REAL/COMPLEX to INTEGER or COMPLEX to REAL
5496 : : usually comes with a loss of information, regardless of kinds. */
5497 : 860 : if (expr->expr_type != EXPR_CONSTANT)
5498 : 633 : gfc_warning_now (OPT_Wconversion, "Possible change of value in "
5499 : : "conversion from %s to %s at %L",
5500 : : gfc_typename (&from_ts), gfc_typename (ts),
5501 : : &expr->where);
5502 : : }
5503 : 1296 : else if (from_ts.type == BT_HOLLERITH || ts->type == BT_HOLLERITH)
5504 : : {
5505 : : /* If HOLLERITH is involved, all bets are off. */
5506 : 1037 : gfc_warning_now (OPT_Wconversion, "Conversion from %s to %s at %L",
5507 : : gfc_typename (&from_ts), gfc_dummy_typename (ts),
5508 : : &expr->where);
5509 : : }
5510 : 259 : else if (from_ts.type == BT_LOGICAL || ts->type == BT_LOGICAL)
5511 : : {
5512 : : /* Do nothing. This block exists only to simplify the other
5513 : : else-if expressions.
5514 : : LOGICAL <> LOGICAL no warning, independent of kind values
5515 : : LOGICAL <> INTEGER extension, warned elsewhere
5516 : : LOGICAL <> REAL invalid, error generated elsewhere
5517 : : LOGICAL <> COMPLEX invalid, error generated elsewhere */
5518 : : }
5519 : : else
5520 : 0 : gcc_unreachable ();
5521 : : }
5522 : :
5523 : : /* Insert a pre-resolved function call to the right function. */
5524 : 122383 : old_where = expr->where;
5525 : 122383 : rank = expr->rank;
5526 : 122383 : shape = expr->shape;
5527 : :
5528 : 122383 : new_expr = gfc_get_expr ();
5529 : 122383 : *new_expr = *expr;
5530 : :
5531 : 122383 : new_expr = gfc_build_conversion (new_expr);
5532 : 122383 : new_expr->value.function.name = sym->lib_name;
5533 : 122383 : new_expr->value.function.isym = sym;
5534 : 122383 : new_expr->where = old_where;
5535 : 122383 : new_expr->ts = *ts;
5536 : 122383 : new_expr->rank = rank;
5537 : 122383 : new_expr->corank = expr->corank;
5538 : 122383 : new_expr->shape = gfc_copy_shape (shape, rank);
5539 : :
5540 : 122383 : gfc_get_ha_sym_tree (sym->name, &new_expr->symtree);
5541 : 122383 : new_expr->symtree->n.sym->result = new_expr->symtree->n.sym;
5542 : 122383 : new_expr->symtree->n.sym->ts.type = ts->type;
5543 : 122383 : new_expr->symtree->n.sym->ts.kind = ts->kind;
5544 : 122383 : new_expr->symtree->n.sym->attr.flavor = FL_PROCEDURE;
5545 : 122383 : new_expr->symtree->n.sym->attr.function = 1;
5546 : 122383 : new_expr->symtree->n.sym->attr.elemental = 1;
5547 : 122383 : new_expr->symtree->n.sym->attr.pure = 1;
5548 : 122383 : new_expr->symtree->n.sym->attr.referenced = 1;
5549 : 122383 : gfc_intrinsic_symbol(new_expr->symtree->n.sym);
5550 : 122383 : gfc_commit_symbol (new_expr->symtree->n.sym);
5551 : :
5552 : 122383 : *expr = *new_expr;
5553 : :
5554 : 122383 : free (new_expr);
5555 : 122383 : expr->ts = *ts;
5556 : :
5557 : 122383 : if (gfc_is_constant_expr (expr->value.function.actual->expr)
5558 : 122383 : && !do_simplify (sym, expr))
5559 : : {
5560 : :
5561 : 5 : if (eflag == 2)
5562 : 0 : goto bad;
5563 : : return false; /* Error already generated in do_simplify() */
5564 : : }
5565 : :
5566 : : return true;
5567 : :
5568 : 328 : bad:
5569 : 328 : const char *type_name = is_char_constant ? gfc_typename (expr)
5570 : 290 : : gfc_typename (&from_ts);
5571 : 328 : if (eflag == 1)
5572 : : {
5573 : 328 : gfc_error ("Cannot convert %s to %s at %L", type_name, gfc_typename (ts),
5574 : : &expr->where);
5575 : 328 : return false;
5576 : : }
5577 : :
5578 : 0 : gfc_internal_error ("Cannot convert %qs to %qs at %L", type_name,
5579 : : gfc_typename (ts), &expr->where);
5580 : : /* Not reached */
5581 : : }
5582 : :
5583 : :
5584 : : bool
5585 : 379 : gfc_convert_chartype (gfc_expr *expr, gfc_typespec *ts)
5586 : : {
5587 : 379 : gfc_intrinsic_sym *sym;
5588 : 379 : locus old_where;
5589 : 379 : gfc_expr *new_expr;
5590 : 379 : int rank;
5591 : 379 : mpz_t *shape;
5592 : :
5593 : 379 : gcc_assert (expr->ts.type == BT_CHARACTER && ts->type == BT_CHARACTER);
5594 : :
5595 : 379 : sym = find_char_conv (&expr->ts, ts);
5596 : 379 : if (sym == NULL)
5597 : : return false;
5598 : :
5599 : : /* Insert a pre-resolved function call to the right function. */
5600 : 376 : old_where = expr->where;
5601 : 376 : rank = expr->rank;
5602 : 376 : shape = expr->shape;
5603 : :
5604 : 376 : new_expr = gfc_get_expr ();
5605 : 376 : *new_expr = *expr;
5606 : :
5607 : 376 : new_expr = gfc_build_conversion (new_expr);
5608 : 376 : new_expr->value.function.name = sym->lib_name;
5609 : 376 : new_expr->value.function.isym = sym;
5610 : 376 : new_expr->where = old_where;
5611 : 376 : new_expr->ts = *ts;
5612 : 376 : new_expr->rank = rank;
5613 : 376 : new_expr->corank = expr->corank;
5614 : 376 : new_expr->shape = gfc_copy_shape (shape, rank);
5615 : :
5616 : 376 : gfc_get_ha_sym_tree (sym->name, &new_expr->symtree);
5617 : 376 : new_expr->symtree->n.sym->ts.type = ts->type;
5618 : 376 : new_expr->symtree->n.sym->ts.kind = ts->kind;
5619 : 376 : new_expr->symtree->n.sym->attr.flavor = FL_PROCEDURE;
5620 : 376 : new_expr->symtree->n.sym->attr.function = 1;
5621 : 376 : new_expr->symtree->n.sym->attr.elemental = 1;
5622 : 376 : new_expr->symtree->n.sym->attr.referenced = 1;
5623 : 376 : gfc_intrinsic_symbol(new_expr->symtree->n.sym);
5624 : 376 : gfc_commit_symbol (new_expr->symtree->n.sym);
5625 : :
5626 : 376 : *expr = *new_expr;
5627 : :
5628 : 376 : free (new_expr);
5629 : 376 : expr->ts = *ts;
5630 : :
5631 : 376 : if (gfc_is_constant_expr (expr->value.function.actual->expr)
5632 : 376 : && !do_simplify (sym, expr))
5633 : : {
5634 : : /* Error already generated in do_simplify() */
5635 : : return false;
5636 : : }
5637 : :
5638 : : return true;
5639 : : }
5640 : :
5641 : :
5642 : : /* Check if the passed name is name of an intrinsic (taking into account the
5643 : : current -std=* and -fall-intrinsic settings). If it is, see if we should
5644 : : warn about this as a user-procedure having the same name as an intrinsic
5645 : : (-Wintrinsic-shadow enabled) and do so if we should. */
5646 : :
5647 : : void
5648 : 58664 : gfc_warn_intrinsic_shadow (const gfc_symbol* sym, bool in_module, bool func)
5649 : : {
5650 : 58664 : gfc_intrinsic_sym* isym;
5651 : :
5652 : : /* If the warning is disabled, do nothing at all. */
5653 : 58664 : if (!warn_intrinsic_shadow)
5654 : : return;
5655 : :
5656 : : /* Try to find an intrinsic of the same name. */
5657 : 3075 : if (func)
5658 : 2164 : isym = gfc_find_function (sym->name);
5659 : : else
5660 : 911 : isym = gfc_find_subroutine (sym->name);
5661 : :
5662 : : /* If no intrinsic was found with this name or it's not included in the
5663 : : selected standard, everything's fine. */
5664 : 3075 : if (!isym || !gfc_check_intrinsic_standard (isym, NULL, true,
5665 : : sym->declared_at))
5666 : 3069 : return;
5667 : :
5668 : : /* Emit the warning. */
5669 : 6 : if (in_module || sym->ns->proc_name)
5670 : 3 : gfc_warning (OPT_Wintrinsic_shadow,
5671 : : "%qs declared at %L may shadow the intrinsic of the same"
5672 : : " name. In order to call the intrinsic, explicit INTRINSIC"
5673 : : " declarations may be required.",
5674 : 3 : sym->name, &sym->declared_at);
5675 : : else
5676 : 3 : gfc_warning (OPT_Wintrinsic_shadow,
5677 : : "%qs declared at %L is also the name of an intrinsic. It can"
5678 : : " only be called via an explicit interface or if declared"
5679 : 3 : " EXTERNAL.", sym->name, &sym->declared_at);
5680 : : }
|