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

source code of gcc/fortran/intrinsic.cc