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