/* Build up a list of intrinsic subroutines and functions for the
name-resolution stage.
- Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
Inc.
Contributed by Andy Vaught & Katherine Holcomb
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
#include "config.h"
#include "system.h"
#include "flags.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
#include "gfortran.h"
#include "intrinsic.h"
/* Pointers to an intrinsic function and its argument names that are being
checked. */
-char *gfc_current_intrinsic, *gfc_current_intrinsic_arg[MAX_INTRINSIC_ARGS];
+const char *gfc_current_intrinsic;
+const char *gfc_current_intrinsic_arg[MAX_INTRINSIC_ARGS];
locus *gfc_current_intrinsic_where;
static gfc_intrinsic_sym *functions, *subroutines, *conversion, *next_sym;
c = 'c';
break;
+ case BT_HOLLERITH:
+ c = 'h';
+ break;
+
default:
c = 'u';
break;
/* Return a pointer to the name of a conversion function given two
typespecs. */
-static char *
+static const char *
conv_name (gfc_typespec * from, gfc_typespec * to)
{
static char name[30];
sprintf (name, "__convert_%c%d_%c%d", gfc_type_letter (from->type),
from->kind, gfc_type_letter (to->type), to->kind);
- return name;
+ return gfc_get_string (name);
}
find_conv (gfc_typespec * from, gfc_typespec * to)
{
gfc_intrinsic_sym *sym;
- char *target;
+ const char *target;
int i;
target = conv_name (from, to);
bt type, int kind, int standard, gfc_check_f check,
gfc_simplify_f simplify, gfc_resolve_f resolve, ...)
{
-
+ char buf[GFC_MAX_SYMBOL_LEN + 11]; /* 10 for '_gfortran_', 1 for '\0' */
int optional, first_flag;
va_list argp;
/* First check that the intrinsic belongs to the selected standard.
If not, don't add it to the symbol list. */
- if (!(gfc_option.allow_std & standard))
+ if (!(gfc_option.allow_std & standard)
+ && gfc_option.flag_all_intrinsics == 0)
return;
switch (sizing)
break;
case SZ_NOTHING:
- strcpy (next_sym->name, name);
+ next_sym->name = gfc_get_string (name);
- strcpy (next_sym->lib_name, "_gfortran_");
- strcat (next_sym->lib_name, name);
+ strcpy (buf, "_gfortran_");
+ strcat (buf, name);
+ next_sym->lib_name = gfc_get_string (buf);
next_sym->elemental = elemental;
next_sym->ts.type = type;
gfc_intrinsic_sym *
gfc_find_function (const char *name)
{
+ gfc_intrinsic_sym *sym;
+
+ sym = find_sym (functions, nfunc, name);
+ if (!sym)
+ sym = find_sym (conversion, nconv, name);
- return find_sym (functions, nfunc, name);
+ return sym;
}
{
gfc_intrinsic_sym *g;
- if (!(gfc_option.allow_std & standard))
+ if (!(gfc_option.allow_std & standard)
+ && gfc_option.flag_all_intrinsics == 0)
return;
if (sizing != SZ_NOTHING)
g->generic = 1;
g->specific = 1;
g->generic_id = generic_id;
- if ((g + 1)->name[0] != '\0')
+ if ((g + 1)->name != NULL)
g->specific_head = g + 1;
g++;
- while (g->name[0] != '\0')
+ while (g->name != NULL)
{
g->next = g + 1;
g->specific = 1;
freed as a single block. */
static void
-make_alias (const char *name)
+make_alias (const char *name, int standard)
{
+ /* First check that the intrinsic belongs to the selected standard.
+ If not, don't add it to the symbol list. */
+ if (!(gfc_option.allow_std & standard)
+ && gfc_option.flag_all_intrinsics == 0)
+ return;
+
switch (sizing)
{
case SZ_FUNCS:
case SZ_NOTHING:
next_sym[0] = next_sym[-1];
- strcpy (next_sym->name, name);
+ next_sym->name = gfc_get_string (name);
next_sym++;
break;
}
}
+/* Make the current subroutine noreturn. */
+
+static void
+make_noreturn(void)
+{
+ if (sizing == SZ_NOTHING)
+ next_sym[-1].noreturn = 1;
+}
/* Add intrinsic functions. */
*s = "s", *dm = "dim", *kind = "kind", *msk = "mask",
*x = "x", *sh = "shift", *stg = "string", *ssg = "substring",
*y = "y", *sz = "size", *sta = "string_a", *stb = "string_b",
- *z = "z", *ln = "len", *ut = "unit";
+ *z = "z", *ln = "len", *ut = "unit", *han = "handler",
+ *num = "number", *tm = "time";
int di, dr, dd, dl, dc, dz, ii;
NULL, gfc_simplify_abs, gfc_resolve_abs,
a, BT_COMPLEX, dd, REQUIRED);
- make_alias ("cdabs");
+ make_alias ("cdabs", GFC_STD_GNU);
make_generic ("abs", GFC_ISYM_ABS, GFC_STD_F77);
add_sym_1 ("achar", 1, 1, BT_CHARACTER, dc, GFC_STD_F95,
- NULL, gfc_simplify_achar, NULL,
+ gfc_check_achar, gfc_simplify_achar, NULL,
i, BT_INTEGER, di, REQUIRED);
make_generic ("achar", GFC_ISYM_ACHAR, GFC_STD_F95);
add_sym_1 ("acos", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_acos, gfc_resolve_acos,
+ gfc_check_fn_r, gfc_simplify_acos, gfc_resolve_acos,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dacos", 1, 1, BT_REAL, dd, GFC_STD_F77,
make_generic ("acos", GFC_ISYM_ACOS, GFC_STD_F77);
+ add_sym_1 ("acosh", 1, 1, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_fn_r, gfc_simplify_acosh, gfc_resolve_acosh,
+ x, BT_REAL, dr, REQUIRED);
+
+ add_sym_1 ("dacosh", 1, 1, BT_REAL, dd, GFC_STD_GNU,
+ NULL, gfc_simplify_acosh, gfc_resolve_acosh,
+ x, BT_REAL, dd, REQUIRED);
+
+ make_generic ("acosh", GFC_ISYM_ACOSH, GFC_STD_GNU);
+
add_sym_1 ("adjustl", 1, 1, BT_CHARACTER, dc, GFC_STD_F95,
NULL, gfc_simplify_adjustl, NULL,
stg, BT_CHARACTER, dc, REQUIRED);
make_generic ("adjustr", GFC_ISYM_ADJUSTR, GFC_STD_F95);
add_sym_1 ("aimag", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_aimag, gfc_resolve_aimag,
+ gfc_check_fn_c, gfc_simplify_aimag, gfc_resolve_aimag,
z, BT_COMPLEX, dz, REQUIRED);
+ make_alias ("imag", GFC_STD_GNU);
+ make_alias ("imagpart", GFC_STD_GNU);
+
add_sym_1 ("dimag", 1, 1, BT_REAL, dd, GFC_STD_GNU,
NULL, gfc_simplify_aimag, gfc_resolve_aimag,
z, BT_COMPLEX, dd, REQUIRED);
+
make_generic ("aimag", GFC_ISYM_AIMAG, GFC_STD_F77);
add_sym_2 ("aint", 1, 1, BT_REAL, dr, GFC_STD_F77,
make_generic ("any", GFC_ISYM_ANY, GFC_STD_F95);
add_sym_1 ("asin", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_asin, gfc_resolve_asin,
+ gfc_check_fn_r, gfc_simplify_asin, gfc_resolve_asin,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dasin", 1, 1, BT_REAL, dd, GFC_STD_F77,
x, BT_REAL, dd, REQUIRED);
make_generic ("asin", GFC_ISYM_ASIN, GFC_STD_F77);
+
+ add_sym_1 ("asinh", 1, 1, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_fn_r, gfc_simplify_asinh, gfc_resolve_asinh,
+ x, BT_REAL, dr, REQUIRED);
+
+ add_sym_1 ("dasinh", 1, 1, BT_REAL, dd, GFC_STD_GNU,
+ NULL, gfc_simplify_asinh, gfc_resolve_asinh,
+ x, BT_REAL, dd, REQUIRED);
+
+ make_generic ("asinh", GFC_ISYM_ASINH, GFC_STD_GNU);
add_sym_2 ("associated", 0, 1, BT_LOGICAL, dl, GFC_STD_F95,
gfc_check_associated, NULL, NULL,
make_generic ("associated", GFC_ISYM_ASSOCIATED, GFC_STD_F95);
add_sym_1 ("atan", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_atan, gfc_resolve_atan,
+ gfc_check_fn_r, gfc_simplify_atan, gfc_resolve_atan,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("datan", 1, 1, BT_REAL, dd, GFC_STD_F77,
x, BT_REAL, dd, REQUIRED);
make_generic ("atan", GFC_ISYM_ATAN, GFC_STD_F77);
+
+ add_sym_1 ("atanh", 1, 1, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_fn_r, gfc_simplify_atanh, gfc_resolve_atanh,
+ x, BT_REAL, dr, REQUIRED);
+
+ add_sym_1 ("datanh", 1, 1, BT_REAL, dd, GFC_STD_GNU,
+ NULL, gfc_simplify_atanh, gfc_resolve_atanh,
+ x, BT_REAL, dd, REQUIRED);
+
+ make_generic ("atanh", GFC_ISYM_ATANH, GFC_STD_GNU);
add_sym_2 ("atan2", 1, 1, BT_REAL, dr, GFC_STD_F77,
gfc_check_atan2, gfc_simplify_atan2, gfc_resolve_atan2,
y, BT_REAL, dd, REQUIRED, x, BT_REAL, dd, REQUIRED);
make_generic ("atan2", GFC_ISYM_ATAN2, GFC_STD_F77);
-
+
/* Bessel and Neumann functions for G77 compatibility. */
add_sym_1 ("besj0", 1, 0, BT_REAL, dr, GFC_STD_GNU,
gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
make_generic ("char", GFC_ISYM_CHAR, GFC_STD_F77);
+ add_sym_1 ("chdir", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_chdir, NULL, gfc_resolve_chdir,
+ a, BT_CHARACTER, dc, REQUIRED);
+
+ make_generic ("chdir", GFC_ISYM_CHDIR, GFC_STD_GNU);
+
add_sym_3 ("cmplx", 1, 1, BT_COMPLEX, dz, GFC_STD_F77,
gfc_check_cmplx, gfc_simplify_cmplx, gfc_resolve_cmplx,
x, BT_UNKNOWN, dr, REQUIRED, y, BT_UNKNOWN, dr, OPTIONAL,
make_generic ("cmplx", GFC_ISYM_CMPLX, GFC_STD_F77);
+ add_sym_2 ("complex", 1, 1, BT_COMPLEX, dz, GFC_STD_GNU,
+ gfc_check_complex, gfc_simplify_complex, gfc_resolve_complex,
+ x, BT_UNKNOWN, dr, REQUIRED, y, BT_UNKNOWN, dr, REQUIRED);
+
+ make_generic ("complex", GFC_ISYM_COMPLEX, GFC_STD_GNU);
+
/* Making dcmplx a specific of cmplx causes cmplx to return a double
complex instead of the default complex. */
make_generic ("dcmplx", GFC_ISYM_CMPLX, GFC_STD_GNU);
add_sym_1 ("conjg", 1, 1, BT_COMPLEX, dz, GFC_STD_F77,
- NULL, gfc_simplify_conjg, gfc_resolve_conjg,
+ gfc_check_fn_c, gfc_simplify_conjg, gfc_resolve_conjg,
z, BT_COMPLEX, dz, REQUIRED);
add_sym_1 ("dconjg", 1, 1, BT_COMPLEX, dd, GFC_STD_GNU,
make_generic ("conjg", GFC_ISYM_CONJG, GFC_STD_F77);
add_sym_1 ("cos", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_cos, gfc_resolve_cos,
+ gfc_check_fn_rc, gfc_simplify_cos, gfc_resolve_cos,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dcos", 1, 1, BT_REAL, dd, GFC_STD_F77,
- NULL, gfc_simplify_cos, gfc_resolve_cos,
+ gfc_check_fn_rc, gfc_simplify_cos, gfc_resolve_cos,
x, BT_REAL, dd, REQUIRED);
add_sym_1 ("ccos", 1, 1, BT_COMPLEX, dz, GFC_STD_F77,
NULL, gfc_simplify_cos, gfc_resolve_cos,
x, BT_COMPLEX, dd, REQUIRED);
- make_alias ("cdcos");
+ make_alias ("cdcos", GFC_STD_GNU);
make_generic ("cos", GFC_ISYM_COS, GFC_STD_F77);
add_sym_1 ("cosh", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_cosh, gfc_resolve_cosh,
+ gfc_check_fn_r, gfc_simplify_cosh, gfc_resolve_cosh,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dcosh", 1, 1, BT_REAL, dd, GFC_STD_F77,
make_generic ("cshift", GFC_ISYM_CSHIFT, GFC_STD_F95);
+ add_sym_1 ("ctime", 0, 1, BT_CHARACTER, 0, GFC_STD_GNU,
+ gfc_check_ctime, NULL, gfc_resolve_ctime,
+ tm, BT_INTEGER, di, REQUIRED);
+
+ make_generic ("ctime", GFC_ISYM_CTIME, GFC_STD_GNU);
+
add_sym_1 ("dble", 1, 1, BT_REAL, dd, GFC_STD_F77,
gfc_check_dble, gfc_simplify_dble, gfc_resolve_dble,
a, BT_REAL, dr, REQUIRED);
- make_alias ("dfloat");
+ make_alias ("dfloat", GFC_STD_GNU);
make_generic ("dble", GFC_ISYM_DBLE, GFC_STD_F77);
gfc_check_etime, NULL, NULL,
x, BT_REAL, 4, REQUIRED);
- make_alias ("dtime");
+ make_alias ("dtime", GFC_STD_GNU);
make_generic ("etime", GFC_ISYM_ETIME, GFC_STD_GNU);
add_sym_1 ("exp", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_exp, gfc_resolve_exp,
+ gfc_check_fn_rc, gfc_simplify_exp, gfc_resolve_exp,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dexp", 1, 1, BT_REAL, dd, GFC_STD_F77,
NULL, gfc_simplify_exp, gfc_resolve_exp,
x, BT_COMPLEX, dd, REQUIRED);
- make_alias ("cdexp");
+ make_alias ("cdexp", GFC_STD_GNU);
make_generic ("exp", GFC_ISYM_EXP, GFC_STD_F77);
make_generic ("exponent", GFC_ISYM_EXPONENT, GFC_STD_F95);
+ add_sym_0 ("fdate", 1, 0, BT_CHARACTER, dc, GFC_STD_GNU,
+ NULL, NULL, gfc_resolve_fdate);
+
+ make_generic ("fdate", GFC_ISYM_FDATE, GFC_STD_GNU);
+
add_sym_2 ("floor", 1, 1, BT_INTEGER, di, GFC_STD_F95,
gfc_check_a_ikind, gfc_simplify_floor, gfc_resolve_floor,
a, BT_REAL, dr, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
make_generic ("fstat", GFC_ISYM_FSTAT, GFC_STD_GNU);
+ add_sym_1 ("ftell", 0, 1, BT_INTEGER, ii, GFC_STD_GNU,
+ gfc_check_ftell, NULL, gfc_resolve_ftell,
+ ut, BT_INTEGER, di, REQUIRED);
+
+ make_generic ("ftell", GFC_ISYM_FTELL, GFC_STD_GNU);
+
+ add_sym_2 ("fgetc", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_fgetputc, NULL, gfc_resolve_fgetc,
+ ut, BT_INTEGER, di, REQUIRED, c, BT_CHARACTER, dc, REQUIRED);
+
+ make_generic ("fgetc", GFC_ISYM_FGETC, GFC_STD_GNU);
+
+ add_sym_1 ("fget", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_fgetput, NULL, gfc_resolve_fget,
+ c, BT_CHARACTER, dc, REQUIRED);
+
+ make_generic ("fget", GFC_ISYM_FGET, GFC_STD_GNU);
+
+ add_sym_2 ("fputc", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_fgetputc, NULL, gfc_resolve_fputc,
+ ut, BT_INTEGER, di, REQUIRED, c, BT_CHARACTER, dc, REQUIRED);
+
+ make_generic ("fputc", GFC_ISYM_FPUTC, GFC_STD_GNU);
+
+ add_sym_1 ("fput", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_fgetput, NULL, gfc_resolve_fput,
+ c, BT_CHARACTER, dc, REQUIRED);
+
+ make_generic ("fput", GFC_ISYM_FPUT, GFC_STD_GNU);
+
/* Unix IDs (g77 compatibility) */
add_sym_1 ("getcwd", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
NULL, NULL, gfc_resolve_getcwd,
make_generic ("getuid", GFC_ISYM_GETUID, GFC_STD_GNU);
+ add_sym_1 ("hostnm", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_hostnm, NULL, gfc_resolve_hostnm,
+ a, BT_CHARACTER, dc, REQUIRED);
+
+ make_generic ("hostnm", GFC_ISYM_HOSTNM, GFC_STD_GNU);
+
add_sym_1 ("huge", 0, 1, BT_REAL, dr, GFC_STD_F95,
gfc_check_huge, gfc_simplify_huge, NULL,
x, BT_UNKNOWN, dr, REQUIRED);
make_generic ("huge", GFC_ISYM_NONE, GFC_STD_F95);
add_sym_1 ("iachar", 1, 1, BT_INTEGER, di, GFC_STD_F95,
- NULL, gfc_simplify_iachar, NULL,
+ gfc_check_ichar_iachar, gfc_simplify_iachar, NULL,
c, BT_CHARACTER, dc, REQUIRED);
make_generic ("iachar", GFC_ISYM_IACHAR, GFC_STD_F95);
make_generic ("iand", GFC_ISYM_IAND, GFC_STD_F95);
+ add_sym_2 ("and", 1, 0, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_and, gfc_simplify_and, gfc_resolve_and,
+ i, BT_UNKNOWN, 0, REQUIRED, j, BT_UNKNOWN, 0, REQUIRED);
+
+ make_generic ("and", GFC_ISYM_AND, GFC_STD_GNU);
+
add_sym_0 ("iargc", 1, 1, BT_INTEGER, di, GFC_STD_GNU,
NULL, NULL, NULL);
make_generic ("ibset", GFC_ISYM_IBSET, GFC_STD_F95);
add_sym_1 ("ichar", 1, 0, BT_INTEGER, di, GFC_STD_F77,
- NULL, gfc_simplify_ichar, gfc_resolve_ichar,
+ gfc_check_ichar_iachar, gfc_simplify_ichar, gfc_resolve_ichar,
c, BT_CHARACTER, dc, REQUIRED);
make_generic ("ichar", GFC_ISYM_ICHAR, GFC_STD_F77);
make_generic ("ieor", GFC_ISYM_IEOR, GFC_STD_F95);
+ add_sym_2 ("xor", 1, 0, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_and, gfc_simplify_xor, gfc_resolve_xor,
+ i, BT_UNKNOWN, 0, REQUIRED, j, BT_UNKNOWN, 0, REQUIRED);
+
+ make_generic ("xor", GFC_ISYM_XOR, GFC_STD_GNU);
+
+ add_sym_0 ("ierrno", 1, 0, BT_INTEGER, di, GFC_STD_GNU,
+ NULL, NULL, gfc_resolve_ierrno);
+
+ make_generic ("ierrno", GFC_ISYM_IERRNO, GFC_STD_GNU);
+
add_sym_3 ("index", 1, 1, BT_INTEGER, di, GFC_STD_F77,
gfc_check_index, gfc_simplify_index, NULL,
stg, BT_CHARACTER, dc, REQUIRED, ssg, BT_CHARACTER, dc, REQUIRED,
make_generic ("ior", GFC_ISYM_IOR, GFC_STD_F95);
+ add_sym_2 ("or", 1, 0, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_and, gfc_simplify_or, gfc_resolve_or,
+ i, BT_UNKNOWN, 0, REQUIRED, j, BT_UNKNOWN, 0, REQUIRED);
+
+ make_generic ("or", GFC_ISYM_OR, GFC_STD_GNU);
+
/* The following function is for G77 compatibility. */
add_sym_1 ("irand", 0, 1, BT_INTEGER, 4, GFC_STD_GNU,
gfc_check_irand, NULL, NULL,
make_generic ("irand", GFC_ISYM_IRAND, GFC_STD_GNU);
+ add_sym_1 ("isatty", 0, 0, BT_LOGICAL, dl, GFC_STD_GNU,
+ gfc_check_isatty, NULL, gfc_resolve_isatty,
+ ut, BT_INTEGER, di, REQUIRED);
+
+ make_generic ("isatty", GFC_ISYM_ISATTY, GFC_STD_GNU);
+
add_sym_2 ("ishft", 1, 1, BT_INTEGER, di, GFC_STD_F95,
gfc_check_ishft, gfc_simplify_ishft, gfc_resolve_ishft,
i, BT_INTEGER, di, REQUIRED, sh, BT_INTEGER, di, REQUIRED);
make_generic ("ishftc", GFC_ISYM_ISHFTC, GFC_STD_F95);
+ add_sym_2 ("kill", 1, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_kill, NULL, gfc_resolve_kill,
+ a, BT_INTEGER, di, REQUIRED, b, BT_INTEGER, di, REQUIRED);
+
+ make_generic ("kill", GFC_ISYM_KILL, GFC_STD_GNU);
+
add_sym_1 ("kind", 0, 1, BT_INTEGER, di, GFC_STD_F95,
gfc_check_kind, gfc_simplify_kind, NULL,
x, BT_REAL, dr, REQUIRED);
NULL, gfc_simplify_len_trim, gfc_resolve_len_trim,
stg, BT_CHARACTER, dc, REQUIRED);
+ make_alias ("lnblnk", GFC_STD_GNU);
+
make_generic ("len_trim", GFC_ISYM_LEN_TRIM, GFC_STD_F95);
add_sym_2 ("lge", 1, 0, BT_LOGICAL, dl, GFC_STD_F77,
make_generic ("llt", GFC_ISYM_LLT, GFC_STD_F77);
+ add_sym_2 ("link", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_link, NULL, gfc_resolve_link,
+ a, BT_CHARACTER, dc, REQUIRED, b, BT_CHARACTER, dc, REQUIRED);
+
+ make_generic ("link", GFC_ISYM_LINK, GFC_STD_GNU);
+
add_sym_1 ("log", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_log, gfc_resolve_log,
+ gfc_check_fn_rc, gfc_simplify_log, gfc_resolve_log,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("alog", 1, 1, BT_REAL, dr, GFC_STD_F77,
NULL, gfc_simplify_log, gfc_resolve_log,
x, BT_COMPLEX, dd, REQUIRED);
- make_alias ("cdlog");
+ make_alias ("cdlog", GFC_STD_GNU);
make_generic ("log", GFC_ISYM_LOG, GFC_STD_F77);
add_sym_1 ("log10", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_log10, gfc_resolve_log10,
+ gfc_check_fn_r, gfc_simplify_log10, gfc_resolve_log10,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("alog10", 1, 1, BT_REAL, dr, GFC_STD_F77,
make_generic ("log10", GFC_ISYM_LOG10, GFC_STD_F77);
- add_sym_2 ("logical", 0, 1, BT_LOGICAL, dl, GFC_STD_F95,
+ add_sym_2 ("logical", 1, 1, BT_LOGICAL, dl, GFC_STD_F95,
gfc_check_logical, gfc_simplify_logical, gfc_resolve_logical,
l, BT_LOGICAL, dl, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
make_generic ("logical", GFC_ISYM_LOGICAL, GFC_STD_F95);
+ add_sym_1 ("malloc", 0, 1, BT_INTEGER, ii, GFC_STD_GNU, gfc_check_malloc,
+ NULL, gfc_resolve_malloc, a, BT_INTEGER, di, REQUIRED);
+
+ make_generic ("malloc", GFC_ISYM_MALLOC, GFC_STD_GNU);
+
add_sym_2 ("matmul", 0, 1, BT_REAL, dr, GFC_STD_F95,
gfc_check_matmul, NULL, gfc_resolve_matmul,
ma, BT_REAL, dr, REQUIRED, mb, BT_REAL, dr, REQUIRED);
/* Compatibility with HP FORTRAN 77/iX Reference. Note, rand() and ran()
use slightly different shoddy multiplicative congruential PRNG. */
- make_alias ("ran");
+ make_alias ("ran", GFC_STD_GNU);
make_generic ("rand", GFC_ISYM_RAND, GFC_STD_GNU);
gfc_check_real, gfc_simplify_real, gfc_resolve_real,
a, BT_UNKNOWN, dr, REQUIRED, kind, BT_INTEGER, di, OPTIONAL);
+ /* This provides compatibility with g77. */
+ add_sym_1 ("realpart", 1, 0, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_fn_c, gfc_simplify_realpart, gfc_resolve_realpart,
+ a, BT_UNKNOWN, dr, REQUIRED);
+
add_sym_1 ("float", 1, 0, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_float, NULL,
+ gfc_check_i, gfc_simplify_float, NULL,
a, BT_INTEGER, di, REQUIRED);
add_sym_1 ("sngl", 1, 0, BT_REAL, dr, GFC_STD_F77,
make_generic ("real", GFC_ISYM_REAL, GFC_STD_F77);
+ add_sym_2 ("rename", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_rename, NULL, gfc_resolve_rename,
+ a, BT_CHARACTER, dc, REQUIRED, b, BT_CHARACTER, dc, REQUIRED);
+
+ make_generic ("rename", GFC_ISYM_RENAME, GFC_STD_GNU);
+
add_sym_2 ("repeat", 0, 1, BT_CHARACTER, dc, GFC_STD_F95,
gfc_check_repeat, gfc_simplify_repeat, gfc_resolve_repeat,
stg, BT_CHARACTER, dc, REQUIRED, n, BT_INTEGER, di, REQUIRED);
make_generic ("second", GFC_ISYM_SECOND, GFC_STD_GNU);
+ /* Added for G77 compatibility. */
+ add_sym_1 ("secnds", 0, 1, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_secnds, NULL, gfc_resolve_secnds,
+ x, BT_REAL, dr, REQUIRED);
+
+ make_generic ("secnds", GFC_ISYM_SECNDS, GFC_STD_GNU);
+
add_sym_1 ("selected_int_kind", 0, 1, BT_INTEGER, di, GFC_STD_F95,
- NULL, gfc_simplify_selected_int_kind, NULL,
+ gfc_check_selected_int_kind, gfc_simplify_selected_int_kind, NULL,
r, BT_INTEGER, di, REQUIRED);
make_generic ("selected_int_kind", GFC_ISYM_SI_KIND, GFC_STD_F95);
make_generic ("sign", GFC_ISYM_SIGN, GFC_STD_F77);
+ add_sym_2 ("signal", 1, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_signal, NULL, gfc_resolve_signal,
+ num, BT_INTEGER, di, REQUIRED, han, BT_UNKNOWN, 0, REQUIRED);
+
+ make_generic ("signal", GFC_ISYM_SIGNAL, GFC_STD_GNU);
+
add_sym_1 ("sin", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_sin, gfc_resolve_sin,
+ gfc_check_fn_rc, gfc_simplify_sin, gfc_resolve_sin,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dsin", 1, 1, BT_REAL, dd, GFC_STD_F77,
NULL, gfc_simplify_sin, gfc_resolve_sin,
x, BT_COMPLEX, dd, REQUIRED);
- make_alias ("cdsin");
+ make_alias ("cdsin", GFC_STD_GNU);
make_generic ("sin", GFC_ISYM_SIN, GFC_STD_F77);
add_sym_1 ("sinh", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_sinh, gfc_resolve_sinh,
+ gfc_check_fn_r, gfc_simplify_sinh, gfc_resolve_sinh,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dsinh", 1, 1, BT_REAL, dd, GFC_STD_F77,
make_generic ("spread", GFC_ISYM_SPREAD, GFC_STD_F95);
add_sym_1 ("sqrt", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_sqrt, gfc_resolve_sqrt,
+ gfc_check_fn_rc, gfc_simplify_sqrt, gfc_resolve_sqrt,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dsqrt", 1, 1, BT_REAL, dd, GFC_STD_F77,
NULL, gfc_simplify_sqrt, gfc_resolve_sqrt,
x, BT_COMPLEX, dd, REQUIRED);
- make_alias ("cdsqrt");
+ make_alias ("cdsqrt", GFC_STD_GNU);
make_generic ("sqrt", GFC_ISYM_SQRT, GFC_STD_F77);
make_generic ("sum", GFC_ISYM_SUM, GFC_STD_F95);
+ add_sym_2 ("symlnk", 0, 1, BT_INTEGER, di, GFC_STD_GNU,
+ gfc_check_symlnk, NULL, gfc_resolve_symlnk,
+ a, BT_CHARACTER, dc, REQUIRED, b, BT_CHARACTER, dc, REQUIRED);
+
+ make_generic ("symlnk", GFC_ISYM_SYMLNK, GFC_STD_GNU);
+
add_sym_1 ("system", 1, 1, BT_INTEGER, di, GFC_STD_GNU,
NULL, NULL, NULL,
c, BT_CHARACTER, dc, REQUIRED);
make_generic ("system", GFC_ISYM_SYSTEM, GFC_STD_GNU);
add_sym_1 ("tan", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_tan, gfc_resolve_tan,
+ gfc_check_fn_r, gfc_simplify_tan, gfc_resolve_tan,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dtan", 1, 1, BT_REAL, dd, GFC_STD_F77,
make_generic ("tan", GFC_ISYM_TAN, GFC_STD_F77);
add_sym_1 ("tanh", 1, 1, BT_REAL, dr, GFC_STD_F77,
- NULL, gfc_simplify_tanh, gfc_resolve_tanh,
+ gfc_check_fn_r, gfc_simplify_tanh, gfc_resolve_tanh,
x, BT_REAL, dr, REQUIRED);
add_sym_1 ("dtanh", 1, 1, BT_REAL, dd, GFC_STD_F77,
make_generic ("tanh", GFC_ISYM_TANH, GFC_STD_F77);
+ add_sym_0 ("time", 1, 0, BT_INTEGER, di, GFC_STD_GNU,
+ NULL, NULL, gfc_resolve_time);
+
+ make_generic ("time", GFC_ISYM_TIME, GFC_STD_GNU);
+
+ add_sym_0 ("time8", 1, 0, BT_INTEGER, di, GFC_STD_GNU,
+ NULL, NULL, gfc_resolve_time8);
+
+ make_generic ("time8", GFC_ISYM_TIME8, GFC_STD_GNU);
+
add_sym_1 ("tiny", 0, 1, BT_REAL, dr, GFC_STD_F95,
gfc_check_x, gfc_simplify_tiny, NULL,
x, BT_REAL, dr, REQUIRED);
make_generic ("trim", GFC_ISYM_TRIM, GFC_STD_F95);
+ add_sym_1 ("ttynam", 0, 1, BT_CHARACTER, 0, GFC_STD_GNU,
+ gfc_check_ttynam, NULL, gfc_resolve_ttynam,
+ ut, BT_INTEGER, di, REQUIRED);
+
+ make_generic ("ttynam", GFC_ISYM_TTYNAM, GFC_STD_GNU);
+
add_sym_2 ("ubound", 0, 1, BT_INTEGER, di, GFC_STD_F95,
gfc_check_ubound, gfc_simplify_ubound, gfc_resolve_ubound,
ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL);
bck, BT_LOGICAL, dl, OPTIONAL);
make_generic ("verify", GFC_ISYM_VERIFY, GFC_STD_F95);
+
+ add_sym_1 ("loc", 0, 1, BT_INTEGER, ii, GFC_STD_GNU,
+ gfc_check_loc, NULL, gfc_resolve_loc,
+ ar, BT_UNKNOWN, 0, REQUIRED);
+
+ make_generic ("loc", GFC_ISYM_LOC, GFC_STD_GNU);
+
}
*f = "from", *sz = "size", *ln = "len", *cr = "count_rate",
*com = "command", *length = "length", *st = "status",
*val = "value", *num = "number", *name = "name",
- *trim_name = "trim_name", *ut = "unit";
+ *trim_name = "trim_name", *ut = "unit", *han = "handler",
+ *sec = "seconds", *res = "result", *of = "offset";
- int di, dr, dc, dl;
+ int di, dr, dc, dl, ii;
di = gfc_default_integer_kind;
dr = gfc_default_real_kind;
dc = gfc_default_character_kind;
dl = gfc_default_logical_kind;
+ ii = gfc_index_integer_kind;
add_sym_0s ("abort", 1, GFC_STD_GNU, NULL);
+ if ((gfc_option.allow_std & GFC_STD_GNU) || gfc_option.flag_all_intrinsics)
+ make_noreturn();
+
add_sym_1s ("cpu_time", 0, 1, BT_UNKNOWN, 0, GFC_STD_F95,
gfc_check_cpu_time, NULL, gfc_resolve_cpu_time,
tm, BT_REAL, dr, REQUIRED);
/* More G77 compatibility garbage. */
+ add_sym_2s ("ctime", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_ctime_sub, NULL, gfc_resolve_ctime_sub,
+ tm, BT_INTEGER, di, REQUIRED, res, BT_CHARACTER, dc, REQUIRED);
+
add_sym_1s ("second", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
gfc_check_second_sub, NULL, gfc_resolve_second_sub,
tm, BT_REAL, dr, REQUIRED);
+ add_sym_2s ("chdir", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_chdir_sub, NULL, gfc_resolve_chdir_sub,
+ name, BT_CHARACTER, dc, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
+
add_sym_4s ("date_and_time", 0, 1, BT_UNKNOWN, 0, GFC_STD_F95,
gfc_check_date_and_time, NULL, NULL,
dt, BT_CHARACTER, dc, OPTIONAL, tm, BT_CHARACTER, dc, OPTIONAL,
gfc_check_etime_sub, NULL, gfc_resolve_etime_sub,
vl, BT_REAL, 4, REQUIRED, tm, BT_REAL, 4, REQUIRED);
+ add_sym_1s ("fdate", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_fdate_sub, NULL, gfc_resolve_fdate_sub,
+ dt, BT_CHARACTER, dc, REQUIRED);
+
+ add_sym_1s ("gerror", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_gerror, NULL, gfc_resolve_gerror, c, BT_CHARACTER,
+ dc, REQUIRED);
+
add_sym_2s ("getcwd", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
gfc_check_getcwd_sub, NULL, gfc_resolve_getcwd_sub,
c, BT_CHARACTER, dc, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
NULL, NULL, gfc_resolve_getarg,
c, BT_INTEGER, di, REQUIRED, vl, BT_CHARACTER, dc, REQUIRED);
+ add_sym_1s ("getlog", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_getlog, NULL, gfc_resolve_getlog, c, BT_CHARACTER,
+ dc, REQUIRED);
+
/* F2003 commandline routines. */
add_sym_3s ("get_command", 0, 1, BT_UNKNOWN, 0, GFC_STD_F2003,
gt, BT_INTEGER, di, OPTIONAL);
/* More G77 compatibility garbage. */
+ add_sym_3s ("alarm", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_alarm_sub, NULL, gfc_resolve_alarm_sub,
+ sec, BT_INTEGER, di, REQUIRED, han, BT_UNKNOWN, 0, REQUIRED,
+ st, BT_INTEGER, di, OPTIONAL);
+
add_sym_1s ("srand", 0, 1, BT_UNKNOWN, di, GFC_STD_GNU,
gfc_check_srand, NULL, gfc_resolve_srand,
c, BT_INTEGER, 4, REQUIRED);
gfc_check_exit, NULL, gfc_resolve_exit,
c, BT_INTEGER, di, OPTIONAL);
+ if ((gfc_option.allow_std & GFC_STD_GNU) || gfc_option.flag_all_intrinsics)
+ make_noreturn();
+
+ add_sym_3s ("fgetc", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_fgetputc_sub, NULL, gfc_resolve_fgetc_sub,
+ ut, BT_INTEGER, di, REQUIRED, c, BT_CHARACTER, dc, REQUIRED,
+ st, BT_INTEGER, di, OPTIONAL);
+
+ add_sym_2s ("fget", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_fgetput_sub, NULL, gfc_resolve_fget_sub,
+ c, BT_CHARACTER, dc, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
+
add_sym_1s ("flush", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
gfc_check_flush, NULL, gfc_resolve_flush,
c, BT_INTEGER, di, OPTIONAL);
+ add_sym_3s ("fputc", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_fgetputc_sub, NULL, gfc_resolve_fputc_sub,
+ ut, BT_INTEGER, di, REQUIRED, c, BT_CHARACTER, dc, REQUIRED,
+ st, BT_INTEGER, di, OPTIONAL);
+
+ add_sym_2s ("fput", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_fgetput_sub, NULL, gfc_resolve_fput_sub,
+ c, BT_CHARACTER, dc, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
+
+ add_sym_1s ("free", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU, gfc_check_free,
+ NULL, gfc_resolve_free, c, BT_INTEGER, ii, REQUIRED);
+
+ add_sym_2s ("ftell", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_ftell_sub, NULL, gfc_resolve_ftell_sub,
+ ut, BT_INTEGER, di, REQUIRED, of, BT_INTEGER, ii, REQUIRED);
+
+ add_sym_2s ("hostnm", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_hostnm_sub, NULL, gfc_resolve_hostnm_sub,
+ c, BT_CHARACTER, dc, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
+
+ add_sym_3s ("kill", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU, gfc_check_kill_sub,
+ NULL, gfc_resolve_kill_sub, c, BT_INTEGER, di, REQUIRED,
+ val, BT_INTEGER, di, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
+
+ add_sym_3s ("link", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_link_sub, NULL, gfc_resolve_link_sub,
+ name, BT_CHARACTER, dc, REQUIRED, val, BT_CHARACTER,
+ dc, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
+
+ add_sym_1s ("perror", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_perror, NULL, gfc_resolve_perror,
+ c, BT_CHARACTER, dc, REQUIRED);
+
+ add_sym_3s ("rename", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_rename_sub, NULL, gfc_resolve_rename_sub,
+ name, BT_CHARACTER, dc, REQUIRED, val, BT_CHARACTER,
+ dc, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
+
+ add_sym_1s ("sleep", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_sleep_sub, NULL, gfc_resolve_sleep_sub,
+ val, BT_CHARACTER, dc, REQUIRED);
+
add_sym_3s ("fstat", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
gfc_check_fstat_sub, NULL, gfc_resolve_fstat_sub,
ut, BT_INTEGER, di, REQUIRED, vl, BT_INTEGER, di, REQUIRED,
name, BT_CHARACTER, dc, REQUIRED, vl, BT_INTEGER, di, REQUIRED,
st, BT_INTEGER, di, OPTIONAL);
+ add_sym_3s ("signal", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_signal_sub, NULL, gfc_resolve_signal_sub,
+ num, BT_INTEGER, di, REQUIRED, han, BT_UNKNOWN, 0, REQUIRED,
+ st, BT_INTEGER, di, OPTIONAL);
+
+ add_sym_3s ("symlnk", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_symlnk_sub, NULL, gfc_resolve_symlnk_sub,
+ name, BT_CHARACTER, dc, REQUIRED, val, BT_CHARACTER,
+ dc, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
+
add_sym_2s ("system", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
NULL, NULL, gfc_resolve_system_sub,
c, BT_CHARACTER, dc, REQUIRED, st, BT_INTEGER, di, OPTIONAL);
c, BT_INTEGER, di, OPTIONAL, cr, BT_INTEGER, di, OPTIONAL,
cm, BT_INTEGER, di, OPTIONAL);
+ add_sym_2s ("ttynam", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
+ gfc_check_ttynam_sub, NULL, gfc_resolve_ttynam_sub,
+ ut, BT_INTEGER, di, REQUIRED, c, BT_CHARACTER, dc, REQUIRED);
+
add_sym_2s ("umask", 0, 1, BT_UNKNOWN, 0, GFC_STD_GNU,
gfc_check_umask_sub, NULL, gfc_resolve_umask_sub,
val, BT_INTEGER, di, REQUIRED, num, BT_INTEGER, di, OPTIONAL);
/* Add a function to the list of conversion symbols. */
static void
-add_conv (bt from_type, int from_kind, bt to_type, int to_kind,
- gfc_expr * (*simplify) (gfc_expr *, bt, int))
+add_conv (bt from_type, int from_kind, bt to_type, int to_kind, int standard)
{
gfc_typespec from, to;
sym = conversion + nconv;
- strcpy (sym->name, conv_name (&from, &to));
- strcpy (sym->lib_name, sym->name);
- sym->simplify.cc = simplify;
+ sym->name = conv_name (&from, &to);
+ sym->lib_name = sym->name;
+ sym->simplify.cc = gfc_convert_constant;
+ sym->standard = standard;
sym->elemental = 1;
sym->ts = to;
sym->generic_id = GFC_ISYM_CONVERSION;
continue;
add_conv (BT_INTEGER, gfc_integer_kinds[i].kind,
- BT_INTEGER, gfc_integer_kinds[j].kind, gfc_convert_constant);
+ BT_INTEGER, gfc_integer_kinds[j].kind, GFC_STD_F77);
}
/* Integer-Real/Complex conversions. */
for (j = 0; gfc_real_kinds[j].kind != 0; j++)
{
add_conv (BT_INTEGER, gfc_integer_kinds[i].kind,
- BT_REAL, gfc_real_kinds[j].kind, gfc_convert_constant);
+ BT_REAL, gfc_real_kinds[j].kind, GFC_STD_F77);
add_conv (BT_REAL, gfc_real_kinds[j].kind,
- BT_INTEGER, gfc_integer_kinds[i].kind, gfc_convert_constant);
+ BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_F77);
add_conv (BT_INTEGER, gfc_integer_kinds[i].kind,
- BT_COMPLEX, gfc_real_kinds[j].kind, gfc_convert_constant);
+ BT_COMPLEX, gfc_real_kinds[j].kind, GFC_STD_F77);
add_conv (BT_COMPLEX, gfc_real_kinds[j].kind,
- BT_INTEGER, gfc_integer_kinds[i].kind, gfc_convert_constant);
+ BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_F77);
}
+ if ((gfc_option.allow_std & GFC_STD_LEGACY) != 0)
+ {
+ /* Hollerith-Integer conversions. */
+ for (i = 0; gfc_integer_kinds[i].kind != 0; i++)
+ add_conv (BT_HOLLERITH, gfc_default_character_kind,
+ BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_LEGACY);
+ /* Hollerith-Real conversions. */
+ for (i = 0; gfc_real_kinds[i].kind != 0; i++)
+ add_conv (BT_HOLLERITH, gfc_default_character_kind,
+ BT_REAL, gfc_real_kinds[i].kind, GFC_STD_LEGACY);
+ /* Hollerith-Complex conversions. */
+ for (i = 0; gfc_real_kinds[i].kind != 0; i++)
+ add_conv (BT_HOLLERITH, gfc_default_character_kind,
+ BT_COMPLEX, gfc_real_kinds[i].kind, GFC_STD_LEGACY);
+
+ /* Hollerith-Character conversions. */
+ add_conv (BT_HOLLERITH, gfc_default_character_kind, BT_CHARACTER,
+ gfc_default_character_kind, GFC_STD_LEGACY);
+
+ /* Hollerith-Logical conversions. */
+ for (i = 0; gfc_logical_kinds[i].kind != 0; i++)
+ add_conv (BT_HOLLERITH, gfc_default_character_kind,
+ BT_LOGICAL, gfc_logical_kinds[i].kind, GFC_STD_LEGACY);
+ }
+
/* Real/Complex - Real/Complex conversions. */
for (i = 0; gfc_real_kinds[i].kind != 0; i++)
for (j = 0; gfc_real_kinds[j].kind != 0; j++)
if (i != j)
{
add_conv (BT_REAL, gfc_real_kinds[i].kind,
- BT_REAL, gfc_real_kinds[j].kind, gfc_convert_constant);
+ BT_REAL, gfc_real_kinds[j].kind, GFC_STD_F77);
add_conv (BT_COMPLEX, gfc_real_kinds[i].kind,
- BT_COMPLEX, gfc_real_kinds[j].kind, gfc_convert_constant);
+ BT_COMPLEX, gfc_real_kinds[j].kind, GFC_STD_F77);
}
add_conv (BT_REAL, gfc_real_kinds[i].kind,
- BT_COMPLEX, gfc_real_kinds[j].kind, gfc_convert_constant);
+ BT_COMPLEX, gfc_real_kinds[j].kind, GFC_STD_F77);
add_conv (BT_COMPLEX, gfc_real_kinds[i].kind,
- BT_REAL, gfc_real_kinds[j].kind, gfc_convert_constant);
+ BT_REAL, gfc_real_kinds[j].kind, GFC_STD_F77);
}
/* Logical/Logical kind conversion. */
continue;
add_conv (BT_LOGICAL, gfc_logical_kinds[i].kind,
- BT_LOGICAL, gfc_logical_kinds[j].kind, gfc_convert_constant);
+ BT_LOGICAL, gfc_logical_kinds[j].kind, GFC_STD_F77);
}
+
+ /* Integer-Logical and Logical-Integer conversions. */
+ if ((gfc_option.allow_std & GFC_STD_LEGACY) != 0)
+ for (i=0; gfc_integer_kinds[i].kind; i++)
+ for (j=0; gfc_logical_kinds[j].kind; j++)
+ {
+ add_conv (BT_INTEGER, gfc_integer_kinds[i].kind,
+ BT_LOGICAL, gfc_logical_kinds[j].kind, GFC_STD_LEGACY);
+ add_conv (BT_LOGICAL, gfc_logical_kinds[j].kind,
+ BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_LEGACY);
+ }
}
nargs = nfunc = nsub = nconv = 0;
/* Create a namespace to hold the resolved intrinsic symbols. */
- gfc_intrinsic_namespace = gfc_get_namespace (NULL);
+ gfc_intrinsic_namespace = gfc_get_namespace (NULL, 0);
sizing = SZ_FUNCS;
add_functions ();
if (a == NULL)
goto optional;
- if (a->name[0] != '\0')
+ if (a->name != NULL)
goto keywords;
f->actual = a;
gfc_expr *result, *a1, *a2, *a3, *a4, *a5;
gfc_actual_arglist *arg;
+ /* Check the arguments if there are Hollerith constants. We deal with
+ them at run-time. */
+ for (arg = e->value.function.actual; arg != NULL; arg = arg->next)
+ {
+ if (arg->expr && arg->expr->from_H)
+ {
+ result = NULL;
+ goto finish;
+ }
+ }
/* Max and min require special handling due to the variable number
of args. */
if (specific->simplify.f1 == gfc_simplify_min)
if (!gfc_option.warn_nonstd_intrinsics)
return;
- gfc_notify_std (standard, "Intrinsic '%s' at %L is not included"
+ gfc_notify_std (standard, "Intrinsic '%s' at %L is not included "
"in the selected standard", name, where);
}
expr->value.function.isym = specific;
gfc_intrinsic_symbol (expr->symtree->n.sym);
+ gfc_suppress_error = 0;
if (do_simplify (specific, expr) == FAILURE)
- {
- gfc_suppress_error = 0;
- return MATCH_ERROR;
- }
+ return MATCH_ERROR;
/* TODO: We should probably only allow elemental functions here. */
flag |= (expr->ts.type != BT_INTEGER && expr->ts.type != BT_CHARACTER);
- gfc_suppress_error = 0;
if (pedantic && gfc_init_expr
&& flag && gfc_init_expr_extensions (specific))
{
return MATCH_ERROR;
}
+ c->resolved_sym->attr.noreturn = isym->noreturn;
check_intrinsic_standard (name, isym->standard, &c->loc);
return MATCH_YES;
goto bad;
/* At this point, a conversion is necessary. A warning may be needed. */
- if (wflag && gfc_option.warn_conversion)
+ if ((gfc_option.warn_std & sym->standard) != 0)
+ gfc_warning_now ("Extension: Conversion from %s to %s at %L",
+ gfc_typename (&from_ts), gfc_typename (ts), &expr->where);
+ else if (wflag && gfc_option.warn_conversion)
gfc_warning_now ("Conversion from %s to %s at %L",
gfc_typename (&from_ts), gfc_typename (ts), &expr->where);
new->rank = rank;
new->shape = gfc_copy_shape (shape, rank);
+ gfc_get_ha_sym_tree (sym->name, &new->symtree);
+ new->symtree->n.sym->ts = *ts;
+ new->symtree->n.sym->attr.flavor = FL_PROCEDURE;
+ new->symtree->n.sym->attr.function = 1;
+ new->symtree->n.sym->attr.intrinsic = 1;
+ new->symtree->n.sym->attr.elemental = 1;
+ new->symtree->n.sym->attr.pure = 1;
+ new->symtree->n.sym->attr.referenced = 1;
+ gfc_intrinsic_symbol(new->symtree->n.sym);
+ gfc_commit_symbol (new->symtree->n.sym);
+
*expr = *new;
gfc_free (new);