From 16e39f7b560fcaf9af0d90f351ac5902c1be3cb1 Mon Sep 17 00:00:00 2001 From: downsj Date: Wed, 9 Apr 1997 13:42:37 +0000 Subject: [PATCH] Revert to older (working) version of gcc, plus recent changes. --- gnu/usr.bin/gcc/ChangeLog | 67 - gnu/usr.bin/gcc/Makefile.in | 3 +- gnu/usr.bin/gcc/README.g77 | 22 +- gnu/usr.bin/gcc/calls.c | 23 +- gnu/usr.bin/gcc/combine.c | 1 - gnu/usr.bin/gcc/config/alpha/alpha.c | 5 - gnu/usr.bin/gcc/config/alpha/alpha.md | 4 +- gnu/usr.bin/gcc/config/alpha/xm-alpha.h | 4 - gnu/usr.bin/gcc/config/x-linux | 3 - gnu/usr.bin/gcc/configure | 14 +- gnu/usr.bin/gcc/cse.c | 400 +- gnu/usr.bin/gcc/f/BUGS | 102 +- gnu/usr.bin/gcc/f/ChangeLog | 667 -- gnu/usr.bin/gcc/f/DOC | 2582 +++++ gnu/usr.bin/gcc/f/INSTALL | 597 +- gnu/usr.bin/gcc/f/Make | 244 + gnu/usr.bin/gcc/f/Make-lang.in | 126 +- gnu/usr.bin/gcc/f/Makefile.in | 73 +- gnu/usr.bin/gcc/f/NEWS | 223 +- gnu/usr.bin/gcc/f/PROJECTS | 5 + gnu/usr.bin/gcc/f/README.NEXTSTEP | 6 + gnu/usr.bin/gcc/f/bad.def | 46 +- gnu/usr.bin/gcc/f/bld.c | 11 +- gnu/usr.bin/gcc/f/bld.h | 2 +- gnu/usr.bin/gcc/f/bugs.texi | 129 +- gnu/usr.bin/gcc/f/com-rt.def | 86 +- gnu/usr.bin/gcc/f/com.c | 1278 +-- gnu/usr.bin/gcc/f/com.h | 25 +- gnu/usr.bin/gcc/f/config-lang.in | 9 +- gnu/usr.bin/gcc/f/data.c | 18 +- gnu/usr.bin/gcc/f/equiv.c | 78 +- gnu/usr.bin/gcc/f/equiv.h | 2 +- gnu/usr.bin/gcc/f/expr.c | 126 +- gnu/usr.bin/gcc/f/expr.h | 2 +- gnu/usr.bin/gcc/f/g77.1 | 12 +- gnu/usr.bin/gcc/f/g77.c | 459 +- gnu/usr.bin/gcc/f/g77.texi | 9765 +++++------------- gnu/usr.bin/gcc/f/gbe/2.6.3.diff | 186 + gnu/usr.bin/gcc/f/gbe/2.7.0.diff | 0 gnu/usr.bin/gcc/f/gbe/2.7.1.diff | 0 gnu/usr.bin/gcc/f/gbe/2.7.2.1.diff | 246 + gnu/usr.bin/gcc/f/gbe/2.7.2.diff | 801 ++ gnu/usr.bin/gcc/f/gbe/README | 36 +- gnu/usr.bin/gcc/f/global.c | 21 - gnu/usr.bin/gcc/f/global.h | 1 - gnu/usr.bin/gcc/f/install.texi | 797 +- gnu/usr.bin/gcc/f/intrin.c | 569 +- gnu/usr.bin/gcc/f/intrin.def | 1493 +-- gnu/usr.bin/gcc/f/intrin.h | 30 +- gnu/usr.bin/gcc/f/lang-options.h | 12 +- gnu/usr.bin/gcc/f/lang-specs.h | 2 +- gnu/usr.bin/gcc/f/lex.c | 61 +- gnu/usr.bin/gcc/f/name.h | 7 +- gnu/usr.bin/gcc/f/news.texi | 508 +- gnu/usr.bin/gcc/f/proj.h | 2 +- gnu/usr.bin/gcc/f/runtime/ChangeLog | 178 +- gnu/usr.bin/gcc/f/runtime/Makefile.in | 137 +- gnu/usr.bin/gcc/f/runtime/README | 10 +- gnu/usr.bin/gcc/f/runtime/TODO | 7 +- gnu/usr.bin/gcc/f/runtime/configure | 81 +- gnu/usr.bin/gcc/f/runtime/configure.in | 55 +- gnu/usr.bin/gcc/f/runtime/f2c.h.in | 16 +- gnu/usr.bin/gcc/f/runtime/libF77/Makefile.in | 47 +- gnu/usr.bin/gcc/f/runtime/libF77/Version.c | 7 +- gnu/usr.bin/gcc/f/runtime/libF77/c_cos.c | 13 +- gnu/usr.bin/gcc/f/runtime/libF77/c_div.c | 18 +- gnu/usr.bin/gcc/f/runtime/libF77/c_exp.c | 12 +- gnu/usr.bin/gcc/f/runtime/libF77/c_log.c | 13 +- gnu/usr.bin/gcc/f/runtime/libF77/c_sin.c | 13 +- gnu/usr.bin/gcc/f/runtime/libF77/c_sqrt.c | 18 +- gnu/usr.bin/gcc/f/runtime/libF77/d_cnjg.c | 13 +- gnu/usr.bin/gcc/f/runtime/libF77/pow_zi.c | 26 +- gnu/usr.bin/gcc/f/runtime/libF77/r_cnjg.c | 13 +- gnu/usr.bin/gcc/f/runtime/libF77/s_cat.c | 2 - gnu/usr.bin/gcc/f/runtime/libF77/s_paus.c | 2 +- gnu/usr.bin/gcc/f/runtime/libF77/signal_.c | 1 + gnu/usr.bin/gcc/f/runtime/libF77/z_cos.c | 13 +- gnu/usr.bin/gcc/f/runtime/libF77/z_div.c | 15 +- gnu/usr.bin/gcc/f/runtime/libF77/z_exp.c | 12 +- gnu/usr.bin/gcc/f/runtime/libF77/z_log.c | 12 +- gnu/usr.bin/gcc/f/runtime/libF77/z_sin.c | 13 +- gnu/usr.bin/gcc/f/runtime/libF77/z_sqrt.c | 20 +- gnu/usr.bin/gcc/f/runtime/libI77/Makefile.in | 37 +- gnu/usr.bin/gcc/f/runtime/libI77/README | 3 - gnu/usr.bin/gcc/f/runtime/libI77/Version.c | 12 +- gnu/usr.bin/gcc/f/runtime/libI77/backspace.c | 8 +- gnu/usr.bin/gcc/f/runtime/libI77/dfe.c | 10 +- gnu/usr.bin/gcc/f/runtime/libI77/due.c | 12 +- gnu/usr.bin/gcc/f/runtime/libI77/err.c | 5 +- gnu/usr.bin/gcc/f/runtime/libI77/fio.h | 4 +- gnu/usr.bin/gcc/f/runtime/libI77/fmtlib.c | 18 +- gnu/usr.bin/gcc/f/runtime/libI77/ftell_.c | 20 +- gnu/usr.bin/gcc/f/runtime/libI77/lread.c | 6 +- gnu/usr.bin/gcc/f/runtime/libI77/open.c | 12 +- gnu/usr.bin/gcc/f/runtime/libI77/rewind.c | 2 +- gnu/usr.bin/gcc/f/runtime/libI77/rsne.c | 2 +- gnu/usr.bin/gcc/f/runtime/libI77/sfe.c | 4 +- gnu/usr.bin/gcc/f/runtime/libI77/sue.c | 4 +- gnu/usr.bin/gcc/f/runtime/libI77/uio.c | 2 +- gnu/usr.bin/gcc/f/runtime/libI77/wrtfmt.c | 2 +- gnu/usr.bin/gcc/f/src.h | 4 +- gnu/usr.bin/gcc/f/sta.c | 488 +- gnu/usr.bin/gcc/f/stb.c | 35 +- gnu/usr.bin/gcc/f/stb.h | 3 +- gnu/usr.bin/gcc/f/stc.c | 67 +- gnu/usr.bin/gcc/f/std.c | 2 +- gnu/usr.bin/gcc/f/ste.c | 29 +- gnu/usr.bin/gcc/f/storag.c | 2 +- gnu/usr.bin/gcc/f/storag.h | 2 +- gnu/usr.bin/gcc/f/stt.c | 63 +- gnu/usr.bin/gcc/f/stt.h | 5 +- gnu/usr.bin/gcc/f/stu.c | 10 +- gnu/usr.bin/gcc/f/symbol.c | 12 +- gnu/usr.bin/gcc/f/symbol.def | 2 +- gnu/usr.bin/gcc/f/symbol.h | 5 +- gnu/usr.bin/gcc/f/target.c | 2 +- gnu/usr.bin/gcc/f/target.h | 394 +- gnu/usr.bin/gcc/f/top.c | 64 +- gnu/usr.bin/gcc/f/top.h | 23 +- gnu/usr.bin/gcc/f/type.c | 12 +- gnu/usr.bin/gcc/f/zzz.c | 2 +- gnu/usr.bin/gcc/flags.h | 13 - gnu/usr.bin/gcc/fold-const.c | 108 - gnu/usr.bin/gcc/gcc.texi | 2 +- gnu/usr.bin/gcc/glimits.h | 6 +- gnu/usr.bin/gcc/invoke.texi | 80 +- gnu/usr.bin/gcc/local-alloc.c | 4 +- gnu/usr.bin/gcc/loop.c | 21 +- gnu/usr.bin/gcc/loop.h | 3 - gnu/usr.bin/gcc/real.c | 74 +- gnu/usr.bin/gcc/real.h | 8 - gnu/usr.bin/gcc/reload.c | 55 +- gnu/usr.bin/gcc/rtl.h | 21 +- gnu/usr.bin/gcc/sched.c | 584 +- gnu/usr.bin/gcc/toplev.c | 18 +- gnu/usr.bin/gcc/tree.c | 28 +- gnu/usr.bin/gcc/unroll.c | 56 +- 137 files changed, 10330 insertions(+), 14898 deletions(-) create mode 100644 gnu/usr.bin/gcc/f/DOC create mode 100644 gnu/usr.bin/gcc/f/Make create mode 100644 gnu/usr.bin/gcc/f/PROJECTS create mode 100644 gnu/usr.bin/gcc/f/README.NEXTSTEP create mode 100644 gnu/usr.bin/gcc/f/gbe/2.6.3.diff create mode 100644 gnu/usr.bin/gcc/f/gbe/2.7.0.diff create mode 100644 gnu/usr.bin/gcc/f/gbe/2.7.1.diff create mode 100644 gnu/usr.bin/gcc/f/gbe/2.7.2.1.diff create mode 100644 gnu/usr.bin/gcc/f/gbe/2.7.2.diff diff --git a/gnu/usr.bin/gcc/ChangeLog b/gnu/usr.bin/gcc/ChangeLog index 6754184fa5c..3f955fb4a2e 100644 --- a/gnu/usr.bin/gcc/ChangeLog +++ b/gnu/usr.bin/gcc/ChangeLog @@ -1,70 +1,3 @@ -Wed Feb 26 13:09:33 1997 Michael Meissner - - * reload.c (debug_reload): Fix format string to print - reload_nocombine[r]. - -Sun Feb 23 15:26:53 1997 Craig Burley - - * fold-const.c (multiple_of_p): Clean up and improve. - (fold): Clean up invocation of multiple_of_p. - -Sat Feb 8 04:53:27 1997 Craig Burley - - From Fri, 07 Feb 1997 22:02:21 -0500: - * alias.c (init_alias_analysis): Reduce amount of time - needed to simplify the reg_base_value array in the - typical case (especially involving function inlining). - -Fri Jan 10 17:22:17 1997 Craig Burley - - Minor improvements/fixes to better alias handling: - * Makefile.in (alias.o): Fix typo in rule (was RLT_H). - * cse.c, sched.c: Fix up some indenting. - * toplev.c: Add -fargument-alias flag, so Fortran users - can turn C-style aliasing on once g77 defaults to - -fargument-noalias-global. - - Integrate patch for better alias handling from - John Carr : - * Makefile.in (OBJS, alias.o): New module and rule. - * alias.c: New source module. - * calls.c (expand_call): Recognize alias status of calls - to malloc(). - * combine.c (distribute_notes): New REG_NOALIAS note. - * rtl.h (REG_NOALIAS): Ditto. - Many other changes for new alias.c module. - * cse.c: Many changes, and much code moved into alias.c. - * flags.h (flag_alias_check, flag_argument_noalias): - New flags. - * toplev.c: New flags and related options. - * local-alloc.c (validate_equiv_mem_from_store): - Caller of true_dependence changed. - * loop.c (NUM_STORES): Increase to 50 from 20. - (prescan_loop): "const" functions don't alter unknown addresses. - (invariant_p): Caller of true_dependence changed. - (record_giv): Zero new unrolled and shared flags. - (emit_iv_add_mult): Record base value for register. - * sched.c: Many changes, mostly moving code to alias.c. - (sched_note_set): SCHED_SORT macro def form, but not function, - inexplicably changed. - * unroll.c: Record base values for registers, etc. - -Fri Jan 3 04:01:00 1997 Craig Burley - - * loop.c (check_final_value): Handle insns with no luid's - appropriately, instead of crashing on INSN_LUID macro - invocations. - -Mon Dec 23 00:49:19 1996 Craig Burley - - * config/alpha/alpha.md: Fix pattern that matches if_then_else - involving DF target, DF comparison, SF source. - -Fri Dec 20 15:42:52 1996 Craig Burley - - * fold-const.c (multiple_of_p): New function. - (fold): Use new function to turn *_DIV_EXPR into EXACT_DIV_EXPR. - Sat Jun 29 12:33:39 1996 Richard Kenner * Version 2.7.2.1 released. diff --git a/gnu/usr.bin/gcc/Makefile.in b/gnu/usr.bin/gcc/Makefile.in index 30e7fe5f852..d8c7610c7de 100644 --- a/gnu/usr.bin/gcc/Makefile.in +++ b/gnu/usr.bin/gcc/Makefile.in @@ -524,7 +524,7 @@ OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \ dbxout.o sdbout.o dwarfout.o xcoffout.o \ integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o \ regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o \ - insn-peep.o reorg.o alias.o sched.o final.o recog.o reg-stack.o \ + insn-peep.o reorg.o sched.o final.o recog.o reg-stack.o \ insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \ insn-attrtab.o $(out_object_file) getpwd.o convert.o $(EXTRA_OBJS) @@ -1249,7 +1249,6 @@ caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \ reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \ basic-block.h regs.h insn-config.h insn-attr.h insn-flags.h recog.h \ flags.h output.h -alias.o : $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h sched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \ flags.h insn-config.h insn-attr.h final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h regs.h \ diff --git a/gnu/usr.bin/gcc/README.g77 b/gnu/usr.bin/gcc/README.g77 index e95b60cdc01..edded28aece 100644 --- a/gnu/usr.bin/gcc/README.g77 +++ b/gnu/usr.bin/gcc/README.g77 @@ -1,6 +1,6 @@ -1997-02-28 +1996-03-05 -This directory contains the version 0.5.20 release of the GNU Fortran +This directory contains the version 0.5.18 release of the GNU Fortran compiler. The GNU Fortran compiler is free software. See the file COPYING.g77 for copying permission. @@ -14,10 +14,11 @@ which is the top-level directory containing the gcc back end, the gcc C front end, and other non-Fortran files, and gcc/f/, which contains all of the Fortran files. -* To build GNU Fortran, you must have a source distribution of gcc - version 2.7.2.2. Do not attempt to use any other version - of gcc, because this version of g77 is designed to work only with - gcc version 2.7.2.2. +* To build GNU Fortran, you must have a recent gcc distribution, + such as version 2.6.3 or 2.7.0. Do not attempt to use any version + of gcc prior to 2.6.2 or at or beyond 2.8.0 (or 3.0, etc.), because + this version of g77 is designed to work only with gcc versions 2.6.x + and 2.7.x. * Note that you must have source copies of these gcc distributions!! You cannot build g77 just using binaries of gcc. Also, unless you @@ -30,15 +31,15 @@ If you have just unpacked the g77 distribution, before proceeding, you must merge the contents of the g77 distribution with the appropriate gcc distribution on your system before proceeding. -* Read and follow the instructions in g77-0.5.20/f/INSTALL that +* Read and follow the instructions in g77-0.5.18/f/INSTALL that explain how to merge a g77 source directory into a gcc source directory. You can use Info to read the same installation instructions via: - info -f g77-0.5.20/f/g77.info -n Unpacking + info -f g77-0.5.18/f/g77.info -n Unpacking The resulting directory layout includes the following, where gcc/ might be -a link to, for example, gcc-2.7.2.2/: +a link to, for example, gcc-2.7.2/: gcc/ Non-Fortran files in gcc (not part of g77*.tar) gcc/README.g77 This file @@ -47,7 +48,6 @@ a link to, for example, gcc-2.7.2.2/: gcc/f/runtime/ libf2c configuration and f2c.h file generation gcc/f/runtime/libF77/ Non-I/O portion of libf2c gcc/f/runtime/libI77/ I/O portion of libf2c - gcc/f/runtime/libU77/ Additional interfaces to libc for libf2c gcc/f/ as a whole contains the program GNU Fortran (g77), plus a portion of the separate program f2c, which is in gcc/f/runtime. NOTE: The f2c @@ -110,7 +110,7 @@ seen in gcc/f/DOC) listed in the ~fortran/.plan file. Or: * Read gcc/f/BUGS, gcc/f/INSTALL, and gcc/f/NEWS at the very least! All users of g77 (not just installers) should read gcc/f/g77.info* as well, using the "more" command if the "info" command is - unavailable or they aren't accustomed to using it. + unavailable or they aren't used to using it. If you want to get into the FFE code, which lives entirely in gcc/f/, here are a few clues. The file g77.c is the stand-alone source file for the diff --git a/gnu/usr.bin/gcc/calls.c b/gnu/usr.bin/gcc/calls.c index 5eedf493af1..ad05be4f7c0 100644 --- a/gnu/usr.bin/gcc/calls.c +++ b/gnu/usr.bin/gcc/calls.c @@ -563,8 +563,6 @@ expand_call (exp, target, ignore) /* Nonzero if it is plausible that this is a call to alloca. */ int may_be_alloca; - /* Nonzero if this is a call to malloc or a related function. */ - int is_malloc; /* Nonzero if this is a call to setjmp or a related function. */ int returns_twice; /* Nonzero if this is a call to `longjmp'. */ @@ -853,7 +851,6 @@ expand_call (exp, target, ignore) returns_twice = 0; is_longjmp = 0; - is_malloc = 0; if (name != 0 && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) <= 15) { @@ -893,10 +890,6 @@ expand_call (exp, target, ignore) else if (tname[0] == 'l' && tname[1] == 'o' && ! strcmp (tname, "longjmp")) is_longjmp = 1; - /* Only recognize malloc when alias analysis is enabled. */ - else if (tname[0] == 'm' && flag_alias_check - && ! strcmp(tname, "malloc")) - is_malloc = 1; } if (may_be_alloca) @@ -1369,7 +1362,7 @@ expand_call (exp, target, ignore) /* Now we are about to start emitting insns that can be deleted if a libcall is deleted. */ - if (is_const || is_malloc) + if (is_const) start_sequence (); /* If we have no actual push instructions, or shouldn't use them, @@ -1958,20 +1951,6 @@ expand_call (exp, target, ignore) end_sequence (); emit_insns (insns); } - else if (is_malloc) - { - rtx temp = gen_reg_rtx (GET_MODE (valreg)); - rtx last, insns; - - emit_move_insn (temp, valreg); - last = get_last_insn (); - REG_NOTES (last) = - gen_rtx (EXPR_LIST, REG_NOALIAS, temp, REG_NOTES (last)); - insns = get_insns (); - end_sequence (); - emit_insns (insns); - valreg = temp; - } /* For calls to `setjmp', etc., inform flow.c it should complain if nonvolatile values are live. */ diff --git a/gnu/usr.bin/gcc/combine.c b/gnu/usr.bin/gcc/combine.c index e33fc10ce37..473adc83460 100644 --- a/gnu/usr.bin/gcc/combine.c +++ b/gnu/usr.bin/gcc/combine.c @@ -10647,7 +10647,6 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1) case REG_EQUAL: case REG_EQUIV: case REG_NONNEG: - case REG_NOALIAS: /* These notes say something about results of an insn. We can only support them if they used to be on I3 in which case they remain on I3. Otherwise they are ignored. diff --git a/gnu/usr.bin/gcc/config/alpha/alpha.c b/gnu/usr.bin/gcc/config/alpha/alpha.c index fc8e9ec0dec..0efe27ca733 100644 --- a/gnu/usr.bin/gcc/config/alpha/alpha.c +++ b/gnu/usr.bin/gcc/config/alpha/alpha.c @@ -1369,11 +1369,6 @@ output_prolog (file, size) We never need a GP for Windows/NT. */ alpha_function_needs_gp = 0; -#ifdef __linux__ - if(profile_flag) { - alpha_function_needs_gp = 1; - } -#endif for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) if ((GET_CODE (insn) == CALL_INSN) || (GET_RTX_CLASS (GET_CODE (insn)) == 'i' diff --git a/gnu/usr.bin/gcc/config/alpha/alpha.md b/gnu/usr.bin/gcc/config/alpha/alpha.md index 7ba3a50d682..72c54eee371 100644 --- a/gnu/usr.bin/gcc/config/alpha/alpha.md +++ b/gnu/usr.bin/gcc/config/alpha/alpha.md @@ -1745,9 +1745,9 @@ [(set (match_operand:DF 0 "register_operand" "=f,f") (if_then_else:DF (match_operator 3 "signed_comparison_operator" - [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG") + [(match_operand:DF 1 "reg_or_fp0_operand" "fG,fG") (match_operand:DF 2 "fp0_operand" "G,G")]) - (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")) + (float_extend:DF (match_operand:SF 4 "reg_or_fp0_operand" "fG,0")) (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))] "TARGET_FP" "@ diff --git a/gnu/usr.bin/gcc/config/alpha/xm-alpha.h b/gnu/usr.bin/gcc/config/alpha/xm-alpha.h index 6967756f84a..642e1cf1a6e 100644 --- a/gnu/usr.bin/gcc/config/alpha/xm-alpha.h +++ b/gnu/usr.bin/gcc/config/alpha/xm-alpha.h @@ -45,10 +45,8 @@ Boston, MA 02111-1307, USA. */ #if !defined(__GNUC__) && !defined(_WIN32) #include #else -#if !defined( __alpha__) || defined(__OpenBSD__) extern void *alloca (); #endif -#endif /* The host compiler has problems with enum bitfields since it makes them signed so we can't fit all our codes in. */ @@ -69,9 +67,7 @@ extern void *malloc (), *realloc (), *calloc (); /* OSF/1 has vprintf. */ -#ifndef linux /* 1996/02/22 mauro@craftwork.com -- unreliable with Linux */ #define HAVE_VPRINTF -#endif /* OSF/1 has putenv. */ diff --git a/gnu/usr.bin/gcc/config/x-linux b/gnu/usr.bin/gcc/config/x-linux index eeca9d1d843..ea2a5f270b3 100644 --- a/gnu/usr.bin/gcc/config/x-linux +++ b/gnu/usr.bin/gcc/config/x-linux @@ -12,6 +12,3 @@ BOOT_CFLAGS = -O $(CFLAGS) -Iinclude # Don't run fixproto STMP_FIXPROTO = - -# Don't install "assert.h" in gcc. We use the one in glibc. -INSTALL_ASSERT_H = diff --git a/gnu/usr.bin/gcc/configure b/gnu/usr.bin/gcc/configure index a2196166a09..1244600058f 100644 --- a/gnu/usr.bin/gcc/configure +++ b/gnu/usr.bin/gcc/configure @@ -81,7 +81,6 @@ exec_prefix='$(prefix)' # # The default g++ include directory is $(libdir)/g++-include. gxx_include_dir='$(libdir)/g++-include' -#gxx_include_dir='$(exec_prefix)/include/g++' # Default --program-transform-name to nothing. program_transform_name= @@ -556,13 +555,6 @@ for machine in $canon_build $canon_host $canon_target; do tmake_file=t-libc-ok xmake_file=x-openbsd ;; - alpha-*-linux*) - tm_file=alpha/linux.h - tmake_file=alpha/t-linux - xmake_file=alpha/x-linux - fixincludes=Makefile.in - xm_file=alpha/xm-linux.h - ;; alpha-dec-osf[23456789]*) tm_file=alpha/osf2.h if [ x$stabs = xyes ] @@ -1009,7 +1001,7 @@ for machine in $canon_build $canon_host $canon_target; do i[345]86-*-linux*oldld*) # Intel 80386's running Linux cpu_type=i386 # with a.out format using pre BFD linkers xm_file=i386/xm-linux.h - xmake_file=x-linux-aout + xmake_file=x-linux tm_file=i386/linux-oldld.h fixincludes=Makefile.in #On Linux, the headers are ok already. broken_install=yes @@ -1018,7 +1010,7 @@ for machine in $canon_build $canon_host $canon_target; do i[345]86-*-linux*aout*) # Intel 80386's running Linux cpu_type=i386 # with a.out format xm_file=i386/xm-linux.h - xmake_file=x-linux-aout + xmake_file=x-linux tm_file=i386/linux-aout.h fixincludes=Makefile.in #On Linux, the headers are ok already. broken_install=yes @@ -1027,7 +1019,7 @@ for machine in $canon_build $canon_host $canon_target; do i[345]86-*-linux*) # Intel 80386's running Linux cpu_type=i386 # with ELF format xm_file=i386/xm-linux.h - xmake_file=x-linux-aout + xmake_file=x-linux tm_file=i386/linux.h fixincludes=Makefile.in #On Linux, the headers are ok already. broken_install=yes diff --git a/gnu/usr.bin/gcc/cse.c b/gnu/usr.bin/gcc/cse.c index e6d2884245f..efd05dedaf9 100644 --- a/gnu/usr.bin/gcc/cse.c +++ b/gnu/usr.bin/gcc/cse.c @@ -519,6 +519,27 @@ static struct table_elt *last_jump_equiv_class; static int constant_pool_entries_cost; +/* Bits describing what kind of values in memory must be invalidated + for a particular instruction. If all three bits are zero, + no memory refs need to be invalidated. Each bit is more powerful + than the preceding ones, and if a bit is set then the preceding + bits are also set. + + Here is how the bits are set: + Pushing onto the stack invalidates only the stack pointer, + writing at a fixed address invalidates only variable addresses, + writing in a structure element at variable address + invalidates all but scalar variables, + and writing in anything else at variable address invalidates everything. */ + +struct write_data +{ + int sp : 1; /* Invalidate stack pointer. */ + int var : 1; /* Invalidate variable addresses. */ + int nonscalar : 1; /* Invalidate all but scalar variables. */ + int all : 1; /* Invalidate all memory refs. */ +}; + /* Define maximum length of a branch path. */ #define PATHLENGTH 10 @@ -604,10 +625,9 @@ static struct table_elt *insert PROTO((rtx, struct table_elt *, unsigned, static void merge_equiv_classes PROTO((struct table_elt *, struct table_elt *)); static void invalidate PROTO((rtx, enum machine_mode)); -static int cse_rtx_varies_p PROTO((rtx)); static void remove_invalid_refs PROTO((int)); static void rehash_using_reg PROTO((rtx)); -static void invalidate_memory PROTO((void)); +static void invalidate_memory PROTO((struct write_data *)); static void invalidate_for_call PROTO((void)); static rtx use_related_value PROTO((rtx, struct table_elt *)); static unsigned canon_hash PROTO((rtx, enum machine_mode)); @@ -617,6 +637,9 @@ static void set_nonvarying_address_components PROTO((rtx, int, rtx *, HOST_WIDE_INT *, HOST_WIDE_INT *)); static int refers_to_p PROTO((rtx, rtx)); +static int refers_to_mem_p PROTO((rtx, rtx, HOST_WIDE_INT, + HOST_WIDE_INT)); +static int cse_rtx_addr_varies_p PROTO((rtx)); static rtx canon_reg PROTO((rtx, rtx)); static void find_best_addr PROTO((rtx, rtx *)); static enum rtx_code find_comparison_args PROTO((enum rtx_code, rtx *, rtx *, @@ -632,8 +655,8 @@ static void record_jump_equiv PROTO((rtx, int)); static void record_jump_cond PROTO((enum rtx_code, enum machine_mode, rtx, rtx, int)); static void cse_insn PROTO((rtx, int)); -static int note_mem_written PROTO((rtx)); -static void invalidate_from_clobbers PROTO((rtx)); +static void note_mem_written PROTO((rtx, struct write_data *)); +static void invalidate_from_clobbers PROTO((struct write_data *, rtx)); static rtx cse_process_notes PROTO((rtx, rtx)); static void cse_around_loop PROTO((rtx)); static void invalidate_skipped_set PROTO((rtx, rtx)); @@ -1488,6 +1511,8 @@ invalidate (x, full_mode) { register int i; register struct table_elt *p; + rtx base; + HOST_WIDE_INT start, end; /* If X is a register, dependencies on its contents are recorded through the qty number mechanism. @@ -1579,17 +1604,16 @@ invalidate (x, full_mode) if (full_mode == VOIDmode) full_mode = GET_MODE (x); + set_nonvarying_address_components (XEXP (x, 0), GET_MODE_SIZE (full_mode), + &base, &start, &end); + for (i = 0; i < NBUCKETS; i++) { register struct table_elt *next; for (p = table[i]; p; p = next) { next = p->next_same_hash; - /* Invalidate ASM_OPERANDS which reference memory (this is easier - than checking all the aliases). */ - if (p->in_memory - && (GET_CODE (p->exp) != MEM - || true_dependence (x, full_mode, p->exp, cse_rtx_varies_p))) + if (refers_to_mem_p (p->exp, base, start, end)) remove_from_table (p, i); } } @@ -1670,6 +1694,30 @@ rehash_using_reg (x) } } +/* Remove from the hash table all expressions that reference memory, + or some of them as specified by *WRITES. */ + +static void +invalidate_memory (writes) + struct write_data *writes; +{ + register int i; + register struct table_elt *p, *next; + int all = writes->all; + int nonscalar = writes->nonscalar; + + for (i = 0; i < NBUCKETS; i++) + for (p = table[i]; p; p = next) + { + next = p->next_same_hash; + if (p->in_memory + && (all + || (nonscalar && p->in_struct) + || cse_rtx_addr_varies_p (p->exp))) + remove_from_table (p, i); + } +} + /* Remove from the hash table any expression that is a call-clobbered register. Also update their TICK values. */ @@ -1707,12 +1755,6 @@ invalidate_for_call () { next = p->next_same_hash; - if (p->in_memory) - { - remove_from_table (p, hash); - continue; - } - if (GET_CODE (p->exp) != REG || REGNO (p->exp) >= FIRST_PSEUDO_REGISTER) continue; @@ -2352,31 +2394,105 @@ set_nonvarying_address_components (addr, size, pbase, pstart, pend) *pend = end; } -/* Nonzero if X, a memory address, refers to a varying address; +/* Return 1 iff any subexpression of X refers to memory + at an address of BASE plus some offset + such that any of the bytes' offsets fall between START (inclusive) + and END (exclusive). + + The value is undefined if X is a varying address (as determined by + cse_rtx_addr_varies_p). This function is not used in such cases. + + When used in the cse pass, `qty_const' is nonzero, and it is used + to treat an address that is a register with a known constant value + as if it were that constant value. + In the loop pass, `qty_const' is zero, so this is not done. */ + +static int +refers_to_mem_p (x, base, start, end) + rtx x, base; + HOST_WIDE_INT start, end; +{ + register HOST_WIDE_INT i; + register enum rtx_code code; + register char *fmt; + + repeat: + if (x == 0) + return 0; + + code = GET_CODE (x); + if (code == MEM) + { + register rtx addr = XEXP (x, 0); /* Get the address. */ + rtx mybase; + HOST_WIDE_INT mystart, myend; + + set_nonvarying_address_components (addr, GET_MODE_SIZE (GET_MODE (x)), + &mybase, &mystart, &myend); + + + /* refers_to_mem_p is never called with varying addresses. + If the base addresses are not equal, there is no chance + of the memory addresses conflicting. */ + if (! rtx_equal_p (mybase, base)) + return 0; + + return myend > start && mystart < end; + } + + /* X does not match, so try its subexpressions. */ + + fmt = GET_RTX_FORMAT (code); + for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + if (fmt[i] == 'e') + { + if (i == 0) + { + x = XEXP (x, 0); + goto repeat; + } + else + if (refers_to_mem_p (XEXP (x, i), base, start, end)) + return 1; + } + else if (fmt[i] == 'E') + { + int j; + for (j = 0; j < XVECLEN (x, i); j++) + if (refers_to_mem_p (XVECEXP (x, i, j), base, start, end)) + return 1; + } + + return 0; +} + +/* Nonzero if X refers to memory at a varying address; except that a register which has at the moment a known constant value isn't considered variable. */ static int -cse_rtx_varies_p (x) - register rtx x; +cse_rtx_addr_varies_p (x) + rtx x; { /* We need not check for X and the equivalence class being of the same mode because if X is equivalent to a constant in some mode, it doesn't vary in any mode. */ - if (GET_CODE (x) == REG - && REGNO_QTY_VALID_P (REGNO (x)) - && GET_MODE (x) == qty_mode[reg_qty[REGNO (x)]] - && qty_const[reg_qty[REGNO (x)]] != 0) - return 0; - - if (GET_CODE (x) == PLUS - && GET_CODE (XEXP (x, 1)) == CONST_INT + if (GET_CODE (x) == MEM && GET_CODE (XEXP (x, 0)) == REG && REGNO_QTY_VALID_P (REGNO (XEXP (x, 0))) - && (GET_MODE (XEXP (x, 0)) - == qty_mode[reg_qty[REGNO (XEXP (x, 0))]]) - && qty_const[reg_qty[REGNO (XEXP (x, 0))]]) + && GET_MODE (XEXP (x, 0)) == qty_mode[reg_qty[REGNO (XEXP (x, 0))]] + && qty_const[reg_qty[REGNO (XEXP (x, 0))]] != 0) + return 0; + + if (GET_CODE (x) == MEM + && GET_CODE (XEXP (x, 0)) == PLUS + && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT + && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG + && REGNO_QTY_VALID_P (REGNO (XEXP (XEXP (x, 0), 0))) + && (GET_MODE (XEXP (XEXP (x, 0), 0)) + == qty_mode[reg_qty[REGNO (XEXP (XEXP (x, 0), 0))]]) + && qty_const[reg_qty[REGNO (XEXP (XEXP (x, 0), 0))]]) return 0; /* This can happen as the result of virtual register instantiation, if @@ -2384,20 +2500,21 @@ cse_rtx_varies_p (x) us a three instruction sequence, load large offset into a register, load fp minus a constant into a register, then a MEM which is the sum of the two `constant' registers. */ - if (GET_CODE (x) == PLUS - && GET_CODE (XEXP (x, 0)) == REG - && GET_CODE (XEXP (x, 1)) == REG - && REGNO_QTY_VALID_P (REGNO (XEXP (x, 0))) - && (GET_MODE (XEXP (x, 0)) - == qty_mode[reg_qty[REGNO (XEXP (x, 0))]]) - && qty_const[reg_qty[REGNO (XEXP (x, 0))]] - && REGNO_QTY_VALID_P (REGNO (XEXP (x, 1))) - && (GET_MODE (XEXP (x, 1)) - == qty_mode[reg_qty[REGNO (XEXP (x, 1))]]) - && qty_const[reg_qty[REGNO (XEXP (x, 1))]]) + if (GET_CODE (x) == MEM + && GET_CODE (XEXP (x, 0)) == PLUS + && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG + && GET_CODE (XEXP (XEXP (x, 0), 1)) == REG + && REGNO_QTY_VALID_P (REGNO (XEXP (XEXP (x, 0), 0))) + && (GET_MODE (XEXP (XEXP (x, 0), 0)) + == qty_mode[reg_qty[REGNO (XEXP (XEXP (x, 0), 0))]]) + && qty_const[reg_qty[REGNO (XEXP (XEXP (x, 0), 0))]] + && REGNO_QTY_VALID_P (REGNO (XEXP (XEXP (x, 0), 1))) + && (GET_MODE (XEXP (XEXP (x, 0), 1)) + == qty_mode[reg_qty[REGNO (XEXP (XEXP (x, 0), 1))]]) + && qty_const[reg_qty[REGNO (XEXP (XEXP (x, 0), 1))]]) return 0; - return rtx_varies_p (x); + return rtx_addr_varies_p (x); } /* Canonicalize an expression: @@ -5987,6 +6104,8 @@ cse_insn (insn, in_libcall_block) /* Records what this insn does to set CC0. */ rtx this_insn_cc0 = 0; enum machine_mode this_insn_cc0_mode; + struct write_data writes_memory; + static struct write_data init = {0, 0, 0, 0}; rtx src_eqv = 0; struct table_elt *src_eqv_elt = 0; @@ -5998,6 +6117,7 @@ cse_insn (insn, in_libcall_block) struct set *sets; this_insn = insn; + writes_memory = init; /* Find all the SETs and CLOBBERs in this instruction. Record all the SETs in the array `set' and count them. @@ -6099,13 +6219,14 @@ cse_insn (insn, in_libcall_block) } else if (GET_CODE (y) == CLOBBER) { - /* If we clobber memory, canon the address. + /* If we clobber memory, take note of that, + and canon the address. This does nothing when a register is clobbered because we have already invalidated the reg. */ if (GET_CODE (XEXP (y, 0)) == MEM) { canon_reg (XEXP (y, 0), NULL_RTX); - note_mem_written (XEXP (y, 0)); + note_mem_written (XEXP (y, 0), &writes_memory); } } else if (GET_CODE (y) == USE @@ -6127,7 +6248,7 @@ cse_insn (insn, in_libcall_block) if (GET_CODE (XEXP (x, 0)) == MEM) { canon_reg (XEXP (x, 0), NULL_RTX); - note_mem_written (XEXP (x, 0)); + note_mem_written (XEXP (x, 0), &writes_memory); } } @@ -6552,7 +6673,7 @@ cse_insn (insn, in_libcall_block) } } #endif /* LOAD_EXTEND_OP */ - + if (src == src_folded) src_folded = 0; @@ -6738,8 +6859,7 @@ cse_insn (insn, in_libcall_block) && (src_folded == 0 || (GET_CODE (src_folded) != MEM && ! src_folded_force_flag)) - && GET_MODE_CLASS (mode) != MODE_CC - && mode != VOIDmode) + && GET_MODE_CLASS (mode) != MODE_CC) { src_folded_force_flag = 1; src_folded = trial; @@ -6863,7 +6983,12 @@ cse_insn (insn, in_libcall_block) if (GET_CODE (dest) == MEM) { dest = fold_rtx (dest, insn); - note_mem_written (dest); + + /* Decide whether we invalidate everything in memory, + or just things at non-fixed places. + Writing a large aggregate must invalidate everything + because we don't know how long it is. */ + note_mem_written (dest, &writes_memory); } /* Compute the hash code of the destination now, @@ -7108,15 +7233,17 @@ cse_insn (insn, in_libcall_block) so that the destination goes into that class. */ sets[i].src_elt = src_eqv_elt; - invalidate_from_clobbers (x); + invalidate_from_clobbers (&writes_memory, x); /* Some registers are invalidated by subroutine calls. Memory is invalidated by non-constant calls. */ if (GET_CODE (insn) == CALL_INSN) { + static struct write_data everything = {0, 1, 1, 1}; + if (! CONST_CALL_P (insn)) - invalidate_memory (); + invalidate_memory (&everything); invalidate_for_call (); } @@ -7137,7 +7264,8 @@ cse_insn (insn, in_libcall_block) Needed for memory if this is a nonvarying address, unless we have just done an invalidate_memory that covers even those. */ if (GET_CODE (dest) == REG || GET_CODE (dest) == SUBREG - || GET_CODE (dest) == MEM) + || (GET_CODE (dest) == MEM && ! writes_memory.all + && ! cse_rtx_addr_varies_p (dest))) invalidate (dest, VOIDmode); else if (GET_CODE (dest) == STRICT_LOW_PART || GET_CODE (dest) == ZERO_EXTRACT) @@ -7403,46 +7531,51 @@ cse_insn (insn, in_libcall_block) prev_insn = insn; } +/* Store 1 in *WRITES_PTR for those categories of memory ref + that must be invalidated when the expression WRITTEN is stored in. + If WRITTEN is null, say everything must be invalidated. */ + static void -invalidate_memory () +note_mem_written (written, writes_ptr) + rtx written; + struct write_data *writes_ptr; { - register int i; - register struct table_elt *p, *next; - - for (i = 0; i < NBUCKETS; i++) - for (p = table[i]; p; p = next) - { - next = p->next_same_hash; - if (p->in_memory) - remove_from_table (p, i); - } -} + static struct write_data everything = {0, 1, 1, 1}; -static int -note_mem_written (mem) - register rtx mem; -{ - if (mem == 0 || GET_CODE(mem) != MEM ) - return 0; - else - { - register rtx addr = XEXP (mem, 0); - /* Pushing or popping the stack invalidates just the stack pointer. */ - if ((GET_CODE (addr) == PRE_DEC || GET_CODE (addr) == PRE_INC - || GET_CODE (addr) == POST_DEC || GET_CODE (addr) == POST_INC) - && GET_CODE (XEXP (addr, 0)) == REG - && REGNO (XEXP (addr, 0)) == STACK_POINTER_REGNUM) + if (written == 0) + *writes_ptr = everything; + else if (GET_CODE (written) == MEM) { - if (reg_tick[STACK_POINTER_REGNUM] >= 0) - reg_tick[STACK_POINTER_REGNUM]++; - - /* This should be *very* rare. */ - if (TEST_HARD_REG_BIT (hard_regs_in_table, STACK_POINTER_REGNUM)) - invalidate (stack_pointer_rtx, VOIDmode); - return 1; + /* Pushing or popping the stack invalidates just the stack pointer. */ + rtx addr = XEXP (written, 0); + if ((GET_CODE (addr) == PRE_DEC || GET_CODE (addr) == PRE_INC + || GET_CODE (addr) == POST_DEC || GET_CODE (addr) == POST_INC) + && GET_CODE (XEXP (addr, 0)) == REG + && REGNO (XEXP (addr, 0)) == STACK_POINTER_REGNUM) + { + writes_ptr->sp = 1; + return; + } + else if (GET_MODE (written) == BLKmode) + *writes_ptr = everything; + /* (mem (scratch)) means clobber everything. */ + else if (GET_CODE (addr) == SCRATCH) + *writes_ptr = everything; + else if (cse_rtx_addr_varies_p (written)) + { + /* A varying address that is a sum indicates an array element, + and that's just as good as a structure element + in implying that we need not invalidate scalar variables. + However, we must allow QImode aliasing of scalars, because the + ANSI C standard allows character pointers to alias anything. */ + if (! ((MEM_IN_STRUCT_P (written) + || GET_CODE (XEXP (written, 0)) == PLUS) + && GET_MODE (written) != QImode)) + writes_ptr->all = 1; + writes_ptr->nonscalar = 1; + } + writes_ptr->var = 1; } - return 0; - } } /* Perform invalidation on the basis of everything about an insn @@ -7450,19 +7583,38 @@ note_mem_written (mem) This includes the places CLOBBERed, and anything that might alias with something that is SET or CLOBBERed. + W points to the writes_memory for this insn, a struct write_data + saying which kinds of memory references must be invalidated. X is the pattern of the insn. */ static void -invalidate_from_clobbers (x) +invalidate_from_clobbers (w, x) + struct write_data *w; rtx x; { + /* If W->var is not set, W specifies no action. + If W->all is set, this step gets all memory refs + so they can be ignored in the rest of this function. */ + if (w->var) + invalidate_memory (w); + + if (w->sp) + { + if (reg_tick[STACK_POINTER_REGNUM] >= 0) + reg_tick[STACK_POINTER_REGNUM]++; + + /* This should be *very* rare. */ + if (TEST_HARD_REG_BIT (hard_regs_in_table, STACK_POINTER_REGNUM)) + invalidate (stack_pointer_rtx, VOIDmode); + } + if (GET_CODE (x) == CLOBBER) { rtx ref = XEXP (x, 0); if (ref) { if (GET_CODE (ref) == REG || GET_CODE (ref) == SUBREG - || GET_CODE (ref) == MEM) + || (GET_CODE (ref) == MEM && ! w->all)) invalidate (ref, VOIDmode); else if (GET_CODE (ref) == STRICT_LOW_PART || GET_CODE (ref) == ZERO_EXTRACT) @@ -7481,7 +7633,7 @@ invalidate_from_clobbers (x) if (ref) { if (GET_CODE (ref) == REG || GET_CODE (ref) == SUBREG - || GET_CODE (ref) == MEM) + || (GET_CODE (ref) == MEM && !w->all)) invalidate (ref, VOIDmode); else if (GET_CODE (ref) == STRICT_LOW_PART || GET_CODE (ref) == ZERO_EXTRACT) @@ -7647,6 +7799,10 @@ cse_around_loop (loop_start) } } +/* Variable used for communications between the next two routines. */ + +static struct write_data skipped_writes_memory; + /* Process one SET of an insn that was skipped. We ignore CLOBBERs since they are done elsewhere. This function is called via note_stores. */ @@ -7655,22 +7811,6 @@ invalidate_skipped_set (dest, set) rtx set; rtx dest; { - enum rtx_code code = GET_CODE (dest); - - if (code == MEM - && ! note_mem_written (dest) /* If this is not a stack push ... */ - /* There are times when an address can appear varying and be a PLUS - during this scan when it would be a fixed address were we to know - the proper equivalences. So invalidate all memory if there is - a BLKmode or nonscalar memory reference or a reference to a - variable address. */ - && (MEM_IN_STRUCT_P (dest) || GET_MODE (dest) == BLKmode - || cse_rtx_varies_p (XEXP (dest, 0)))) - { - invalidate_memory (); - return; - } - if (GET_CODE (set) == CLOBBER #ifdef HAVE_cc0 || dest == cc0_rtx @@ -7678,10 +7818,21 @@ invalidate_skipped_set (dest, set) || dest == pc_rtx) return; - if (code == STRICT_LOW_PART || code == ZERO_EXTRACT) - invalidate (XEXP (dest, 0), GET_MODE (dest)); - else if (code == REG || code == SUBREG || code == MEM) + if (GET_CODE (dest) == MEM) + note_mem_written (dest, &skipped_writes_memory); + + /* There are times when an address can appear varying and be a PLUS + during this scan when it would be a fixed address were we to know + the proper equivalences. So promote "nonscalar" to be "all". */ + if (skipped_writes_memory.nonscalar) + skipped_writes_memory.all = 1; + + if (GET_CODE (dest) == REG || GET_CODE (dest) == SUBREG + || (! skipped_writes_memory.all && ! cse_rtx_addr_varies_p (dest))) invalidate (dest, VOIDmode); + else if (GET_CODE (dest) == STRICT_LOW_PART + || GET_CODE (dest) == ZERO_EXTRACT) + invalidate (XEXP (dest, 0), GET_MODE (dest)); } /* Invalidate all insns from START up to the end of the function or the @@ -7693,6 +7844,8 @@ invalidate_skipped_block (start) rtx start; { rtx insn; + static struct write_data init = {0, 0, 0, 0}; + static struct write_data everything = {0, 1, 1, 1}; for (insn = start; insn && GET_CODE (insn) != CODE_LABEL; insn = NEXT_INSN (insn)) @@ -7700,14 +7853,16 @@ invalidate_skipped_block (start) if (GET_RTX_CLASS (GET_CODE (insn)) != 'i') continue; + skipped_writes_memory = init; + if (GET_CODE (insn) == CALL_INSN) { - if (! CONST_CALL_P (insn)) - invalidate_memory (); invalidate_for_call (); + skipped_writes_memory = everything; } note_stores (PATTERN (insn), invalidate_skipped_set); + invalidate_from_clobbers (&skipped_writes_memory, PATTERN (insn)); } } @@ -7757,6 +7912,10 @@ cse_set_around_loop (x, insn, loop_start) rtx loop_start; { struct table_elt *src_elt; + static struct write_data init = {0, 0, 0, 0}; + struct write_data writes_memory; + + writes_memory = init; /* If this is a SET, see if we can replace SET_SRC, but ignore SETs that are setting PC or CC0 or whose SET_SRC is already a register. */ @@ -7816,14 +7975,18 @@ cse_set_around_loop (x, insn, loop_start) } /* Now invalidate anything modified by X. */ - note_mem_written (SET_DEST (x)); - - /* See comment on similar code in cse_insn for explanation of these tests. */ - if (GET_CODE (SET_DEST (x)) == REG || GET_CODE (SET_DEST (x)) == SUBREG - || GET_CODE (SET_DEST (x)) == MEM) - invalidate (SET_DEST (x), VOIDmode); - else if (GET_CODE (SET_DEST (x)) == STRICT_LOW_PART - || GET_CODE (SET_DEST (x)) == ZERO_EXTRACT) + note_mem_written (SET_DEST (x), &writes_memory); + + if (writes_memory.var) + invalidate_memory (&writes_memory); + + /* See comment on similar code in cse_insn for explanation of these tests. */ + if (GET_CODE (SET_DEST (x)) == REG || GET_CODE (SET_DEST (x)) == SUBREG + || (GET_CODE (SET_DEST (x)) == MEM && ! writes_memory.all + && ! cse_rtx_addr_varies_p (SET_DEST (x)))) + invalidate (SET_DEST (x), VOIDmode); + else if (GET_CODE (SET_DEST (x)) == STRICT_LOW_PART + || GET_CODE (SET_DEST (x)) == ZERO_EXTRACT) invalidate (XEXP (SET_DEST (x), 0), GET_MODE (SET_DEST (x))); } @@ -8070,7 +8233,6 @@ cse_main (f, nregs, after_loop, file) val.path_size = 0; init_recog (); - init_alias_analysis (); max_reg = nregs; diff --git a/gnu/usr.bin/gcc/f/BUGS b/gnu/usr.bin/gcc/f/BUGS index a1e7fc6ff6e..f6232ce52ba 100644 --- a/gnu/usr.bin/gcc/f/BUGS +++ b/gnu/usr.bin/gcc/f/BUGS @@ -15,17 +15,24 @@ separating them out. For information on bugs that might afflict people who configure, port, build, and install `g77', *Note Problems Installing::. - * Work is needed on the `SIGNAL()' intrinsic to ensure that pointers - and integers are properly handled on all targets, including 64-bit - machines. - - * When using `-fugly-comma', `g77' assumes an extra `%VAL(0)' - argument is to be passed to intrinsics taking no arguments, such - as `IARGC()', which in turn reject such a call. Although this has - been worked around for 0.5.18 due to changes in the handling of - intrinsics, `g77' needs to do the ugly-argument-appending trick - only for external-function invocation, as this would probably be - more consistent with compilers that default to using that trick. + * When using `-fugly', `g77' assumes an extra `%VAL(0)' argument is + to be passed to intrinsics taking no arguments, such as `IARGC()', + which in turn reject such a call. Although this has been worked + around for 0.5.18 due to changes in the handling of intrinsics, + `g77' needs to do the ugly-argument-appending trick only for + external-function invocation, as this would probably be more + consistent with compilers that default to using that trick. + + * Although `g77' generally supports `SELECT CASE', it doesn't do so + for `CHARACTER' types. Worse, it just crashes with a barely + servicable diagnostic. If the time can't be taken soon to finish + implementing this feature, at least a better way of diagnosing the + problem should be provided. + + * To accept a lot of fine code, `g77' needs to accept `FORMAT' and + `ENTRY' before an `IMPLICIT NONE'. + + * Some crashes occur when compiling under Solaris on x86 machines. * Something about `g77''s straightforward handling of label references and definitions sometimes prevents the GBE from @@ -40,9 +47,12 @@ port, build, and install `g77', *Note Problems Installing::. * Some confusion in diagnostics concerning failing `INCLUDE' statements from within `INCLUDE''d or `#include''d files. - * `g77' assumes that `INTEGER(KIND=1)' constants range from `-2**31' - to `2**31-1' (the range for two's-complement 32-bit values), - instead of determining their range from the actual range of the + * Some problems on RS/6000 regarding statement functions and/or + `COMPLEX' arithmetic? + + * `g77' assumes that `INTEGER' constants range from `-2**31' to + `2**31-1' (the range for two's-complement 32-bit values), instead + of determining their range from the actual range of the `INTEGER' type for the configuration (and, someday, for the constant). Further, it generally doesn't implement the handling of constants @@ -103,24 +113,9 @@ port, build, and install `g77', *Note Problems Installing::. that's the state in which the debugger should start up, as is the case for languages like C. - * Debugging `g77'-compiled code using debuggers other than `gdb' is - likely not to work. - - Getting `g77' and `gdb' to work together is a known - problem--getting `g77' to work properly with other debuggers, for - which source code often is unavailable to `g77' developers, seems - like a much larger, unknown problem, and is a lower priority than - making `g77' and `gdb' work together properly. - - On the other hand, information about problems other debuggers have - with `g77' output might make it easier to properly fix `g77', and - perhaps even improve `gdb', so it is definitely welcome. Such - information might even lead to all relevant products working - together properly sooner. - * `g77' currently inserts needless padding for things like `COMMON - A,IPAD' where `A' is `CHARACTER*1' and `IPAD' is `INTEGER(KIND=1)' - on machines like x86, because the back end insists that `IPAD' be + A,IPAD' where `A' is `CHARACTER*1' and `IPAD' is `INTEGER*4' on + machines like x86, because the back end insists that `IPAD' be aligned to a 4-byte boundary, but the processor has no such requirement (though it's good for performance). @@ -131,12 +126,6 @@ port, build, and install `g77', *Note Problems Installing::. potential, with the current setup, for interface differences in the way such areas are laid out between `g77' and other compilers. - * Some crashes occur when compiling under Solaris on x86 machines. - - Nothing has been heard about any such problems for some time, so - this is considering a closed item as of 0.5.20. Please submit any - bug reports pertinent to `g77''s support for Solaris/x86 systems. - * RS/6000 support is not complete as of the gcc 2.6.3 back end. The 2.7.0 back end appears to fix this problem, or at least mitigate it significantly, but there is at least one known problem that is @@ -144,34 +133,13 @@ port, build, and install `g77', *Note Problems Installing::. `g77-0.5.16'. This problem shows up only when compiling the Fortran program with `-O'. - Nothing has been heard about any RS/6000 problems for some time, - so this is considering a closed item as of 0.5.20. Please submit - any bug reports pertinent to `g77''s support for RS/6000 systems. - * SGI support is known to be a bit buggy. The known problem shows up only when compiling the Fortran program with `-O'. - It is possible these problems have all been fixed in 0.5.20 by - emulating complex arithmetic in the front end. Please submit any - bug reports pertinent to `g77''s support for SGI systems. - - * `g77' doesn't work perfectly on 64-bit configurations such as the - Alpha. This problem is expected to be largely resolved as of - version 0.5.20, and version 0.6 should solve most or all related - problems (such as 64-bit machines other than DEC Alphas). - - One known bug that causes a compile-time crash occurs when - compiling code such as the following with optimization: - - SUBROUTINE CRASH (TEMP) - INTEGER*2 HALF(2) - REAL TEMP - HALF(1) = NINT (TEMP) - END - - It is expected that a future version of `g77' will have a fix for - this problem, almost certainly by the time `g77' supports the - forthcoming version 2.8.0 of `gcc'. + * `g77' doesn't work on 64-bit configurations such as the Alpha. + This problem is expected to be largely resolved as of version + 0.5.20, and version 0.6 should solve most or all related problems + (such as 64-bit machines other than DEC Alphas). * Maintainers of gcc report that the back end definitely has "broken" support for `COMPLEX' types. Based on their input, it seems many @@ -179,11 +147,9 @@ port, build, and install `g77', *Note Problems Installing::. `__complex__' type, such as `__complex__ int' (where the real and imaginary parts are integers) that GNU Fortran does not use. - Version 0.5.20 of `g77' works around this problem by not using the - back end's support for `COMPLEX'. The new option - `-fno-emulate-complex' avoids the work-around, reverting to using - the same "broken" mechanism as that used by versions of `g77' - prior to 0.5.20. + Version 0.5.20 of `g77' is expected to work around this problem by + not using the back end's support for `COMPLEX'. This work has + already been done, and is being tested by developers. * There seem to be some problems with passing constants, and perhaps general expressions (other than simple variables/arrays), to @@ -194,3 +160,5 @@ port, build, and install `g77', *Note Problems Installing::. the gcc back end, and it apparently occurs only when compiling sufficiently complicated functions *without* the `-O' option. + This might be fixed in version 2.7.2 of `gcc'. + diff --git a/gnu/usr.bin/gcc/f/ChangeLog b/gnu/usr.bin/gcc/f/ChangeLog index 6e483dcadef..031133da65e 100644 --- a/gnu/usr.bin/gcc/f/ChangeLog +++ b/gnu/usr.bin/gcc/f/ChangeLog @@ -1,374 +1,3 @@ -Fri Feb 28 13:16:50 1997 Craig Burley - - * Version 0.5.20 released. - -Fri Feb 28 01:45:25 1997 Craig Burley - - * Make-lang.in (RUNTIMESTAGESTUFF, LIBU77STAGESTUFF): - Move some files incorrectly in the former to the latter, - and add another file or two to the latter. - - New meanings for (KIND=n), and new denotations in the - little language describing intrinsics: - * com.c (ffecom_init_0): Assign new meanings. - * intdoc.c: Document new meanings. - Support the new denotations. - * intrin.c: Employ new meanings, mapping them to internal - values (which are the same as they ever were for now). - Support the new denotations. - * intrin.def: Switch DEFIMP table to the new denotations. - - * intrin.c (ffeintrin_check_): Fix bug that was leaving - LOC() and %LOC() returning INTEGER*4 on systems where - it should return INTEGER*8. - - * type.c: Canonicalize function definitions, for etags - and such. - -Wed Feb 26 20:43:03 1997 Craig Burley - - * com.c (ffecom_init_0): Choose INTEGER(KIND=n) types, - where n is 2, 3, and 4, according to the new docs - instead of according to the old C correspondences - (which seem less useful at this point). - - * equiv.c (ffeequiv_destroy_): New function. - (ffeequiv_layout_local_): Use this new function - whenever the laying out of a local equivalence chain - is aborted for any reason. - Otherwise ensure that symbols no longer reference - the stale ffeequiv entries that result when they - are killed off in this procedure. - Also, the rooted symbol is one that has storage, - it really is irrelevant whether it has an equiv entry - at this point (though the code to remove the equiv - entry was put in at the end, just in case). - (ffeequiv_kill): When doing internal checks, make - sure the victim isn't named by any symbols it points - to. Not as complete a check as looking through the - entire symbol table (which does matter, since some - code in equiv.c used to remove symbols from the lists - for an ffeequiv victim but not remove that victim as the - symbol's equiv info), but this check did find some - real bugs in the code (that were fixed). - -Mon Feb 24 16:42:13 1997 Craig Burley - - * com.c (ffecom_expr_intrinsic_): Fix a couple of - warnings about uninitialized variables. - * intrin.c (ffeintrin_check_): Ditto, but there were - a couple of _real_ uninitialized-variable _bugs_ here! - (ffeintrin_fulfill_specific): Ditto, no real bug here. - -Sun Feb 23 15:01:20 1997 Craig Burley - - Clean up diagnostics (especially about intrinsics): - * bad.def (FFEBAD_UNIMPL_STMT): Remove. - (FFEBAD_INTRINSIC_*, FFEBAD_NEED_INTRINSIC): Clean these - up so they're friendlier. - (FFEBAD_INTRINSIC_CMPAMBIG): New. - * intrin.c (ffeintrin_fulfill_generic, - ffeintrin_fulfill_specific, ffeintrin_is_intrinsic): - Always choose - generic or specific name text (which is for doc purposes - anyway) over implementation name text (which is for - internal use). - * intrin.def: Use more descriptive name texts for generics - and specifics in cases where the names themselves are not - enough (e.g. IDATE, which has two forms). - - Fix some intrinsic mappings: - * intrin.def (FFEINTRIN_specIDINT, FFEINTRIN_specAND, - FFEINTRIN_specDFLOAT, FFEINTRIN_specDREAL, FFEINTRIN_specOR, - FFEINTRIN_specXOR): Now have their own implementations, - instead of borrowing from others. - (FFEINTRIN_specAJMAX0, FFEINTRIN_specAJMIN0, FFEINTRIN_specBJTEST, - FFEINTRIN_specDFLOTJ, FFEINTRIN_specFLOATJ, FFEINTRIN_specJIABS, - FFEINTRIN_specJIAND, FFEINTRIN_specJIBCLR, FFEINTRIN_specJIBITS, - FFEINTRIN_specJIBSET, FFEINTRIN_specJIDIM, FFEINTRIN_specJIDINT, - FFEINTRIN_specJIDNNT, FFEINTRIN_specJIEOR, FFEINTRIN_specJIFIX, - FFEINTRIN_specJINT, FFEINTRIN_specJIOR, FFEINTRIN_specJISHFT, - FFEINTRIN_specJISHFTC, FFEINTRIN_specJISIN, FFEINTRIN_specJMAX0, - FFEINTRIN_specJMAX1, FFEINTRIN_specJMIN0, FFEINTRIN_specJMIN1, - FFEINTRIN_specJMOD, FFEINTRIN_specJNINT, FFEINTRIN_specJNOT,): - Turn these implementations off, since it's not clear - just what types they expect in the context of portable Fortran. - (DFLOAT): Now in FVZ family, since f2c supports them - - Support intrinsic inquiry functions (BIT_SIZE, LEN): - * intrin.c: Allow `i' in . - * intrin.def (FFEINTRIN_impBIT_SIZE, FFEINTRIN_impLEN): - Mark args with `i'. - -Sat Feb 22 13:34:09 1997 Craig Burley - - Only warn, don't error, for reference to unimplemented - intrinsic: - * bad.def (FFEBAD_INTRINSIC_UNIMPLW): Warning version - of _UNIMPL. - * intrin.c (ffeintrin_is_intrinsic): Use new warning - version of _UNIMPL (FFEBAD_INTRINSIC_UNIMPLW). - - Complain about REAL(Z) and AIMAG(Z) (Z is DOUBLE COMPLEX): - * bad.def (FFEBAD_INTRINSIC_CMPAMBIG): New diagnostic. - * expr.c: Needed #include "intrin.h" anyway. - (ffeexpr_token_intrincheck_): New function handles delayed - diagnostic for "REAL(REAL(expr)" if next token isn't ")". - (ffeexpr_token_arguments_): Do most of the actual checking here. - * intrin.h, intrin.c (ffeintrin_fulfill_specific): New - argument, check_intrin, to tell caller that intrin is REAL(Z) - or AIMAG(Z). All callers updated, mostly to pass NULL in - for this. - (ffeintrin_check_): Also has new arg check_intrin for same - purpose. All callers updated the same way. - * intrin.def (FFEINTRIN_impAIMAG): Change return type - from "R0" to "RC", to accommodate f2c (and perhaps other - non-F90 F77 compilers). - * top.h, top.c: New option -fugly-complex. - - New GNU intrinsics REALPART, IMAGPART, and COMPLEX: - * com.c (ffecom_expr_intrinsic_): Implement impCOMPLEX - and impREALPART here. (specIMAGPART => specAIMAG.) - * intrin.def: Add the intrinsics here. - - Rename implementations of VXTIDATE and VXTTIME to IDATEVXT - and TIMEVXT, so they sort more consistently: - * com.c (ffecom_expr_intrinsic_): - * intrin.def: - - Delete intrinsic group `dcp', add `gnu', etc.: - * intrin.c (ffeintrin_state_family): FFEINTRIN_familyGNU - replaces FFEINTRIN_familyDCP, and gets state from `gnu' - group. - Get rid of FFEINTRIN_familyF2Z, nobody needs it. - Move FFEINTRIN_specDCMPLX from DCP family to FVZ family, - as f2c has it. - Move FFEINTRIN_specDFLOAT from F2C family to FVZ family. - (FFEINTRIN_specZABS, FFEINTRIN_specZCOS, FFEINTRIN_specZEXP, - FFEINTRIN_specZLOG, FFEINTRIN_specZSIN, FFEINTRIN_specZSQRT): - Move these from F2Z family to F2C family. - * intrin.h (FFEINTRIN_familyF2Z, FFEINTRIN_familyDCP): Remove. - (FFEINTRIN_familyGNU): Add. - * top.h, top.c: Replace `dcp' with `gnu'. - - * com.c (ffecom_expr_intrinsic_): Clean up by collecting - simple conversions into one nice, conceptual place. - Fix up some intrinsic subroutines (MVBITS, KILL, UMASK) to - properly push and pop call temps, to avoid wasting temp - registers. - - * g77.c (doit): Toon says variables should be defined - before being referenced. Spoilsport. - - * intrin.c (ffeintrin_check_): Now Dave's worried about - warnings about uninitialized variables. Okay, so for - basic return values 'g' and 's', they _were_ - uninitialized -- is determinism really _that_ useful? - - * intrin.def (FFEINTRIN_impFGETC): Fix STATUS argument - so that it is INTENT(OUT) instead of INTENT(IN). - -1997-02-21 Dave Love - - * intrin.def, com.c: Support Sun-type `short' and `long' - intrinsics. Perhaps should also do Microcruft-style `int2'. - -Thu Feb 20 15:16:53 1997 Craig Burley - - * com.c (ffecom_expr_intrinsic_): Clean up indentation. - Support SECONDSUBR intrinsic implementation. - Rename SECOND to SECONDFUNC for direct support via library. - - * g77.c: Fix to return proper status value to shell, - by obtaining it from processes it spawns. - - * intdoc.c: Fix minor typo. - - * intrin.def: Turn SECOND into generic that maps into - function and subroutine forms. - - * intrin.def: Make FLOAT and SNGL into specific intrinsics. - - * intrin.def, intrin.h: Change the way DEFGEN and DEFSPEC - macros work, to save on verbage. - -Mon Feb 17 02:08:04 1997 Craig Burley - - New subsystem to automatically generate documentation - on intrinsics: - * Make-lang.in ($(srcdir)/f/g77.info, - $(srcdir)/f/g77.dvi): Move g77 doc rules around. - Add to g77 doc rules the new subsystem. - (f77.mostlyclean, f77.maintainer-clean): Also clean up - after new doc subsystem. - * intdoc.c, intdoc.h: New doc subsystem code. - * intrin.h [FFEINTRIN_DOC]: When 1, don't pull in - stuff not needed by doc subsystem. - - Improve on intrinsics mechanism to both be more - self-documenting and to catch more user errors: - * intrin.c (ffeintrin_check_): Recognize new arg-len - and arg-rank information, and check it. - Move goto and signal indicators to the basic type. - Permit reference to arbitrary argument number, not - just first argument (for BESJN and BESYN). - (ffeintrin_init_0): Check and accept new notations. - * intrin.c, intrin.def: Value in COL now identifies - arguments starting with number 0 being the first. - - Some minor intrinsics cleanups (resulting from doc work): - * com.c (ffecom_expr_intrinsic_): Implement FLUSH - directly once again, handle its optional argument, - so it need not be a generic (awkward to handle in docs). - * intrin.def (BESJ0, BESJ1, BESJN, BESY0, BESY1, BESYN, - CHDIR, CHMOD, CTIME, DBESJ0, DBESJ1, DBESJN, DBESY0, - DBESY1, DBESYN, DDIM, ETIME, FGETC, FNUM, FPUTC, FSTAT, - GERROR, GETCWD, GETGID, GETLOG, GETPID, GETUID, GMTIME, - HOSTNM, IDATE, IERRNO, IIDINT, IRAND, ISATTY, ITIME, JIDINT, - LNBLNK, LSTAT, LTIME, MCLOCK, PERROR, SRAND, SYMLNK, TTYNAM, - UMASK): Change capitalization of initcaps (official) name - to be consistent with Burley's somewhat arbitrary rules. - (BESJN, BESYN): These have return arguments of same type - as their _second_ argument. - (FLUSH): Now a specific, not generic, intrinsic, with one - optional argument. - (FLUSH1): Eliminated. - Add arg-len and arg-rank info to several intrinsics. - (ITIME): Change argument type from REAL to INTEGER. - -Tue Feb 11 14:04:42 1997 Craig Burley - - * Make-lang.in (f771): Invocation of Makefile now done - with $(srcdir)=gcc to go along with $(VPATH)=gcc. - ($(srcdir)/f/runtime/configure, - $(srcdir)/f/runtime/libU77/configure): Break these out - so spurious triggers of this rule don't happen (as when - configure.in is more recent than libU77/configure). - (f77.rebuilt): Distinguish source versus build files, - so this target can be invoked from build directory and - still work. - * Makefile.in: This now expects $(srcdir) to be the gcc - source directory, not gcc/f, to agree with $(VPATH). - Accordingly, $(INCLUDES) has been fixed, various cruft - removed, the removal of f771 has been fixed to remove - the _real_ f771 (not the one in gcc's parent directory), - and so on. - - * lex.c: Part of ffelex_finish_statement_() now done - by new function ffelex_prepare_eos_(), so that, in one - popular case, the EOS can be prepared while the pointer - is at the end of the non-continued line instead of the - end of the line that marks no continuation. This improves - the appearance of diagnostics substantially. - -Mon Feb 10 12:44:06 1997 Craig Burley - - * Make-lang.in: runtime Makefile's, and include/f2c.h, - also depend on f/runtime/configure and f/runtime/libU77/configure. - - Fix various libU77 routines: - * com-rt.def (FFECOM_gfrtCTIME, FFECOM_gfrtMCLOCK, - FFECOM_gfrtTIME): These now use INTEGER*8 for time values, - for compatibility with systems like Alpha. - (FFECOM_gfrtSYSTEM_CLOCK, FFECOM_gfrtTTYNAM): Delete incorrect - trailing underscore in routine names. - * intrin.c, intrin.def: Support INTEGER*8 return values and - arguments ('4'). Change FFEINTRIN_impCTIME, FFEINTRIN_impMCLOCK, - and FFEINTRIN_impTIME accordingly. - (ffeintrin_is_intrinsic): Don't give caller a clue about - form of intrinsic -- shouldn't be needed at this point. - - Cope with generic intrinsics that are subroutines and functions: - * com.c (ffecom_finish_symbol_transform_, ffecom_expr_transform_): - Don't transform an intrinsic that is not known to be a subroutine - or a function. (Maybe someday have to avoid transforming - any intrinsic with an undecided or unknown implementation.) - * expr.c (ffeexpr_declare_unadorned_, - ffeexpr_declare_parenthesized_): Ok to invoke generic - intrinsic that has at least one subroutine form as a - subroutine. - Ok to pass intrinsic as actual arg if it has a known specific - intrinsic form that is valid as actual arg. - (ffeexpr_declare_parenthesized_): An unknown kind of - intrinsic has a paren_type chosen based on context. - (ffeexpr_token_arguments_): Build funcref/subrref based - on context, not on kind of procedure being called. - * intrin.h, intrin.c (ffeintrin_is_intrinsic): Undo changes of - Tue Feb 4 23:12:04 1997 by me, change all callers to leave - intrinsics as FFEINFO_kindNONE at this point. (Some callers - also had unused variables deleted as a result.) - - Enable all intrinsic groups (especially f90 and vxt): - * target.h (FFETARGET_defaultSTATE_DCP, FFETARGET_defaultSTATE_F2C, - FFETARGET_defaultSTATE_F90, FFETARGET_defaultSTATE_MIL, - FFETARGET_defaultSTATE_UNIX, FFETARGET_defaultSTATE_VXT): - Delete these macros, let top.c set them directly. - * top.c (ffeintrinsic_state_dcp_, ffe_intrinsic_state_f2c_, - ffe_intrinsic_state_f90_, ffe_intrinsic_state_mil_, - ffe_intrinsic_state_unix_, ffe_intrinsic_state_vxt_): - Enable all these directly. - -Sat Feb 8 03:21:50 1997 Craig Burley - - * g77.c: Incorporate recent changes to ../gcc.c. - For version magic (e.g. `g77 -v'), instead of compiling - /dev/null, write, compile, run, and then delete a small - program that prints the version numbers of the three - components of libf2c (libF77, libI77, and libU77), - so we get this info with bug reports. - Also, this change reduces the chances of accidentally - linking to an old (complex-alias-problem) libf2c. - Fix `-L' so the argument is expected in `-Larg'. - - * com.h (FFECOM_f2cLONGINT): For INTEGER*8 support in f2c.h, - dynamically determine proper type here, instead of - assuming `long long int' is correct. - -Tue Feb 4 23:12:04 1997 Craig Burley - - Add libU77 library from Dave Love : - * Make-lang.in (f77-runtime): Depend on new Makefile. - (f/runtime/libU77/Makefile): New rule. - Also configure libU77. - ($(srcdir)/f/runtime/configure: Use Makefile.in, - so configuration doesn't have to have happened. - (f77.mostlyclean, f77.clean, f77.distclean, - f77.maintainer-clean): Some fixups here, but more work - needed. - (RUNTIMESTAGESTUFF): Add libU77's config.status. - (LIBU77STAGESTUFF, f77.stage1, f77.stage2, f77.stage3, - f77.stage4): New macro, appropriate uses added. - * com-rt.def: Add libU77 procedures. - * com.c (ffecom_f2c_ptr_to_integer_type_node, - ffecom_f2c_ptr_to_real_type_node): New type nodes. - (FFECOM_rttypeCHARACTER_): New type of run-time function. - (ffecom_char_args_): Handle CHARACTER*n intrinsics - where n != 1 here, instead of in ffecom_expr_intrinsic_. - (ffecom_expr_intrinsic_): New code to handle new - intrinsics. - In particular, change how FFEINTRIN_impFLUSH is handled. - (ffecom_make_gfrt_): Handle new type of run-time function. - (ffecom_init_0): Initialize new type nodes. - * config-lang.in: New libU77 directory. - * intrin.h, intrin.c (ffeintrin_is_intrinsic): Handle - potential generic for subroutine _and_ function - specifics via two new arguments. All callers changed. - Properly ignore deleted/disabled intrinsics in resolving - generics. - (ffeintrin_check_, ffeintrin_init_0): Handle CHARACTER intrinsics of (*) - length. - * intrin.def: Permission granted by FSF to place this in - public domain, which will allow it to serve as source - for both g77 program and its documentation. - Add libU77 intrinsics. - (FLUSH): Now a generic, not specific, intrinsic. - (DEFIMP): Now support return modifier for CHARACTER intrinsics. - - * com-rt.def (FFECOM_gfrtDIM, FFECOM_gfrtERF, - FFECOM_gfrtERFC, FFECOM_gfrtEXP, FFECOM_gfrtSIGN, - FFECOM_gfrtSIN, FFECOM_gfrtSINH, FFECOM_gfrtTAN, - FFECOM_gfrtTANH, FFECOM_gfrtPOW_RI): Change "&r" to "&f". - Sat Feb 1 12:15:09 1997 Craig Burley * Version 0.5.19.1 released. @@ -383,224 +12,6 @@ Sat Feb 1 12:15:09 1997 Craig Burley FFECOM_gfrtDIV_CC, FFECOM_gfrtDIV_ZZ: These all require result to _not_ overlap one or more inputs. -Sat Feb 1 00:25:55 1997 Craig Burley - - * com.c (ffecom_init_0): Do internal checks only if - -fset-g77-defaults not specified. - - Fix %LOC(), LOC() to return sufficiently wide type: - * com.h, com.c (ffecom_pointer_kind_, ffecom_label_kind_, - ffecom_pointer_kind(), ffecom_label_kind()): New globals - and accessor macros hold kind for integer pointers on target - machine. - (ffecom_init_0): Determine narrowest INTEGER type that - can hold a pointer (usually INTEGER*4 or INTEGER*8), - store it in ffecom_pointer_kind_, etc. - * expr.c (ffeexpr_cb_end_loc_): Use right type for %LOC(). - * intrin.c (ffeintrin_check_, ffeintrin_init_0): Support - new 'p' kind for type of intrinsic. - * intrin.def (FFEINTRIN_impLOC): Returns "Ip" instead of "I1", - so LOC() type is correct for target machine. - - Support -fugly-assign: - * lang-options.h, top.h, top.c (ffe_decode_option): - Accept -fugly-assign and -fno-ugly-assign. - * com.c (ffecom_expr_): Handle -fugly-assign. - * expr.c (ffeexpr_finished_): Check right type for ASSIGN - contexts. - -Fri Jan 31 14:30:00 1997 Craig Burley - - Remove last vestiges of -fvxt-not-f90: - * stb.c (ffestb_R10012_, ffestb_R10014_, ffestb_V0201_): - top.c, top.h: - -Fri Jan 31 02:13:54 1997 Craig Burley - - * top.c (ffe_decode_option): Warn if -fugly is specified, - it'll go away soon. - - * symbol.h: No need to #include "bad.h". - - Reorganize features from -fvxt-not-f90 to -fvxt: - * lang-options.h, top.h, top.c: - Accept -fvxt and -fno-vxt, but not -fvxt-not-f90 or -ff90-not-vxt. - Warn if the latter two are used. - * expr.c (ffeexpr_nil_rhs_): Double-quote means octal constant. - (ffeexpr_token_rhs_): Double-quote means octal constant. - * target.h (FFETARGET_defaultIS_VXT_NOT_90): Delete macro - definition, no longer needed. - - Make some -ff90 features the default: - * data.c (ffedata_value): DATA implies SAVE. - * src.h (ffesrc_is_name_noninit): Underscores always okay. - - Fix up some more #error directives by quoting their text: - * bld.c (ffebld_constant_is_zero): - * target.h: - -Sat Jan 18 18:22:09 1997 Craig Burley - - * g77.c (lookup_option, main): Recognize `-Xlinker', - `-Wl,', `-l', `-L', `--library-directory', `-o', - `--output'. - (lookup_option): Don't depend on SWITCH_TAKES_ARG - being correct, it might or might not have `-x' in - it depending on host. - Return NULL argument if it would be an empty string. - (main): If no input files (by gcc.c's definition) - but `-o' or `--output' specified, produce diagnostic - to avoid overwriting output via gcc. - Recognize C++ `+e' options. - Treat -L as another non-magical option (like -B). - Don't append_arg `-x' twice. - -Fri Jan 10 23:36:00 1997 Craig Burley - - * top.c [BUILT_FOR_270] (ffe_decode_option): Make - -fargument-noalias-global the default. - -Fri Jan 10 07:42:27 1997 Craig Burley - - Enable inlining of previously-compiled program units: - * com.c (ffecom_do_entry_, ffecom_start_progunit_): - Register new public function in ffeglobal database. - (ffecom_sym_transform_): Any GLOBAL or potentially GLOBAL - symbol should be looked up in ffeglobal database and - that tree node used, if found. That way, gcc knows - the references are to those earlier definitions, so it - can emit shorter branches/calls, inline, etc. - (ffecom_transform_common_): Minor change for clarity. - * expr.c (ffeexpr_sym-lhs_call_, ffeexpr_sym_lhs_extfunc_, - ffeexpr_sym_rhs_actualarg_, ffeexpr_paren_rhs_let_, - ffeexpr_token_funsubstr_): Globalize symbol as needed. - * global.c (ffeglobal_promoted): New function to look up - existing local symbol in ffeglobal database. - * global.h: Declare new function. - * name.h (ffename_token): New macro, plus alphabetize. - * stc.c (ffestc_R1207_item): Globalize EXTERNAL symbol. - * stu.c (ffestu_sym_end_transition, ffestu_sym_exec_transition): - Globalize symbol as needed. - * symbol.h, symbol.c (ffesymbol_globalize): New function. - -Thu Jan 9 14:20:00 1997 Craig Burley - - * ste.c (ffeste_R809): Produce a diagnostic for SELECT CASE - on CHARACTER type, instead of crashing. - -Thu Jan 9 00:52:45 1997 Craig Burley - - * stc.c (ffestc_order_entry_, ffestc_order_format_, - ffestc_R1226): Allow ENTRY and FORMAT before IMPLICIT - NONE, by having them transition only to state 1 instead - of state 2 (which is disallowed by IMPLICIT NONE). - -Mon Jan 6 22:44:53 1997 Craig Burley - - Fix AXP bug found by Rick Niles (961201-1.f): - * com.c (ffecom_init_0): Undo my 1996-05-14 change, as - it is incorrect and prevented easily finding this bug. - * target.h [__alpha__] (ffetargetReal1, ffetargetReal2): - Use int instead of long. - (ffetarget_cvt_r1_to_rv_, ffetarget_cvt_rv_to_r1_, - ffetarget_cvt_r2_to_rv_, ffetarget_cvt_rv_to_r2_): - New functions that intercede for callers of - REAL_VALUE_(TO|UNTO)_TARGET_(SINGLE|DOUBLE). - All callers changed, and damaging casts to (long *) removed. - -Sun Jan 5 03:26:11 1997 Craig Burley - - * Make-lang.in (g77, g77-cross): Depend on both g77.c and - zzz.c, in $(srcdir)/f/. - - Better design for -fugly-assumed: - * stc.c (ffestc_R501_item, ffestc_R524_item, - ffestc_R547_item_object): Pass new is_ugly_assumed flag. - * stt.c, stt.h (ffestt_dimlist_as_expr, - ffestt_dimlist_type): New is_ugly_assumed flag now - controls whether "1" is treated as "*". - Don't treat "2-1" or other collapsed constants as "*". - -Sat Jan 4 15:26:22 1997 Craig Burley - - * stb.c (ffestb_R10012_): Don't confirm on FORMAT(A,) - or even FORMAT(A,,B), as R1229 only warns about the - former currently, and this seems reasonable. - - Improvements to diagnostics: - * sta.c (ffesta_second_): Don't add any ffestb parsers - unless they're specifically called for. - Set up ffesta_tokens[0] before calling ffestc_exec_transition, - else stale info might get used. - (ffesta_save_): Do a better job picking which parser to run - after running all parsers with no confirmed possibles. - (FFESTA_maxPOSSIBLES_): Decrease from 100 now that so few - possibles are ever on the list at a given time. - (struct _ffesta_possible): Add named attribute. - (ffesta_add_possible_exec_, ffesta_add_possible_nonexec_): - Make these into macros that call a single function that now - sets the named attribute. - (ffesta_add_possible_unnamed_exec_, - ffeseta_add_possible_unnamed_nonexec_): New macros. - (ffesta_second_): Designate unnamed possibles as - appropriate. - * stb.c (ffestb_R1229, ffestb_R12291_): Use more general - diagnostic, so things like "POINTER (FOO, BAR)" are - diagnosed as unrecognized statements, not invalid statement - functions. - * stb.h, stb.c (ffestb_unimplemented): Remove function. - -1996-12-30 Dave Love - - * com.c: #include libU77/config.h - (ffecom_f2c_ptr_to_integer_type_node, - ffecom_f2c_ptr_to_integer_type_node): New variables. - (ffecom_init_0): Use them. - (ffecom_expr_intrinsic_): Many news cases for libU77 intrinsics. - - * com-rt.def: New definitions for libU77. - * intrin.def: Likewise. Also correct ftell arg spec. - - * Makefile.in (f/runtime/libU77/config.h): New target for com.c - dependency. - * Make-lang.in (f771): Depend on f/runtime/Makefile for the above. - -Sat Dec 28 12:28:29 1996 Craig Burley - - * stt.c (ffestt_dimlist_type): Treat ([...,]1) in dimlist - as ([...,]*) if -fugly-assumed, so assumed-size array - detected early enough. - -Thu Dec 19 14:01:57 1996 Craig Burley - - * target.h (FFETARGET_REAL_VALUE_FROM_INT_): Conditionalize - definition on BUILT_FOR_280, not BUILT_WITH_280, since - the name of the macro was (properly) changed since 0.5.19. - - Fix warnings/errors resulting from ffetargetOffset becoming - `long long int' instead of `unsigned long' as of 0.5.19, - while ffebitCount remains `unsigned long': - * bld.c (ffebld_constantarray_dump): Avoid warnings by - using loop var of appropriate type, and using casts. - * com.c (ffecom_expr_): Use right type for loop var. - (ffecom_sym_transform_, ffecom_transform_equiv_): - Cast to right type in assertions. - * data.c (ffedata_gather_, ffedata_value_): Cast to right - type in assertions and comparisons. - -Wed Dec 18 12:07:11 1996 Craig Burley - - Patch from Alexandre Oliva : - * Makefile.in (all.indirect): Don't pass -bbigtoc option - to GNU ld. - - Cope with new versions of gcc: - * com.h (BUILT_FOR_280): New macro. - * com.c (ffecom_ptr_to_expr): Conditionalize test of - OFFSET_REF. - (ffecom_build_complex_constant_): Conditionalize calling - sequence for build_complex. - Sat Dec 7 07:15:17 1996 Craig Burley * Version 0.5.19 released. @@ -789,11 +200,6 @@ Thu Oct 31 20:56:28 1996 Craig Burley if pre-2.7.0 gcc is involved (since our patch for that doesn't add support for tooning). -Sat Oct 26 05:56:51 1996 Craig Burley - - * bad.def (FFEBAD_TYPELESS_TOO_LARGE): Remove this - unused and redundant diagnostic. - Sat Oct 26 00:45:42 1996 Craig Burley * target.c (ffetarget_integerhex): Fix dumb bug. @@ -840,12 +246,6 @@ Sun Oct 13 22:15:23 1996 Craig Burley * top.c (ffe_decode_option): Don't set back-end flags that are nonexistent prior to gcc 2.7.0. -Sun Oct 13 12:48:45 1996 Craig Burley - - * com.c (convert): Don't convert emulated complex expr to - real (via REALPART_EXPR) if the target type is (emulated) - complex. - Wed Oct 2 21:57:12 1996 Craig Burley * com.c (ffecom_debug_kludge_): Set DECL_IN_SYSTEM_HEADER so @@ -899,62 +299,6 @@ Thu Sep 26 00:18:40 1996 Craig Burley Depend on stmp-hdrs, not stmp-int-hdrs, since libF77 needs float.h. -Sat Jun 22 18:17:11 1996 Craig Burley - - * com.c (ffecom_tree_divide_): Fix RECORD_TYPE case to - look at type of first field, properly, to determine - whether to call c_div or z_div. - -Tue Jun 4 04:27:18 1996 Craig Burley - - * com.c (ffecom_build_complex_constant_): Explicitly specify - TREE_PURPOSE. - (ffecom_expr_): Fix thinko. - (ffecom_2): For COMPLEX_EXPR, explicitly specify TREE_PURPOSE. - -Mon May 27 16:23:43 1996 Craig Burley - - Changes to optionally avoid gcc's back-end complex support: - * com.c (ffecom_stabilize_aggregate_): New function. - (ffecom_convert_to_complex_): New function. - (ffecom_make_complex_type_): New function. - (ffecom_build_complex_constant_): New function. - (ffecom_expr_): For opCONVERT of non-COMPLEX to COMPLEX, - don't bother explicitly converting to the subtype first, - because gcc does that anyway, and more code would have - to be added to find the subtype for the emulated-complex - case. - (ffecom_f2c_make_type_): Use ffecom_make_complex_type_ - instead of make_node etc. to make a complex type. - (ffecom_1, ffecom_2): Translate operations on COMPLEX operands - to appropriate operations when emulating complex. - (ffecom_constantunion): Use ffecom_build_complex_constant_ - instead of build_complex to build a complex constant. - (ffecom_init_0): Change point at which types are laid out - for improved consistency. - Use ffecom_make_complex_type_ instead of make_node etc. - to make a complex type. - Always calculate storage sizes from TYPE_SIZE, never TYPE_PRECISION. - (convert): Use e, not expr, since we've copied into that anyway. - For RECORD_TYPE cases, do emulated-complex conversions. - (ffecom_f2c_set_lio_code_): Always calculate storage sizes - from TYPE_SIZE, never TYPE_PRECISION. - (ffecom_tree_divide_): Allow RECORD_TYPE to also be handled - by run-time library. - (ffecom_expr_intrinsic_): Handle possible RECORD_TYPE as argument - to AIMAG intrinsic. - - * top.h, top.c, lang-options.h: Support new -f(no-)emulate-complex option. - - * com.c (ffecom_sym_transform_): Clarify and fix typos in comments. - -Mon May 20 02:06:27 1996 Craig Burley - - * target.h: Use new REAL_VALUE_UNTO_TARGET_* macros instead - of REAL_VALUE_FROM_TARGET_DOUBLE and _SINGLE. - Explicitly use long instead of HOST_WIDE_INT for emulation - of ffetargetReal1 and ffetargetReal2. - 1996-05-20 Dave Love * config-lang.in: @@ -973,17 +317,6 @@ Mon May 20 02:06:27 1996 Craig Burley * g77.c (DEFAULT_SWITCH_TAKES_ARG): Define a la gcc.c in the current GCC snapshot. -Tue May 14 00:24:07 1996 Craig Burley - - Changes for DEC Alpha AXP support: - * com.c (ffecom_init_0): REAL_ARITHMETIC means internal - REAL/DOUBLE PRECISION might well have a different size - than the compiled type, so don't crash if this is the - case. - * target.h: Use `int' for ffetargetInteger1, - ffetargetLogical1, and magical tests. Set _f format - strings accordingly. - Tue Apr 16 14:08:28 1996 Craig Burley * top.c (ffe_decode_option): -Wall no longer implies diff --git a/gnu/usr.bin/gcc/f/DOC b/gnu/usr.bin/gcc/f/DOC new file mode 100644 index 00000000000..a050e2550a4 --- /dev/null +++ b/gnu/usr.bin/gcc/f/DOC @@ -0,0 +1,2582 @@ +This file explains how to use the GNU Fortran system. +Copyright (C) 1995 Free Software Foundation, Inc. You may copy, +distribute, and modify it freely as long as you preserve this copyright +notice and permission notice. Contributed by James Craig Burley +(burley@gnu.ai.mit.edu). + +1996-03-23 + +[WARNING: THIS FILE IS BEING DEPRECATED as of version 0.5.18 of +GNU Fortran. + +This is the last version of this file that is up-to-date with +respect to changes to GNU Fortran itself. + +In future versions of GNU Fortran, this file will become obsolete +and, at some point, will be removed from the distribution +entirely. + +The contents of this file have been assimilated into the Info +documentation for GNU Fortran, newly available as of version 0.5.18. + +The one-version overlap, or coexistence, of both the Info +documentation and the contents of this file, is being provided +for your convenience in discovering information on what's new +for g77-0.5.18 without having to immediately plunge into the new +Info documentation.] + +Please read all of this information before using (especially before +complaining about) g77. + +Contents: + *WHAT IS GNU FORTRAN?* + *IMPORTANT GENERAL INFORMATION* + *PORTING INFORMATION* + *USING THE g77 COMMAND* + *SUMMARY OF FORTRAN-SPECIFIC COMMAND-LINE OPTIONS* + *SUMMARY OF COMPILATION OPTIONS USEFUL TO FORTRAN USERS* + *SUMMARY OF OVERLY CONVENIENT COMMAND-LINE OPTIONS* + *USER-VISIBLE CHANGES DURING 0.5.x* + *WHAT IS AND ISN'T SUPPORTED* + *BLOCK DATA AND LIBRARIES* + *FORTRAN 90* + *SOURCE CODE FORM* + *TYPES, SIZES, PRECISIONS, AND CONSTANTS* + *VAX FORTRAN VERSUS FORTRAN 90* + *LIBRARY AND PROCEDURE-CALLING INTERFACE* + *OPTIONS FOR POTENTIALLY BUGGY PROGRAMS* + *OPTIONS FOR SPEEDING UP PROGRAMS* + *PEDANTIC COMPILATION* + *UGLY FEATURES* + *CASE SENSITIVITY IN SOURCE CODE* + *INTRINSIC GROUPS* + *TROUBLE (BUGS, ETC.)* + *ADVANTAGES OVER f2c* + *DISAPPOINTMENTS AND MISUNDERSTANDINGS* + *OPEN QUESTIONS* + *INTERFACING, DEBUGGING, ETC.* + +*WHAT IS GNU FORTRAN?* + +GNU Fortran is designed initially as a free replacement for, or alternative +to, the Unix `f77' command. It consists of several components: + +- A modified version of the `gcc' command, which also might be installed as + the system's `cc' + +- The `g77' command, which also might be installed as the system's `f77' + +- The `libf2c' library + +- The compiler itself, internally named `f771' + +The `gcc' command is provided as part of the GNU CC compiler, designed +initially as a free replacement for, or alternative to, the Unix `cc' +command. + +`gcc' is often thought of as "the C Compiler" only, but it does more +than that. Based on command-line options and the names given for files +on the command line, `gcc' determines which actions to perform, including +preprocessing, compiling (in a variety of possible languages), assembling, +and linking. For example, the command `gcc foo.c' "drives" the file +`foo.c' through the preprocessor, then the C compiler (internally named +`cc1'), then the assembler (usually `as'), then the linker (usually named +`ld'), producing an executable program named `a.out' (on UNIX systems). +As another example, the command `gcc foo.cc' would do much the same as +`gcc foo.c', but instead of using the C compiler named `cc1', `gcc' would +use the C++ compiler (named `cc1plus'). + +When GNU Fortran is included and built with the GNU CC source tree, the +resulting version of `gcc' recognizes Fortran source files by name just +like it does C and C++ source files. It knows to use the Fortran compiler +named `f771' instead of `cc1' or `cc1plus' to compile Fortran files. + +Fortran source files are recognized by their file name suffixes: + + *.f, *.for: Fortran source files (no preprocessing) + *.F, *.fpp: Fortran source files (preprocessed via `cpp') + +UNIX users typically use the *.f and *.F nomenclature. Users of other +operating systems, especially those that cannot distinguish upper-case +letters from lower-case letters in their file names, typically use +the *.for and *.fpp nomenclature. Use of the preprocessor `cpp' allows +use of C-like constructs such as "#define" and "#include", but can +lead to unexpected, even mistaken, results due to Fortran's source file +format. Limiting use of the preprocessor to "#include" and, in +conjunction with "#define" only "#if" and related directives, thus +avoiding in-line macro expansion entirely, is recommended, especially +when using the traditional fixed source form. (With free source form, +fewer unexpected transformations are likely to happen, but use of +Hollerith and things like continued character constants can nevertheless +present problems.) + +The `g77' command is essentially just a front-end for the `gcc' command. +Fortran users will normally use `g77' instead of `gcc', because `g77' +knows how to specify the libraries needed to link with Fortran programs +(`libf2c' and `lm'). `g77' can still compile and link programs and +source files written in other languages. The command `g77 -v' is a quick +way to display lots of version information for the various programs +used to compile a typical preprocessed Fortran source file -- this +produces much more output than `gcc -v'. + +The `libf2c' library is distributed with GNU Fortran for the convenience +of its users, but is not part of GNU Fortran. It contains the procedures +needed by Fortran programs while they are running. Things like trigonometric +functions and doing I/O are compiled by the `f771' compiler (invoked by +`g77' when compiling Fortran code) into calls to procedures in `libf2c', +so `libf2c' must be linked with almost every program with any component +compiled by GNU Fortran. (As mentioned above, the `g77' command takes +care of all this for you.) + +The `f771' compiler represents most of what is unique to GNU Fortran. +While the `libf2c' component is really part of f2c, a free Fortran-to- +C converter distributed by Bellcore (AT&T), and the `g77' command is +just a small front-end to `gcc', `f771' is a combination of two rather +large chunks of code. One chunk is the so-called "GNU Back End", or GBE, +which knows how to generate fast code for a wide variety of processors. +The same GBE is used by the C, C++, and Fortran compiler programs `cc1', +`cc1plus', and `f771', plus others. The other chunk of `f771' is the +majority of what is unique about GNU Fortran -- the code that knows how +to interpret Fortran programs to determine what they are intending to +do, and then communicate that knowledge to the GBE for actual compilation +of those programs. This chunk is called the Fortran Front End (FFE). +The `cc1' and `cc1plus' programs have their own Front Ends, for the +C and C++ languages, respectively. + +Because so much is shared among the compilers for various languages, +much of the behavior and many of the user-selectable options for these +compilers are similar. For example, diagnostics (error messages and +warnings) have a general similarity in appearance; command-line +options like `-Wall' have generally similar effects; and the quality +of generated code (in terms of speed and size) is roughly similar +(since that work is done by the shared GBE). + +*IMPORTANT GENERAL INFORMATION* + +1. g77 currently is implemented as a replacement for the f2c+gcc + combination, and its implementation is designed so it can, in + most cases, generate object files that are link-compatible with + those generated by f2c+gcc using the identical combination (which + includes a similar/identical copy of f2c.h). Therefore, the + g77-gcc C-Fortran interface ought to work in a way that is + consistent with f2c. For instance, a Fortran string subroutine + argument will become two arguments on the C side: a char * and an int + length. Much of this compatibility results from the fact that + g77 uses the same run-time library, libf2c, used by f2c+gcc. + + However, it is expected that a future version of g77 will not + by default generate object files compatible with f2c+gcc and not + use libf2c. If you expect to depend on this compatibility in the + long term, use the options "-ff2c -ff2c-library" when compiling + all of the applicable code (which should at the very least trigger + compiler warning messages, if not enable f2c compatibility compilation, + in future versions of g77). + +2. Due to #1 above, object files compiled by g77 are not expected to work + well with objects compiled by the native compiler. Libraries compiled + with the native compiler will probably have to be recompiled with + g77 to be used with g77. There are two reasons for this: (1) there + may be subtle type mismatches which cause subroutine arguments + and function return values to get corrupted; (2) native compilers + use libraries of private I/O routines which will not be available + at link time unless you have the native compiler -- and you would + have to explicitly ask for them. For instance, on the Sun you + would have to add "-L/usr/lang/SCx.x -lF77 -lV77" to the link + command. + +3. On some systems, perhaps just those with out-of-date (shared?) libraries, + unresolved-reference errors happen when linking g77-compiled programs + (which should be done using g77). If this happens to you, try appending + `-lc' to the command you use to link the program, i.e. `g77 foo.f -lc'. + g77 already specifies `-lf2c -lm' when it calls the linker, but it + cannot also specify `-lc' because not all systems have a libc.a. + +*PORTING INFORMATION* + +During the private alpha test phase, which lasted about 2.5 years, +g77 was tested by a small number of people worldwide on a fairly +wide variety of machines. + +Some improvements have been made in g77 in version 0.5.17 that +make it easier for g77 to be configured as a cross-compiler. +There is still one known bug (a design bug to be fixed in 0.6) +that prevents configuration of g77 as a cross-compiler under some +circumstances, though there are assumptions made during configuration +that probably make doing non-self-hosting builds a hassle, requiring +manual intervention. + +Generally, g77 can be ported to any configuration to which gcc and +f2c+libf2c can be ported, aside from some of the known problems +in g77 that are scheduled to be fixed for version 0.6. + +But, if you are unable to port gcc and f2c (or at least the libF77 +and liI77 libraries) to a particular configuration, don't bother +asking the g77 maintainer about a g77 port -- the feasability of +that project depends largely on a gcc port first being done, so +talk to the gcc maintainers about that (e.g. look in the gcc/SERVICE +file for information on people who might be willing to do such a port). + +*USING THE g77 COMMAND* + +The `g77' command is designed to make compiling and linking Fortran +programs somewhat easier than using the `gcc' command. It does this +by analyzing the command line somewhat and changing it appropriately +before submitting it to the `gcc' command. Use the `-v' option with `g77' +to see what is going on -- the first line of output is the invocation +of the `gcc' command. Use `--driver=true' to disable actual invocation +of `gcc' (since `true' is the name of a UNIX command that simply returns +success status). + +In addition to supporting all the options supported by the `gcc' command, +the `g77' command also supports this option: + +--driver=COMMAND + Specifies that COMMAND, rather than `gcc', is to be invoked by `g77' + to do its job. Example: Within the gcc build directory after + building GNU Fortran (but without having to install it), + `g77 --driver=./xgcc foo.f'. + +*SUMMARY OF FORTRAN-SPECIFIC COMMAND-LINE OPTIONS* + +These options are supported both by `g77' and by `gcc' as +modified (and reinstalled) by the `g77' distribution. `*' +indicates defaults, where appropriate. + +-fversion + Ensure that the g77-specific version of the compiler phase is reported, + if run. (This is supplied by default when `-v' or `--version' is specified + when invoking `g77' or `gcc' to compile one or more Fortran source files.) + +-fident * +-fno-ident + Specify whether to process #ident directives. + +-ff90 +-fno-f90 * + Specify whether to allow certain F90 constructs. + + NOTE: This also changes the interpretation of `REAL(Z)', where Z + is type DOUBLE COMPLEX. With -fno-f90 in force, that expression + is defined to return type REAL, to conform to apparent industry + convention for the DOUBLE COMPLEX extension to FORTRAN 77. With + -ff90 in force, that expression is defined to return type DOUBLE + PRECISION. + + In other words, with -fno-f90, REAL(Z) is the same as REAL(REAL(Z)). + With -ff90, it is the same as DBLE(Z). + +-fautomatic * +-fno-automatic + Specify whether to assume that unSAVEd variables and arrays are intentionally + left unSAVEd. + +-fdollar-ok +-fno-dollar-ok * + Specify whether `$' is a valid character in a symbol name. + +-ff2c * +-fno-f2c + Specify whether compatibility with f2c-compiled code (other than that + in libf2c) is desired. -fno-f2c can generate faster code for things like + COMPLEX functions. THE SAME OPTION MUST BE USED FOR COMPILING ALL + FORTRAN CODE IN A PARTICULAR PROGRAM!! + + Note that f2c compatibility is a fairly static target to achieve, + though not necessarily perfectly so. However, disabling f2c + compatibility definitely causes g77 to generate code that might + well be incompatible with future versions of g77 when the same + option is in force. + + Therefore, if you are using g77 to compile libraries and other + object files for possible future use and you don't want to require + recompilation for future use with subsequent versions of g77, you + might want to stick with f2c compatibility for now, and carefully + watch for any announcements about changes to the f2c/libf2c interface + that might affect existing programs. + +-ff2c-library * +-fno-f2c-library + Specify whether use of `libf2c' is desired (it is currently not + valid to specify -fno-f2c-library). + +-ffree-form +-fno-free-form * +-ffixed-form * +-fno-fixed-form + Specify whether fixed (traditional) or free (new with Fortran 90) form + is used in the source file. + +-fpedantic +-fno-pedantic * + Like -pedantic, but applies only to Fortran constructs (while + -pedantic applies to C constructs, such as use of `\e' in a + character constant within a directive like `#include', and + Fortran constructs as well). + +-fvxt-not-f90 +-ff90-not-vxt * + Specify whether Fortran 90 or popular `VXT' extensions such as the + TYPE statement are to be assumed for ambiguous constructs -- e.g. with + -ff90-not-vxt, `PRINT *,"double-quoted string"' is valid, while with + -fvxt-not-f90, `PRINT *,"2000' is valid. There is no way to allow + both constructs in the general case, since statements like + `PRINT *,"2000 !comment?"' would be ambiguous. + +-fugly +-fno-ugly * + Specify whether certain `ugly' constructs are to be quietly accepted + by the compiler. Implies the appropriate `ugly-args' and `ugly-init' + options. For example, with -fno-ugly, CALL FOO(,) means to pass one + null argument, whereas with -fugly, it means to pass two null + arguments. + +-fugly-args * +-fno-ugly-args + Specify whether passing hollerith and typeless constants as actual + arguments is supported (e.g. CALL FOO(4HABCD)). + +-fugly-init * +-fno-ugly-init + Specify whether using hollerith and typeless constants as initial + values (PARAMETER and DATA), and using character constants to + initialize numeric types and vice versa, are supported. (For example, + "DATA I/'F'/, CHRVAR/65/, J/4HABCD/" is allowed by -fugly-init.) + +-finit-local-zero +-fno-init-local-zero * + Specify whether variables and arrays that are local to a program unit + (not in COMMON and not passed as an argument) are to be initialized + to binary zeros. Since there is a run-time penalty for such + initialization of stack-based (non-SAVEd) variables, it might be a + good idea to also use -fno-automatic with -finit-local-zero. + +-fbackslash * +-fno-backslash + Specify whether `\' is specially interpreted in character and hollerith + constants a la C and some Fortran compilers. For example, with + -fbackslash in effect, 'A\nB' specifies three characters, with + the second one being newline; with -fno-backslash, it specifies + four characters, the second and third being backslash and the letter + `n', respectively. + + Note that making -fbackslash the default is a concession to the community + of UNIX `f77' users. This feature is an unfortunate carry-over from + the C language, as it contradicts the spirit (though not the letter) + of the ANSI FORTRAN 77 standard. At the time the feature was added to + f77, it was probably difficult to come up with a better way to provide + the ability to specify arbitrary characters wherever they might be + needed without doing a lot more work on the compiler, however. + + Also note that g77's implementation of the feature seems to be more + general than that offered by some Fortran compilers such as f2c. + g77's implementation basically parallels gcc's, while other compilers + might not support '\003' as a single character, for example, resulting + in differing interpretations of constants such as 'A\003B'. + +-funderscoring * +-fno-underscoring + With -funderscoring in effect, g77 appends two underscores to names with + underscores and one underscore to external names with no underscores. + Use of -fno-underscoring is not recommended unless you are experimenting + with issues such as integration of (GNU) Fortran into existing + system environments (vis-a-vis existing libraries, tools, etc.). + + For example, with -funderscoring, and assuming other defaults like + -fcase-lower and that j() and max_count() are external functions + while my_var is a local variable, a statement like + + I = J() + MAX_COUNT (MY_VAR) + + is implemented as something akin to: + + i = j_() + max_count__(my_var__); + + With -fno-underscoring, the same statement is implemented as: + + i = j() + max_count(my_var); + + Use of -fno-underscoring allows direct specification of user-defined names + while debugging and when interfacing g77-compiled code with other languages. + (Note that just because the names match does not mean that the interface + implemented by g77 for an external name matches the interface implemented + by some other language for that same name! Also note that, with + -fno-underscoring, the lack of appended underscores introduces the very + real possibility that a user-defined external name will conflict with a + name in a system library, which could make finding unresolved-reference bugs + quite difficult in some cases -- they might occur at program run time, + and show up only as buggy behavior.) + + In future versions of g77, we hope to improve naming and linking + issues so that debugging always involves using the names as they appear + in the source, even if the names as seen by the linker are mangled to + prevent accidental linking between procedures with incompatible + interfaces. + +-fsecond-underscore * +-fno-second-underscore + Controls whether to append a second underscore to names of + entities specified in the Fortran source file. + + This option has no effect if -funderscoring is in effect. + + Otherwise, with -fno-second-underscore, an external name such as + `MAX_COUNT' is implemented as a reference to the link-time external + symbol `max_count_', isntead of `max_count__'. + +-fintrin-case-initcap +-fintrin-case-upper +-fintrin-case-lower * +-fintrin-case-any + Specify expected case for intrinsic names. + +-fmatch-case-initcap +-fmatch-case-upper +-fmatch-case-lower * +-fmatch-case-any + Specify expected case for keywords. + +-fsource-case-upper +-fsource-case-lower * +-fsource-case-preserve + Specify whether source text other than character and hollerith constants + is to be translated to uppercase, to lowercase, or preserved as is. + +-fsymbol-case-initcap +-fsymbol-case-upper +-fsymbol-case-lower +-fsymbol-case-any * + Specify valid cases for user-defined symbol names. + +-fcase-strict-upper + Same as `-fintrin-case-upper -fmatch-case-upper -fsource-case-preserve + -fsymbol-case-upper'. (Requires all pertinent source to be in + uppercase.) + +-fcase-strict-lower + Same as `-fintrin-case-lower -fmatch-case-lower -fsource-case-preserve + -fsymbol-case-lower'. (Requires all pertinent source to be in + lowercase.) + +-fcase-initcap + Same as `-fintrin-case-initcap -fmatch-case-initcap -fsource-case-preserve + -fsymbol-case-initcap'. (Requires all pertinent source to be in + initial capitals, as in `Print *,SqRt(Value)'.) + +-fcase-upper + Same as `-fintrin-case-any -fmatch-case-any -fsource-case-upper + -fsymbol-case-any'. (Maps all pertinent source to uppercase.) + +-fcase-lower + Same as `-fintrin-case-any -fmatch-case-any -fsource-case-lower + -fsymbol-case-any'. (Maps all pertinent source to lowercase.) + +-fcase-preserve + Same as `-fintrin-case-any -fmatch-case-any -fsource-case-preserve + -fsymbol-case-any'. (Preserves all case in user-defined symbols, + while allowing any-case matching of intrinsics and keywords. For + example, `call Foo(i,I)' would pass two different variables named + `i' and `I' to a procedure named `Foo'.) + +-fdcp-intrinsics-delete +-fdcp-intrinsics-hide +-fdcp-intrinsics-disable +-fdcp-intrinsics-enable * + Specify status of DEC's COMPLEX-related intrinsics. + +-ff2c-intrinsics-delete +-ff2c-intrinsics-hide +-ff2c-intrinsics-disable +-ff2c-intrinsics-enable * + Specify status of f2c-specific intrinsics. + +-ff90-intrinsics-delete * +-ff90-intrinsics-hide +-ff90-intrinsics-disable +-ff90-intrinsics-enable + Specify status of F90-specific intrinsics. + +-fmil-intrinsics-delete +-fmil-intrinsics-hide +-fmil-intrinsics-disable +-fmil-intrinsics-enable * + Specify status of MIL-STD-1753-specific intrinsics. + +-funix-intrinsics-delete +-funix-intrinsics-hide +-funix-intrinsics-disable +-funix-intrinsics-enable * + Specify status of UNIX intrinsics. E.g. if your code invokes FLUSH() as + a library function and thus worked at 0.5.15 or earlier, or with f2c or + other f77 compilers, either add the EXTERNAL FLUSH statement or, perhaps + more convenient for you, compile with the -funix-intrinsics-hide or + -funix-intrinsics-delete option. + + Note that ABORT, EXIT, FLUSH, SIGNAL, and SYSTEM are intrinsic subroutines, + not functions (since they have side effects), so to get the return values + from SIGNAL and SYSTEM, append a final argument specifying an INTEGER + variable or array element to receive the returned status. (For example, + "CALL SYSTEM('rm foo',ISTAT)".) + + FLUSH() accepts an optional single INTEGER argument, since many Fortran + implementations allow or require a unit number. Currently, since libf2c + does not flush a given unit number, this argument is not used -- all + units are flushed by libf2c's implementation of FLUSH(). Do not + depend on this behavior -- if you want to flush all units, CALL FLUSH + with no arguments. + + EXIT() accepts an optional single INTEGER argument. If omitted, zero + is the default (as in CALL EXIT(0)). The default might change on + configurations where the "normal return status" is not zero, however. + If you want to return a "success" status, it is best to CALL EXIT with + no arguments in your code, and let g77 choose the appropriate default. + +-fvxt-intrinsics-delete * +-fvxt-intrinsics-hide +-fvxt-intrinsics-disable +-fvxt-intrinsics-enable + Specify status of VXT intrinsics. + +-ffixed-line-length-N + Set column after which characters are ignored in typical fixed-form + lines in the source file. Popular values for N include 72 (the + standard and the default), 80 (card image), and 132 (corresponds + to `extended-source' options in some popular compilers). N may + be `none', meaning that the entire line is meaningful and that + continued character constants never have implicit spaces appended + to them to fill out the line. -ffixed-line-length-0 means the + same thing as -ffixed-line-length-none. + +-Wsurprising + Warn about "suspicious" constructs. These constructs typically mean + something different to a standard-conforming Fortran compiler, such + as g77, than the programmer who uses them expects, and these differences + can result in subtle, compiler-dependent (even machine-dependent) + behavioral differences. The constructs warned about include: + + - Expressions having two arithmetic operators in a row, such as + "X*-Y". Such a construct is nonstandard, and can produce + unexpected results in more complicated situations such as + "X**-Y*Z". g77, and many other compilers, interpret this + example differently than programmers, and a few other compilers, + in that they interpret it as "X**(-(Y*Z))" instead of "(X**(-Y))*Z". + The difference is notable in examples like "2**-2*1.", which g77 + and other compilers evaluate to ".25", but a programmer might + expect to evaluate to "0.", due to the way the precedence affects + the type promotion. (The -fpedantic option also warns about + expressions having two arithmetic operators in a row.) + + - Expressions with a unary minus followed by an operand and then + a binary operator other than plus or minus. For example, "-2**2" + produces a warning, because the precedence is "-(2**2)", yielding + "-4", not "(-2)**2" (yielding "4") as a programmer might expect. + + - DO loops with REAL or DOUBLE PRECISION DO variables (including + implied-DO loops in I/O and DATA statements), since the implementation + required by the standard, combined with the vagaries of floating-point + arithmetic on most machines, will likely result in terminating + conditions not meeting the programmer's expectations (with regard + to the terminal value for the loop). + +*SUMMARY OF COMPILATION OPTIONS USEFUL TO FORTRAN USERS* + +Using the gcc info documentation as a reference, here are categories +of options that g77 and gcc support when compiling and linking Fortran +programs: + + *Overall Options* + *Debugging Options* (though support for -g is incomplete) + *Optimization Options* + *Preprocessor Options* (some do not affect Fortran's INCLUDE statement) + *Assembler Option* + *Linker Options* + *Directory Options* + *Target Options* + *Machine Dependent Options* (some might not work for Fortran, however) + *Code Generation Options* (beware -fno-common, however) + +g77 supports many other options supported by gcc that apply to code +generation and preprocessing, but does not support options that apply +to interpreting C or C++ programs. g77 also does not yet support some +options such as `-Wid-clash-N', nor does it yet support `-g' fully +(as noted above). + +Here are some options that are more generally applicable to gcc than +just the g77 environment, but which might nevertheless be particularly +interesting to g77 users. See the explanations for these options in +the gcc documentation, in addition to whatever explanations have +been cobbled together below. + +-ffast-math +-ffloat-store +-fsyntax-only +-fmove-all-movables +-freduce-all-givs +-frerun-loop-opt + See the gcc documentation. + +-pedantic +-pedantic-errors + These options imply -fpedantic, described in this documentation. + See the gcc documentation for more information on their general meaning. + +-mieee-fp (i386 and similar configurations only) + See the gcc documentation. + +-w +-W +-Werror +-Wimplicit +-Wuninitialized +-Wunused + g77 has code to support these gcc options. See the gcc documentation. + Note that for -Wuninitialized to work, optimization must be specified + (via `-O', for example). `-Wimplicit' has the effect of using + the IMPLICIT NONE statement in every program unit, and as such is + g77's version of what f77 traditionally provides via the `-u' option. + +-Wall + Currently the same as `-Wunused' and, if optimization is enabled, + `-Wuninitialized' as well. Future versions of g77 might add more + warnings that are also enabled via `-Wall', using the same general + policy used to make these decisions for gcc. + +-I- +-Idir + See gcc documentation for information on the `-I' option. When compiling + Fortran source files, `-I' affects not only preprocessor interpretation + of #include, but compiler-phase interpretation of the INCLUDE statement + as well. Note that `-Idir' must be specified _without_ any spaces between + -I and the directory name -- that is, `-Idir' is valid, but `-I dir' + is rejected by the g77 compiler (though the preprocessor supports + the latter form). Also note that the general behavior of -I and + INCLUDE is pretty much the same as of -I with #include in gcc's C + preprocessor, with regard to looking for `header.gcc' files and other + such things + +*SUMMARY OF OVERLY CONVENIENT COMMAND-LINE OPTIONS* + +These options should be used only as a quick-and-dirty way to determine +how well your program will run under different compilation models +without having to change the source. Some are more problematic +than others, depending on how portable and maintainable you want the +program to be (and, of course, whether you are allowed to change it +at all is crucial). + +You should not continue to use these command-line options to compile +a given program, but rather should make changes to the source code: + +-finit-local-zero + Use explicit DATA (or other initial-value-setting) statements + to initialize local variables and arrays to zero. Consider using + -Wuninitialized (which requires -O) to find likely candidates, but + do not specify -finit-local-zero or -fno-automatic, or this technique + won't work. +-fno-automatic + Use SAVE statements in the appropriate places instead. Consider using + -Wuninitialized (which requires -O) to find likely candidates, but + do not specify -finit-local-zero or -fno-automatic, or this technique + won't work. +-fugly* + Fix the source code so that -fno-ugly (the default) will work. + Note that, for many programs, it is difficult to practically + avoid using the features enabled via -fugly-init, and these + features pose the lowest risk of writing nonportable code of the + various "ugly" features. +-fxxx-intrinsics-hide + Change the source code to use EXTERNAL for any external procedure + that might be the name of an intrinsic. It is easy to find these + using -fxxx-intrinsics-disable. + +*USER-VISIBLE CHANGES DURING 0.5.x* + +In 0.5.18: + +- The BYTE and WORD statements now are supported, to a limited + extent. + +- INTEGER*1, INTEGER*2, INTEGER*8, and their LOGICAL equivalents, + now are supported to a limited extent. Among the missing elements + are complete intrinsic and constant support. + +- Support automatic arrays in procedures. For example, + `REAL A(N)', where `A' is not a dummy argument, specifies that + `A' is an automatic array. The size of `A' is calculated from + the value of `N' each time the procedure is called, that amount + of space is allocated, and that space is freed when the procedure + returns to its caller. + +- Add `-fno-zeros' option, enabled by default, to reduce compile-time + CPU and memory usage for code that provides initial zero values + for variables and arrays. + +- Introduce three new options that apply to all compilations by + g77-aware GNU compilers -- -fmove-all-movables, -freduce-all-givs, + and -frerun-loop-opt -- which can improve the run-time performance + of some programs. + +- Replace much of the existing documentation (including the file you + are reading right now) with a single Info document. + +- New option -fno-second-underscore. + +In 0.5.17: + +- ERF() and ERFC() intrinsics are now generic intrinsics, mapping to + ERF/DERF and ERFC/DERFC, respectively -- NOTE: use INTRINSIC ERF,ERFC + in any code that might reference these as generic intrinsics, to + improve the likelihood of diagnostics (instead of subtle run-time + bugs) when using compilers that don't support these as intrinsics + +- New option -Wsurprising + +- DO loops with non-INTEGER variables now diagnosed only when -Wsurprising + specified (previously diagnosed unless -fpedantic or -fugly specified) + +In 0.5.16: + +- libf2c changed to output a leading zero (0) digit for floating-point + values output via list-directed and formatted output (to bring g77 + more in line with many existing Fortran implementations -- the + ANSI FORTRAN 77 standard leaves this choice to the implementation) + +- libf2c no longer built with debugging info intact, making it much + smaller + +- Automatic installation of `g77' command now works + +- Diagnostic messages from compiler now more informative, a la gcc, + including messages like "In function `foo':" and "In file included + from...:" + +- New group of intrinsics called `unix', including ABORT, DERF, DERFC, + ERF, ERFC, EXIT, FLUSH, GETARG, GETENV, SIGNAL, and SYSTEM + +- -funix-intrinsics-{delete,hide,disable,enable} options introduced + +- -fno-underscoring option introduced + +- --driver=COMMAND option introduced to the g77 command + +- Support for gcc's -fident and -fno-ident options extended to g77 + +- `g77 -v' returns much more version info, for submitting better bug + reports easily (for example -- assuming there are still any bugs left + in g77 ;-) + +- Many improvements to the g77 command to better fulfill its role as + a front-end to the gcc driver (e.g. recognition of both `-v' and + `--version' instead of just `-v') + +- Compiling preprocessed (*.F) files now results in better diagnostics + and debugging information, as the source-location info now is passed + all the way through the compilation process instead of being lost + +In 0.5.15: + +- -ffixed-line-length-N option introduced + +In 0.5.14: + +- Support for gcc's -I option extended to g77 + +- -fbackslash option introduced + +- -fugly-args option enabled by default (allows CALL FOO(4HABCD)) + +- -fugly-init option introduced + +- -finit-local-zero option introduced + +- Support for gcc's -Wimplicit option extended to g77 + +- -Wall now implies -Wunused and, when -O is specified, -Wuninitialized + +- Hollerith constants as actual arguments now are passed by reference + instead of by value -- so CALL FOO(4HABCD) is now compiled exactly + the same as CALL FOO(%REF('ABCD')), instead of as CALL FOO(%VAL('ABCD')) + +- Hollerith constants converted to larger types now are padded on the + right with spaces; converted to smaller types, warnings are issued + if non-spaces are truncated on the right + +- Format specifications of arrays of types other than CHARACTER are + allowed in I/O statements, such as when they contain Hollerith + data + +- Typeless constants as actual arguments now are passed by reference + to a INTEGER version of the constant instead of by value + +- Typeless constants converted to larger types are padded on the left + with zeros; converted to smaller types, warnings are issued if non-zero + bits are truncated on the left + +- %DESCR() of a non-CHARACTER expression treats the expression as if + it were CHARACTER, passing both a pointer to the expression and the + length of the type of the expression in bytes, by value, in the + "hidden" list of lengths used for CHARACTER arguments + +- The ICHAR(), IACHAR(), and LEN() intrinsics now accept character + expressions involving concatenation of assumed-length dummy arguments + +- BLOCK DATA program units now can contain NAMELIST, EXTERNAL, INTRINSIC, + and VOLATILE statements + +- Zero-length character expressions now supported + +- f2c's IMAG() intrinsic now supported + +- INCLUDE statement restrictions, such as no continuation lines allowed, + now lifted + +*WHAT IS AND ISN'T SUPPORTED* + +This release supports ANSI FORTRAN 77 with the following caveats: + +- No passing of an external procedure as an actual argument if the procedure's + type is declared CHARACTER*(*) (because it isn't clear the standard + really considers this standard-conforming, but it should be fairly easy + to support if someone gets an RFI showing it is standard-conforming). + +- No passing of a dummy procedure as an actual argument if the procedure's + type is declared CHARACTER*(*) (again, because it isn't clear the + standard considers this conformant). + +- The DO variable for an implied-DO construct in a DATA statement may + not be used as the DO variable for an outer implied-DO construct (this + is also disallowed by Fortran 90, as it offers no additional capabilities). + Note that it is very unlikely that any existing Fortran code + tries to use this unsupported construct. + +- An array element initializer in an implied-DO construct in a DATA + statement must contain at least one reference to the DO variables of + each outer implied-DO construct (this is also required by Fortran 90, + as FORTRAN 77's more permissive requirements offer no additional + capabilities). However, g77 doesn't necessarily diagnose all cases + where this requirement is not met. Note that in any case it is + very unlikely that any existing Fortran code tries to use this + unsupported construct. + +This release supports ANSI FORTRAN 77 plus: + +- -g for local variables and external names; COMMON variables, local + EQUIVALENCE variables, labels, and so on aren't supported yet. + +- LOC(), if -funix-intrinsics-enable is in force. + +- %LOC, %VAL, %REF, and %DESCR -- where %DESCR currently means the same thing + as passing the argument as if it was type CHARACTER. + +- MIL-STD 1753 features (IAND, IOR, MVBITS, DO WHILE, END DO, etc). + +- NAMELIST. + +- Most f2c/f77 intrinsics (AND, OR, LSHIFT, RSHIFT, and so on). + +- DOUBLE COMPLEX and related intrinsics (standard and f2c varieties). + +- Various Fortran 90 features. + +- Various DEC VAX/VMS FORTRAN v4.0 features. + +- Various f2c features. + +- Source files that are uppercase-only (enforced), lowercase-only + (enforced), caseless, and various other combinations as chosen via + command-line options. + +- Arbitrary (limited only by available memory) number of continuation + lines. + +- Use of '&' in column 1 to indicate a continuation line a la f2c. + +- Dollar signs ('$') in identifiers (other than as the first character) + when the command-line option -fdollar-ok is specified. + +*BLOCK DATA AND LIBRARIES* + +To ensure that BLOCK DATA program units are linked, especially a concern +when they are put into libraries, give each one a name (as in +BLOCK DATA FOO) and make sure there is an EXTERNAL FOO statement +in every program unit that uses any COMMON area initialized by the +corresponding BLOCK DATA. g77 currently compiles a BLOCK DATA as +if it were a SUBROUTINE, that is, it generates an actual procedure +having the appropriate name. The procedure does nothing but return +immediately if it happens to be called. For EXTERNAL FOO, where FOO +is not otherwise referenced in the same program unit, g77 assumes +it is a BLOCK DATA and generates a reference to it so the linker will +make sure it is present. (Specifically, g77 outputs in the data +section a static pointer to the external name FOO.) + +The implementation g77 currently uses to make this work is +one of the few things not compatible with f2c as currently +shipped. f2c currently does nothing with EXTERNAL FOO except +issue a warning that FOO is not otherwise referenced, and for +BLOCK DATA FOO, f2c doesn't generate a dummy procedure with the +name FOO. The upshot is that you shouldn't mix f2c and g77 in +this particular case. If you use f2c to compile BLOCK DATA FOO, +then any g77-compiled program unit that says EXTERNAL FOO will +result in an unresolved reference when linked. If you do the +opposite, then FOO might not be linked in under various +circumstances (such as when FOO is in a library, or you're +using a "clever" linker). + +The changes you make to your code to make g77 handle this +situation, however, appear to be a widely portable way to handle +it. That is, many systems permit it (as they should, since the +FORTRAN 77 standard permits EXTERNAL FOO when FOO is a BLOCK DATA +program unit), and of the ones that might not link BLOCK DATA FOO +under some circumstances, most of them appear to do so once +EXTERNAL FOO is present in the appropriate program units. + +*FORTRAN 90* + +The -ff90 and -fno-f90 command-line options control whether certain +Fortran 90 constructs are recognized. (Other Fortran 90 constructs +might or might not be recognized depending on other options such as +-fvxt-not-f90, -ff90-intrinsics-enable, and the current level of support +for Fortran 90.) + +When -ff90 is specified, the following constructs are accepted: + + - REAL(Z), where Z is DOUBLE COMPLEX, as meaning DBLE(Z) instead + of the canonical F77 meaning of REAL(REAL(Z)) + - Zero-length CHARACTER entities even when -fpedantic specified + - Zero-size array dimensions (as in INTEGER I(10,20,4:2)) (not supported + by run-time code, so diagnostics are produced for g77 nevertheless). + - DOUBLE COMPLEX (explicit or implicit) even when -fpedantic specified. + - Substrings of constants (as in "'hello'(3:5)") even when -fpedantic + specified. + - DATA statements allowed to precede executable statements even when + -fpedantic specified (note that this is not the same as whether + "DATA I/1/" is permitted before other specifications for I, such as + "INTEGER I" -- it does allow, however, "DATA I/1/" before "INTEGER J"). + - Semicolon as statement separator even when -fpedantic specified + (so "CALL FOO; CALL BAR" works). + - Underscores are not accepted as the first character of a + symbol name, since F90 provides a different interpretation + for certain cases where that would occur (though g77 does not + yet support that interpretation). + +If -fpedantic is specified, the following constructs result in diagnostics: + + - Use of semicolons on line with INCLUDE statement. + +*SOURCE CODE FORM* + +The -ffree-form (aka -fno-fixed-form) and -ffixed-form (aka -fno-free-form) +command-line options govern how the source file is interpreted. Fixed form +corresponds to classic ANSI FORTRAN 77 (plus popular extensions, such as +allowing tabs) and Fortran 90's fixed form. Free form corresponds to +Fortran 90's free form (though possibly not entirely up-to-date, and +without complaining about some things that for which Fortran 90 requires +diagnostics, such as "R = 3 . 1"). + +The way a Fortran compiler views source files depends entirely on the +implementation choices made for the compiler. GNU Fortran currently +tries to be somewhat like a few popular compilers (f2c, DEC Fortran, +and so on), though a cleaner default definition along with more +flexibility offered by command-line options is likely to be offered +with g77-0.6. + +Here are some facts regarding the way g77 interprets source lines: + +- Carriage returns ('\r') in source lines are ignored. This is somewhat + different from f2c, which seems to treat them as spaces outside + character/hollerith constants, and encodes them as '\r' inside such + constants. + +- A source line with a TAB character anywhere in it is treated as + entirely significant -- however long it is -- instead of ending + in column 72 (for fixed-form source) or 132 (for free-form source). + This also is different from f2c, which encodes tabs as '\t' inside + character and hollerith constants, but nevertheless seems to treat + the column position as if it had been affected by any tab. g77 + effectively translates tabs to the appropriate number of spaces + (a la the default for the UNIX `expand' command) before doing any + other processing, other than (currently) noting whether a tab + was found on a line and using this info to decide how to interpret + the length of the line and continued constants. + + NOTE: this default behavior probably will change for 0.6, when + it will presumably be available via a command-line option. The + default as of 0.6 is expected to be a "pure visual" model, where + tabs are immediately converted to spaces and otherwise have no + effect, so the way a typical user sees source lines produces a + consistent result no matter how the spacing in those source lines + is actually implemented via tabs, spaces, and trailing tabs/spaces + before newline. Command-line options are likely to be added to + specify whether all or just-tabbed lines are to be extended to + 132 or full input-line length, and perhaps even an option will be + added to specify the truncated-line behavior to which Digital compilers + default. + +- Source lines shorter than the applicable fixed length are treated + as if they were padded with spaces to that length. This affects + only continued character and hollerith constants, and is a different + interpretation than provided by some other popular compilers (although + a bit more consistent with the traditional punched-card basis of + Fortran and the way the Fortran standard expressed fixed source form). + g77 might someday offer an option to warn about cases where differences + might be seen as a result of this treatment, and perhaps an option to + specify the alternate behavior as well. + + Note that this padding does not apply to lines that are effectively + of infinite length -- such lines are specified using command-line + options like -ffixed-line-length-none, for example. + +*TYPES, SIZES, PRECISIONS, AND CONSTANTS* + +Fortran implementations have a fair amount of freedom given them by the +standard as far as how much storage space is used and how much precision +is offered by the various types such as LOGICAL, INTEGER, REAL, DOUBLE +PRECISION, COMPLEX, and CHARACTER. Further, many compilers offer so-called +"*N" notation, but the meaning of N varies across compilers and target +architectures. + +The standard requirements are that LOGICAL, INTEGER, and REAL occupy +the same amount of storage space, and that COMPLEX and DOUBLE PRECISION +take twice as much storage space as REAL. Further, it requires that +COMPLEX entities be ordered such that when a COMPLEX variable is +EQUIVALENCE'd with a two-element REAL array named R, R(1) corresponds +to the real element and R(2) to the imaginary element of the COMPLEX +variable. No particular requirements as to precision of any of these +are placed on the implementation, nor is the relationship of storage +sizes of these types to the CHARACTER type specified by the standard. + +g77 follows the above requirements to the letter, warning when compiling +a program requires placement of items in memory that contradict the +requirements of the target architecture. (For example, a program can +require placement of a DOUBLE PRECISION on a boundary that is not an +even multiple of its size, but still an even multiple of the size of +a REAL variable. On some target architectures, using the canonical +mapping of Fortran types to underlying architectural types, such +placement is prohibited by the machine definition. g77 warns about +such situations when it encounters them.) + +g77 follows consistent rules for configuring the mapping between +Fortran types, including the "*N" notation, and the underlying +architectural types as accessed by a similarly-configured applicable +version of the gcc compiler. These rules offer a widely portable, +consistent Fortran/C environment, although they might well conflict +with the expectations of users of Fortran compilers designed and +written for particular architectures. + +These rules are based on the configuration that is in force for the +version of gcc built in the same release as g77: + + REAL: same size as whatever gcc calls a "float" + DOUBLE PRECISION: same size as whatever floating-point type gcc provides + that is twice the size of a "float" (usually a "double") + INTEGER: a gcc integral type that is the same storage size as "float" + LOGICAL: same size as INTEGER + COMPLEX: two REALs + DOUBLE COMPLEX: two DOUBLE PRECISIONs + + numeric-type*N (any type other than CHARACTER, such as INTEGER*2): + is N times the size of whatever gcc calls a "char" + + numeric-type(KIND=N): N=1 for REAL, INTEGER, LOGICAL, COMPLEX; + N=2 for DOUBLE PRECISION, DOUBLE COMPLEX, char INTEGER/LOGICAL (*1); + N=3 for short INTEGER/LOGICAL (*2); + N=4 for long long INTEGER/LOGICAL (*8). + [These proposed values might change in the future.] + +Regarding constants, g77 strictly assigns types to all constants not +documented as "typeless" (the typeless constants include things like +"Z'1'"). Context is never a determining factor for the type, and hence +the interpretation, of a typed constant. Examples: "1" is always type +INTEGER, "3.141592653545256234" is always type REAL (even if the +additional precision specified is lost, and even when used in a +DOUBLE PRECISION context), "1E0" is always type REAL, and "1D0" is +always type DOUBLE PRECISION. + +Many other Fortran compilers attempt to assign types to typed constants +based on their context. This results in hard-to-find bugs, nonportable +code, and is not in the spirit (though it strictly follows the letter) +of the 77 and 90 standards. g77 will not support these dangerous +semantics, but might offer, in a future release, explicit constructs +by which a wider variety of typeless constants may be specified, and/or +user-requested warnings indicating places where g77 might well be doing +something different than other compilers in this regard. + +*VAX FORTRAN VERSUS FORTRAN 90* + +The -fvxt-not-f90 and -ff90-not-vxt command-line options control how +g77 interprets certain tokens and constructs that are have different +meanings in VAX FORTRAN and Fortran 90. + +When -ff90-not-vxt is specified, the following interpretations are +made: + + - Double-quote character (") delimits character constant just as does + apostrophe ('), rather than beginning an octal constant of INTEGER type. + - Exclamation point in column 5 of fixed-form source file treated as + a continuation character rather than the beginning of a comment (as it + does in any other column). + - "TYPE " and "TYPE (), <...>" + statements recognized as the Fortran 90 variety, not I/O statements. + (However, the F90 variety is _not_ supported, so this really just + ensures that g77 will produce a diagnostic instead of trying to + implement the VXT TYPE statement -- which currently is not supported + as well.) + +*LIBRARY AND PROCEDURE-CALLING INTERFACE* + +Currently, -ff2c and -ff2c-library are defaults and -ff2c-library must be +in force for g77 to work properly. + +The -ff2c option specifies that g77 is to generate code that is +link-time and run-time compatible with code generated by an +version of f2c built to be generally compatible with g77. (This +will normally be the case, but it is possible that with older or +perhaps even newer versions of f2c, or with certain configuration +changes to f2c internals, incompatibilities will nevertheless +result.) + +Specifying -fno-f2c allows g77 to generate, in some cases, faster code. +For example, how REAL and [DOUBLE] COMPLEX FUNCTIONs are called is +governed by the -ff2c command-line option. With -fno-f2c, they +are compiled as returning the appropriate type (float, __complex__ float, +__complex__ double), whereas with -ff2c, they are compiled differently +(with perhaps slower run-time performance) to accommodate the restrictions +inherent in f2c's use of K&R C as an intermediate language -- REAL +functions return double, while [DOUBLE] COMPLEX functions return void +but have an extra argument pointing to a place for the functions to +return their values. (It is possible that in some cases -ff2c might +produce faster code. Experiment and enjoy.) + +An example of the effect of -ff2c-library, which is the default (and +currently must be in force, since g77 compiles code for use only +with libf2c), is that diagnostics are issued for some features +unsupported by the f2c library, such as NAMELIST in combination with +source case preservation. + +*OPTIONS FOR POTENTIALLY BUGGY PROGRAMS* + +The -finit-local-zero option tells g77 to initialize all local variables +and arrays (that are not otherwise explicitly initialized) to binary +zeros. Many other compilers do this, which means lots of Fortran code +developed with those compilers depends on it. It is safer (and probably +would produce a faster program) to find the variables and arrays that +need such initialization and provide it explicitly via DATA, so that +-finit-local-zero is not needed. Use the -Wuninitialized option (which +requires -O as well) to find some such cases. + +The -fno-automatic command-line option tells g77 to assume, in essence, that +a SAVE statement is present in every program unit. The effect of this +is that all variables and arrays are made static, i.e. not placed on +the stack or in heap storage. This might cause a buggy program to appear +to work better -- if so, rather than relying on this command-line +option (and hoping all compilers provide the equivalent one), add SAVE +statements to some or all program unit sources, as appropriate. The +default is -fautomatic, which tells g77 to try and put variables and +arrays on the stack where possible and reasonable. Use the -Wuninitialized +option (which requires -O as well), _without_ specifying -fno-automatic, +to find some cases where SAVE is erroneously omitted as an attribute +for variables and arrays. + +The -W options tell g77 to warn about various suspicious constructs. +In particular, the -Wimplicit, `-O -Wuninitialized', and -Wsurprising +options can sometimes identify bugs in programs that appear to work +when compiled by other Fortran compilers but do not work when compiled +by g77 (or vice versa). + +*OPTIONS FOR SPEEDING UP PROGRAMS* + +Aside from the usual gcc options, such as -O, -ffast-math, and so on +(see the gcc documentation), consider trying: + + -fno-f2c, if you aren't linking with any f2c-produced code (other + than libf2c) + +If you're using -fno-automatic already, you probably should change +your code to allow compilation with -fautomatic, because the program +should run faster. Similarly, you should be able to use +-fno-init-local-zero instead of -finit-local-zero. This is because +it is rare that every variable affected by these options in a given +program actually needs to be so affected. For example, +-fno-automatic, which effectively SAVEs every local variable and +array, affects even things like DO iteration variables, which rarely +need to be SAVEd, and this often reduces run-time performances. +Similarly, -fno-init-local-zero forces such variables to be +initialized to zero -- when SAVEd (e.g. via -fno-automatic), this +by itself generally affects only startup time for a program, but +when not SAVEd, it can slow down the procedure every time it is called. + +See *SUMMARY OF OVERLY CONVENIENT COMMAND-LINE OPTIONS* for information +on the -fno-automatic and -finit-local-zero options and how to convert +their use into selective changes in your own code. + +*PEDANTIC COMPILATION* + +The -fpedantic and -fno-pedantic command-line options control whether +certain non-standard constructs elicit diagnostics (usually in the form +of warnings) from g77. The -fpedantic option is useful for finding +some extensions g77 accepts that other compilers might not accept. +(Note that the -pedantic and -pedantic-errors options always imply +-fpedantic.) + +With -ff90 in force along with -fpedantic, some constructs are +accepted that result in diagnostics when -fno-f90 and -fpedantic are +both in force. See *FORTRAN 90* for information on those constructs. + +The constructs for which g77 issues diagnostics when -fpedantic is +specified (and -fno-f90 is in force) are: + + - "READ (), " -- the standard disallows the comma + here, while allowing it in "READ [, ]", but many + compilers (including f2c) support the superfluous comma. + - DOUBLE COMPLEX, either explicitly (via explicit or IMPLICIT statement) + or implicitly (as in "C*D", where C is COMPLEX and D is DOUBLE + PRECISION, which is prohibited by the standard because it should + produce a non-standard DOUBLE COMPLEX result). + - Automatic conversion of LOGICAL, REAL, DOUBLE PRECISION, and COMPLEX + expressions to INTEGER in contexts such as: array-reference indexes; + alternate-RETURN values; computed GOTO; FORMAT run-time expressions + (not yet supported); dimension lists in specification statements; + numbers for I/O statements (such as "READ (UNIT=3.2, <...>)"); sizes + of CHARACTER entities in specification statements; kind types in + specification entities (a Fortran 90 feature); initial, terminal, + and incrementation parameters for implied-DO constructs in DATA + statements. + - Automatic conversion of LOGICAL expressions to INTEGER in context + such as: arithmetic IF (where COMPLEX expressions are completely + disallowed). + - Substring operators applied to character constants and named + constants (such as "PRINT *,'hello'(3:5)", which would print "llo"). + - Null argument passed to statement function (as in "PRINT *,FOO(,3)"). + - Differences between program units regarding whether a given COMMON + area is SAVEd (for targets where program units in a single source + file are "glued" together as they typically are for UNIX development + environments). + - Differences between named-COMMON-block sizes between program units. + - Specification statements following first DATA statement (normally + "DATA I/1/" may be followed by "INTEGER J", though not "INTEGER I", + but -fpedantic complains about both cases). + - Semicolon as statement separator (as in "CALL FOO; CALL BAR"). + - Comma before list of I/O items in WRITE, ENCODE, DECODE, REWRITE + statements (kind of strange, since ENCODE/DECODE/REWRITE should yield + diagnostics with -fpedantic???), as with READ (as explained above). + - Use of '&' in column 1 of fixed-form source (indicates continuation). + - Use of CHARACTER constants to initialize numeric entities, and vice + versa. + - Expressions having two arithmetic operators in a row, such as + "X*-Y". + +*UGLY FEATURES* + +The -fugly and -fno-ugly command-line options determine whether certain +features supported by VAX FORTRAN and other such compilers, but considered +too ugly to be in code that can be changed to use safer and/or more +portable constructs, are accepted. + +The constructs enabled via -fugly include: + + - Automatic conversion between INTEGER and LOGICAL as dictated by + context (typically implies nonportable dependencies on how a + particular implementation encodes .TRUE. and .FALSE.). + - Use of typeless and hollerith constants in non-standard places + (the "standard" here being the appendix in ANSI FORTRAN 77 and + the descriptions in MIL-STD 1753), plus in places controlled + by -fugly-args and -fugly-init. + - Use of LOGICAL variable in ASSIGN and assigned-GOTO statements. + - Single trailing comma meaning "pass extra trailing null argument" in + list of actual arguments to procedure other than statement function + (e.g. "CALL FOO(,)" meaning "pass two null arguments" rather than + "pass one null argument"). + +As of 0.5.11, the -fugly-args and -fno-ugly-args options are available. +The construct enabled via -fugly-args is one of those enabled via +-fugly, and is: + + - Passing of typeless and hollerith constants as actual arguments + in procedure invocations + +As of 0.5.14, the -fugly-init and -fno-ugly-init options are available. +The set of constructs enabled via -fugly-init is a subset of those +enabled via -fugly, and is: + + - Use of hollerith and typeless constants in contexts where they + set initial (compile-time) values for variables, arrays, and + named constants -- i.e. DATA and PARAMETER statements, plus + type-declaration statements specifying initial values + - In the same contexts as above, use of character constants to + initialize numeric items and vice versa (one constant per item) + - Use of hollerith and typeless constants on the right-hand side + of assignment statements to numeric types + +The defaults are "-fugly-args -fugly-init". Note that specifying +-fugly or -fno-ugly affects all related options, so that "-fugly-args +-fno-ugly -fugly-init" would leave only -fugly-init in effect. + +*CASE SENSITIVITY IN SOURCE CODE* + +There are 66 useful settings that affect case sensitivity, plus 10 +settings that are nearly useless, with the remaining 116 settings +being either redundant or useless. + +None of these settings have any effect on the contents of comments +(the text after a "c" or "C" in Column 1, for example) or of character +or Hollerith constants. Note that things like the "E" in the statement +"CALL FOO(3.2E10)" and the "TO" in "ASSIGN 10 TO LAB" are considered +built-in keywords. + +Low-level switches are identified in this discussion thusly: + +A: Source Case Conversion: + 0: Preserve (see Note 1) + 1: Convert to Upper Case + 2: Convert to Lower Case + +B: Built-in Keyword Matching: + 0: Match Any Case (per-character basis) + 1: Match Upper Case Only + 2: Match Lower Case Only + 3: Match InitialCaps Only (see tables for spellings) + +C: Built-in Intrinsic Matching: + 0: Match Any Case (per-character basis) + 1: Match Upper Case Only + 2: Match Lower Case Only + 3: Match InitialCaps Only (see tables for spellings) + +D: User-defined Symbol Possibilities (warnings only) + 0: Allow Any Case (per-character basis) + 1: Allow Upper Case Only + 2: Allow Lower Case Only + 3: Allow InitialCaps Only (see Note 2) + +Note 1: g77 will eventually support NAMELIST in a manner that is +coordinate with these source switches, in that input will be +expected to meet the same requirements as source code in terms +of matching symbol names and keywords (for the exponent letters). +Currently, however, NAMELIST is supported via the f2c library, +which uppercases NAMELIST input and symbol names for matching. +This means not only that NAMELIST output currently shows symbol +(and keyword) names in uppercase even if lower-case source +conversion (option A2) is selected, but that NAMELIST cannot be +adequately supported when source case preservation (option A0) +is selected. If A0 is selected, a warning message will be +output for each NAMELIST statement to this effect. The behavior +of the program is undefined at run time if two or more symbol names +appear in a given NAMELIST such that the names are identical +when converted to upper case (e.g. "NAMELIST /X/ VAR, Var, var"). +For complete and total elegance, perhaps there should be a warning +when option A2 is selected, since the output of NAMELIST is currently +in uppercase but will someday be lowercase (when a g77lib is written), +but that seems to be overkill for a product in alpha (or even beta) +test. + +Note 2: Rules for InitialCaps names are: + - Must be a single uppercase letter OR + - Must start with an uppercase letter and contain at least one + lowercase letter +So A, Ab, ABc, AbC, and Abc are valid InitialCaps names, but AB, A2, and +ABC are not. Note that most, but not all, built-in names meet these +requirements -- the exceptions are some of the two-letter FORMAT +specifiers, such as BN and BZ. + +Here are the names of the corresponding command-line options for +the stand-alone front end (ffe): + +A0: -fsource-case-preserve +A1: -fsource-case-upper +A2: -fsource-case-lower + +B0: -fmatch-case-any +B1: -fmatch-case-upper +B2: -fmatch-case-lower +B3: -fmatch-case-initcap + +C0: -fintrin-case-any +C1: -fintrin-case-upper +C2: -fintrin-case-lower +C3: -fintrin-case-initcap + +D0: -fsymbol-case-any +D1: -fsymbol-case-upper +D2: -fsymbol-case-lower +D3: -fsymbol-case-initcap + +Useful combinations of the above settings, along with abbreviated +option names that set some of these combinations all at once: + + 1: A0-- B0--- C0--- D0--- -fcase-preserve + 2: A0-- B0--- C0--- D-1-- + 3: A0-- B0--- C0--- D--2- + 4: A0-- B0--- C0--- D---3 + 5: A0-- B0--- C-1-- D0--- + 6: A0-- B0--- C-1-- D-1-- + 7: A0-- B0--- C-1-- D--2- + 8: A0-- B0--- C-1-- D---3 + 9: A0-- B0--- C--2- D0--- +10: A0-- B0--- C--2- D-1-- +11: A0-- B0--- C--2- D--2- +12: A0-- B0--- C--2- D---3 +13: A0-- B0--- C---3 D0--- +14: A0-- B0--- C---3 D-1-- +15: A0-- B0--- C---3 D--2- +16: A0-- B0--- C---3 D---3 +17: A0-- B-1-- C0--- D0--- +18: A0-- B-1-- C0--- D-1-- +19: A0-- B-1-- C0--- D--2- +20: A0-- B-1-- C0--- D---3 +21: A0-- B-1-- C-1-- D0--- +22: A0-- B-1-- C-1-- D-1-- -fcase-strict-upper +23: A0-- B-1-- C-1-- D--2- +24: A0-- B-1-- C-1-- D---3 +25: A0-- B-1-- C--2- D0--- +26: A0-- B-1-- C--2- D-1-- +27: A0-- B-1-- C--2- D--2- +28: A0-- B-1-- C--2- D---3 +29: A0-- B-1-- C---3 D0--- +30: A0-- B-1-- C---3 D-1-- +31: A0-- B-1-- C---3 D--2- +32: A0-- B-1-- C---3 D---3 +33: A0-- B--2- C0--- D0--- +34: A0-- B--2- C0--- D-1-- +35: A0-- B--2- C0--- D--2- +36: A0-- B--2- C0--- D---3 +37: A0-- B--2- C-1-- D0--- +38: A0-- B--2- C-1-- D-1-- +39: A0-- B--2- C-1-- D--2- +40: A0-- B--2- C-1-- D---3 +41: A0-- B--2- C--2- D0--- +42: A0-- B--2- C--2- D-1-- +43: A0-- B--2- C--2- D--2- -fcase-strict-lower +44: A0-- B--2- C--2- D---3 +45: A0-- B--2- C---3 D0--- +46: A0-- B--2- C---3 D-1-- +47: A0-- B--2- C---3 D--2- +48: A0-- B--2- C---3 D---3 +49: A0-- B---3 C0--- D0--- +50: A0-- B---3 C0--- D-1-- +51: A0-- B---3 C0--- D--2- +52: A0-- B---3 C0--- D---3 +53: A0-- B---3 C-1-- D0--- +54: A0-- B---3 C-1-- D-1-- +55: A0-- B---3 C-1-- D--2- +56: A0-- B---3 C-1-- D---3 +57: A0-- B---3 C--2- D0--- +58: A0-- B---3 C--2- D-1-- +59: A0-- B---3 C--2- D--2- +60: A0-- B---3 C--2- D---3 +61: A0-- B---3 C---3 D0--- +62: A0-- B---3 C---3 D-1-- +63: A0-- B---3 C---3 D--2- +64: A0-- B---3 C---3 D---3 -fcase-initcap +65: A-1- B01-- C01-- D01-- -fcase-upper +66: A--2 B0-2- C0-2- D0-2- -fcase-lower + +Number 22 is the "strict" ANSI FORTRAN 77 model whereas all input +(except comments, character constants, and hollerith strings) must +be entered in uppercase. Use -fcase-strict-upper to specify this +combination. + +Number 43 is like Number 22 except all input must be lowercase. Use +-fcase-strict-lower to specify this combination. + +Number 65 is the "classic" ANSI FORTRAN 77 model as implemented on many +non-UNIX machines whereby all the source is translated to uppercase. +Use -fcase-upper to specify this combination. + +Number 66 is the "canonical" UNIX model whereby all the source is +translated to lowercase. Use -fcase-lower to specify this +combination. + +There are a few nearly useless combinations: + +67: A-1- B01-- C01-- D--2- +68: A-1- B01-- C01-- D---3 +69: A-1- B01-- C--23 D01-- +70: A-1- B01-- C--23 D--2- +71: A-1- B01-- C--23 D---3 +72: A--2 B01-- C0-2- D-1-- +73: A--2 B01-- C0-2- D---3 +74: A--2 B01-- C-1-3 D0-2- +75: A--2 B01-- C-1-3 D-1-- +76: A--2 B01-- C-1-3 D---3 + +The above allow some programs to be compiled but with restrictions that +make most useful programs impossible: Numbers 67 and 72 warn about +_any_ user-defined symbol names (such as "SUBROUTINE FOO"); Numbers +68 and 73 warn about any user-defined symbol names longer than one +character that don't have at least one non-alphabetic character after +the first; Numbers 69 and 74 disallow any references to intrinsics; and +Numbers 70, 71, 75, and 76 are combinations of the restrictions in +67+69, 68+69, 72+74, and 73+74, respectively. + +All redundant combinations are shown in the above tables anyplace +where more than one setting is shown for a low-level switch. For +example, "B0-2-" means either setting 0 or 2 is valid for switch B. +The "proper" setting in such a case is the one that copies the setting +of switch A -- any other setting might slightly reduce the speed of +the compiler, though possibly to an unmeasurable extent. + +All remaining combinations are useless in that they prevent successful +compilation of non-null source files (source files with something other +than comments). + +*INTRINSIC GROUPS* + +A given specific intrinsic belongs in one or more groups. Each group +is deleted, disabled, hidden, or enabled by default or a command-line +option. If a group is deleted, no intrinsics will be recognized as +belonging to that group; if it is disabled, intrinsics will be recognized +as belonging to the group but cannot be referenced (other than via +the INTRINSIC statement) through that group; if hidden, intrinsics +in that group are recognized and enabled (if implemented) only if +the first mention of the actual name of an intrinsic is in an INTRINSIC +statement; if enabled, intrinsics in that group are recognized and +enabled (if implemented). + +The distinction between deleting and disabling a group is illustrated +by the following example. Assume intrinsic FOO belongs only to group +FGR. If group FGR is deleted, the following program unit will successfully +compile, because FOO() will be seen as a reference to an external +function named FOO: + + PRINT *, FOO() + END + +If group FGR is disabled, the above program unit will be compiled with +errors, either because the FOO intrinsic is improperly invoked or, if +properly invoked, it is not enabled. To change the above program so it +references an external function FOO instead of the disabled FOO intrinsic, +add the following line to the top: + + EXTERNAL FOO + +So, deleting a group tells g77 to pretend as though the intrinsics in +that group do not exist at all, whereas disabling it tells g77 to +recognize them as (disabled) intrinsics in intrinsic-like contexts. + +Hiding a group is like enabling it, but the intrinsic must be first +named in an INTRINSIC statement to be considered a reference to the +intrinsic rather than to an external procedure. This might be the +"safest" way to treat a new group of intrinsics when compiling old +code, because it allows the old code to be generally written as if +those new intrinsics never existed, but to be changed to use them +by inserting INTRINSIC statements in the appropriate places. However, +it should be the goal of development to use EXTERNAL for all names +of external procedures that might be intrinsic names. + +If an intrinsic is in more than one group, it is enabled if any of its +containing groups are enabled; if not so enabled, it is hidden if +any of its containing groups are hidden; if not so hidden, it is disabled +if any of its containing groups are disabled; if not so disabled, it is +deleted. This extra complication is necessary because some intrinsics, +such as IBITS, belong to more than one group, and hence should be +enabled if any of the groups to which they belong are enabled, etc. + +The groups are: + +DCP -- DOUBLE COMPLEX intrinsics from the standards (F77, F90) +F2C -- Intrinsics supported by AT&T's f2c converter and/or libf2c +F90 -- Fortran 90 intrinsics +MIL -- MIL-STD 1753 intrinsics (MVBITS, IAND, BTEST, and so on) +UNIX -- UNIX intrinsics (IARGC, EXIT, ERF, and so on) +VXT -- VAX/VMS FORTRAN (as of V4) intrinsics + +The command-line options are: + +-fdcp-intrinsics-delete -- Delete DCP intrinsics +-fdcp-intrinsics-hide -- Hide DCP intrinsics +-fdcp-intrinsics-disable -- Disable DCP intrinsics +-fdcp-intrinsics-enable -- Enable DCP intrinsics +-ff2c-intrinsics-delete -- Delete F2C intrinsics +-ff2c-intrinsics-hide -- Hide F2C intrinsics +-ff2c-intrinsics-disable -- Disable F2C intrinsics +-ff2c-intrinsics-enable -- Enable F2C intrinsics +-ff90-intrinsics-delete -- Delete F90 intrinsics +-ff90-intrinsics-hide -- Hide F90 intrinsics +-ff90-intrinsics-disable -- Disable F90 intrinsics +-ff90-intrinsics-enable -- Enable F90 intrinsics +-fmil-intrinsics-delete -- Delete MIL intrinsics +-fmil-intrinsics-hide -- Hide MIL intrinsics +-fmil-intrinsics-disable -- Disable MIL intrinsics +-fmil-intrinsics-enable -- Enable MIL intrinsics +-funix-intrinsics-delete -- Delete UNIX intrinsics +-funix-intrinsics-hide -- Hide UNIX intrinsics +-funix-intrinsics-disable -- Disable UNIX intrinsics +-funix-intrinsics-enable -- Enable UNIX intrinsics +-fvxt-intrinsics-delete -- Delete VXT intrinsics +-fvxt-intrinsics-hide -- Hide VXT intrinsics +-fvxt-intrinsics-disable -- Disable VXT intrinsics +-fvxt-intrinsics-enable -- Enable VXT intrinsics + +*TROUBLE (BUGS, ETC.)* + +First, read the documentation provided with gcc on bugs. +In particular, read the sections entitled "Trouble" and "Bugs". +Follow this information along with the information listed below. + +Send bug reports for GNU Fortran to `fortran@gnu.ai.mit.edu'. + +If you want quicker response to bugs or other needs you have +regarding g77, look in the service directory for someone who +might help you for a fee. The service directory is found in +the file named `SERVICE' in the GNU CC distribution. + +To find out about existing bugs and ongoing plans for GNU +Fortran, on Internet do `finger -l fortran@gnu.ai.mit.edu' +or whatever is the equivalent on your system. (You might need +to use the address `fortran@gate-1.gnu.ai.mit.edu' instead, +or use gate-2, gate-3, gate-4, etc. instead of gate-1.) + +Alternatively, retrieve `gnu.ai.mit.edu:/g77.plan' via +anonymous ftp, or if you cannot do that, email +`fortran@gnu.ai.mit.edu' asking for a recent copy of the +GNU Fortran .plan file. (The `finger' command shown above +obtains the most recent copy of all these methods.) + +For all g77 bug reports, enclose the version and configuration +info for g77. As of version 0.5.16, an easy way to do this +is to issue the command `g77 -v' and include the output with the +bug report -- ignore any error messages that are displayed when +the linker is run. (Prior to version 0.5.16, an actual Fortran source +file needed to be compiled to get the various Fortran-specific +portions of the g77 product to be invoked and thus display their +version numbers. 0.5.16 has changes to the g77 command to make +this process automatic when `-v' is specified without additional +options specifying actions other than displaying the version info. +NOTE: Version 0.5.16 had a bug in `g77 -v' that resulted in the +removal of the system's `/dev/null' file if the command was issued +while logged in as `root'. Version 0.5.17 fixes this bug. You +might want to use `ls -l /dev/null /dev/zero' to make sure the +entry for `null' is similar to that for `zero' and, if not, contact +your system administrator about using `mknod' to recreate `/dev/null'.) + +Note that you should include with your bug report any files +INCLUDEd by the source file you send, and any files they INCLUDE, +and so on. This is just an extension of the explanation the +gcc documentation offers about having to provide the contents +of #include'd files. + +Diagnostics produced by g77 that you do not understand or expect +are not necessarily g77 bugs. They might indicate problems with +your code that, perhaps, no other compiler has found. Please check +out your code thoroughly, and read applicable g77 documentation, +before assuming g77 has a bug in this area. + +If your program doesn't link, due to unresolved references to names +like "_main", make sure you're using the `g77' command to do the +link, since this command ensures that the necessary libraries are +loaded by specifying `-lf2c -lm' when it invokes the `gcc' +command to do the actual link. (Use the `-v' option to discover +more about what actually happens when you use the `g77' and `gcc' +commands.) Also, try specifying `-lc' as the last item on the g77 +command line, because some systems need it and g77 doesn't do it +automatically. + +If your program successfully compiles and links, but doesn't work, +either producing incorrect results or crashing, there are various +things you can try. Among the things you should try with your code +before giving up, or assuming g77 or libf2c must have a bug, are +the following: + +- Compile all your Fortran code with `-O -W -Wall -Wimplicit' + and make sure all the resulting warnings are ones you expect and + understand. + +- Try using f2c instead of g77 to compile all your code, using the + -C option with f2c (which checks array bounds -- g77 doesn't have + such an option yet, which is why you have to use f2c), and link + and run the resulting program trying to reproduce the bug. + +If a run-time bug occurs both when your program is compiled with g77 +and when compiled with f2c, that suggests (but does not prove) that +the bug is not in g77, rather that it is either in your own code +(quite likely), in libf2c, in gcc, or elsewhere. Probably 99% of the +time the bug is in your own code, EVEN IN CASES WHERE YOUR OWN CODE +"WORKS" WITH OTHER COMPILERS. Please follow the instructions above +to try and find bugs in your code before submitting bug reports. + +Some causes for run-time problems that might be invisible in the code +when using g77: + +- It is possible that combining code compiled with f2c and with g77 + results in misbehaving programs. This can happen if, for example, + f2c's view of the system configuration, and especially if the + copy of f2c.h used when compiling the output of f2c, don't agree + with g77's configuration and the f2c.h used when compiling its + version of libf2c. + + Another way bugs might happen is if you don't use the same, or a similar + enough, version of gcc to compile f2c's output as is integrated + with the version of g77 you're using. + + The solution is to try compiling all Fortran code in your program + with the exact same compiler configuration. Try using f2c with gcc + exclusively, for example. Then try using g77 exclusively. See + what works and what doesn't, and perhaps that'll help you identify + the source of the problem. + + Note that "Fortran code" includes not only your own Fortran code, + but any libraries you are using that were either written in Fortran + or were designed to interface to some Fortran system. A third- + party Fortran library might not have been compiled with a + version of g77 compatible with the one you're using, for example -- + to fix this, you need to obtain an appropriate version of the library. + +- If you use -fno-f2c when compiling some, but not all, code, there + could easily be run-time errors. If functions returning REAL, + COMPLEX, or DOUBLE COMPLEX are compiled and invoked from different + "sets" of code (where one "set" is compiled with -fno-f2c, and the + other set isn't), there almost certainly will be run-time bugs. + +(If you want to try running gdb on the g77 compiler itself, named f771, +note that the global variables lineno and input_filename usually are +accurate for most kinds of crashes, and the presence of an invocation +of ffestd_exec_end() on the stack indicates that f771 was in the second +pass of processing a program unit instead of the first pass. This might +help you fix the bug or find a temporary workaround -- the fix and the +information should be sent in addition to the bug report.) + +*ADVANTAGES OVER f2c* + +Without f2c, g77 would have taken much longer to do and probably not +been as good for quite a while. Sometimes people who notice how +much g77 depends on, and documents encouragement to use, f2c ask +why g77 was created if f2c already existed. This section gives some +basic answers to these questions, though it is not intended to +be comprehensive. + +Language Extensions +------------------- + +g77 offers several extensions to the Fortran language that f2c +doesn't. + +However, f2c offers a few that g77 doesn't, like INTEGER*2. It +is expected that g77 will offer some or all of these missing +features at some time in the future. + +Compiler Options +---------------- + +g77 offers a whole bunch of compiler options that f2c doesn't. + +However, f2c offers a few that g77 doesn't, like an option to generate +code to check array subscripts at run time. It is expected that +g77 will offer some or all of these missing options at some time +in the future. + +Compiler Speed +-------------- + +Saving the steps of writing and then rereading C code is a big reason +why g77 should be able to compile code much faster than using f2c +in conjunction with the equivalent invocation of gcc. + +However, due to g77's youth, lots of self-checking is still being +performed. As a result, this improvement is as yet unrealized +(though the potential seems to be there for quite a big speedup +in the future). It is possible that, as of version 0.5.18, g77 +is noticably faster compiling many Fortran source files than using +f2c in conjunction with gcc. + +Optimization (Program Speed) +---------------------------- + +g77 has the potential to better optimize code than f2c, even when +gcc is used to compile the output of f2c, because f2c must necessarily +translate Fortran into a somewhat lower-level language (C) that cannot +preserve all the information that is potentially useful for optimization, +while g77 can gather, preserve, and transmit that information directly +to the GBE. + +For example, g77 implements ASSIGN and assigned GOTO using direct +assignment of pointers to labels and direct jumps to labels, whereas +f2c maps the assigned labels to integer values and then uses a C +`switch' statement to encode the assigned GOTO statements. + +However, as is typical, theory and reality don't quite match, at least +not in all cases, so it is still the case that f2c|gcc can generate +code that is faster than g77. + +Debugging +--------- + +Because g77 compiles directly to assembler code like gcc, instead +of translating to an intermediate language (C) as does f2c, support +for debugging can be better for g77 than f2c. + +However, although g77 might be somewhat more "native" in terms of +debugging support than f2c+gcc, there still are a lot of things +"not quite right". Many of the important ones should be resolved +in the near future. + +For example, g77 doesn't have to worry about reserved names +like f2c does. Given "FOR = WHILE", f2c must necessarily +translate this to something _other_ than "for = while;" since C reserves +those words. + +However, g77 does still uses things like an extra level of indirection +for ENTRY-laden procedures -- in this case, because the back end doesn't +yet support multiple entry points. + +Another example is that, given + + COMMON A,B + EQUIVALENCE (B,C) + +the g77 user should be able to access the variables directly, by name, +without having to traverse C-like structures and unions, while f2c +is unlikely to ever offer this ability (due to limitations in the +C language). + +However, due to apparent bugs in the back end, g77 currently doesn't +take advantage of this facility at all -- it doesn't emit any debugging +information for COMMON and EQUIVALENCE areas, other than information +on the array of `char' it creates (and, in the case of local EQUIVALENCE, +names) for each such area. + +Yet another example is arrays. g77 represents them to the debugger +using the same "dimensionality" as in the source code, while f2c +must necessarily convert them all to one-dimensional arrays to fit +into the confines of the C language. However, the level of support +offered by debuggers for interactive Fortran-style access to arrays +as compiled by g77 can vary widely; in some cases, it can actually +be an advantage that f2c converts everything to widely supported +C semantics. + +Character And Hollerith Constants +--------------------------------- + +To avoid the extensive hassle that would be needed to avoid this, +f2c uses C character constants to encode character and hollerith +constants. That means a constant like 'HELLO' is translated to +"hello" in C, which further means that an extra null byte is +present at the end of the constant. This null byte is superfluous. + +g77 does not generate such null bytes. This represents significant +savings of resources, such as on systems where /dev/null or +/dev/zero represent bottlenecks in the systems' performance, because +g77 simply asks for fewer zeros from the operating system than f2c. + +*DISAPPOINTMENTS AND MISUNDERSTANDINGS* + +(Make sure you've read the same-titled section in the gcc docs first!) + +- g77 does not allow REAL and other weird types for arguments to + intrinsics like AND, OR, and SHIFT. + +- g77 rejects some particularly nonportable, silent data-type conversions + such as LOGICAL to REAL (as in "A=.FALSE." where A is REAL) that other + compilers might quietly accept. Some such conversions are accepted + when various forms of the -fugly option are specified, however. + +- g77 defaults to specially processing backslashes (\) in character and + hollerith constants a la the C language. Despite not being within the + spirit (though emphatically within the letter) of the ANSI FORTRAN 77 + standard, g77 defaults to this because that is what f77 defaults to, and + apparently lots of code depends on this feature. You can always specify + -fno-backslash to turn off this processing. Because of this, and because + of other limitations g77 currently has (like not accepting + "PARAMETER (C=CHAR(7))"), the g77 default will remain -fbackslash, and + as the expectation of ongoing compatibility is likely to increase, this + is likely to never change (unless popular competing implementations + of UNIX `f77' commands change their defaults first). + +- g77 rejects things other compilers accept, like "INTRINSIC SIN,SIN". + As time permits in the future, some of these things that are easy for + humans to read and write and unlikely to be intended to mean something + else will be accepted by g77 (unless -fpedantic is specified). In the + meantime, you might as well fix your code to be more standard-conforming + and portable. + +- g77 disallows IMPLICIT CHARACTER*(*). This is not standard-conforming, + and there are some very good reasons for that. When I next remember + any, I'll try to write them down. + +- g77 doesn't accept "PARAMETER I=1". Supporting this obsolete form of + the PARAMETER statement would not be particularly hard, as most of the + parsing code is already in place and working. Until time/money is + spent implementing it, you might as well fix your code to use the + standard form, "PARAMETER (I=1)" (possibly needing "INTEGER I" preceding + the PARAMETER statement as well). + +- g77 doesn't support pointers or allocatable objects. This stuff + is probably considered just behind INTEGER*2 on the list of large, + important things to add to g77. + +- g77 doesn't support the I/O statements TYPE and ACCEPT. These are + common extensions that should be easy to support, but also are fairly + easy to work around in user code. + +- g77 doesn't support STRUCTURE, UNION, RECORD, MAP. This set of extensions + is quite a bit lower on the list of large, important things to add to g77, + and in particular requires a great deal of work either upgrading or + replacing libf2c. + +- g77 doesn't support various OPEN, CLOSE, and INQUIRE keywords such + as "DISP='DELETE'". These extensions are easy to add to g77 itself + but require work upgrading or replacing libf2c. + +- g77 doesn't allow a COMMON block and an external procedure or BLOCK DATA + to have the same name. Some systems allow this, but g77 does not, + to be compatible with f2c. g77 could special-case the way it handles + BLOCK DATA, since it is not compatible with f2c in this particular + area (necessarily, since g77 offers an important feature here), but + it is likely that such special-casing would be very annoying to people + with programs that use "EXTERNAL FOO", with no other mention of FOO + in the same program unit, to refer to external procedures, since the + result would be that g77 would treat these references as requests to + force-load BLOCK DATA program units. In that case, if g77 modified + names of BLOCK DATA so they could have the same names as COMMON, users + would find that their programs wouldn't link because the FOO procedure + didn't have its name translated the same way. (Strictly speaking, + g77 could emit a null-but-externally-satisfying definition of FOO + with its name transformed as if it had been a BLOCK DATA, but that + probably invites more trouble than it's worth.) + +- g77 doesn't allow, e.g., "CALL IFIX". g77 knows about intrinsic + subroutines, not just functions, and is able to support both having + the same names, for example. As a result of this, g77 rejects calls + to intrinsics that are not subroutines, and function invocations + of intrinsics that are not functions, just as it (and most compilers) + rejects invocations of intrinsics with the wrong number (or types) + of arguments. Use "EXTERNAL IFIX" to call a user-written IFIX + subroutine. + +- g77 doesn't allow intrinsics in PARAMETER statements. See gcc/f/PROJECTS. + This is a feature I consider to be absolutely vital, even though it + is not standard-conforming. + +- g77 doesn't allow non-integral exponentiation in PARAMETER statements, + such as "PARAMETER (R=2**.25)". It is unlikely g77 will ever support + this feature, as doing it properly requires complete emulation of + a target computer's floating-point facilities when building g77 + as a cross-compiler. But if the gcc back end is enhanced to provide + such a facility, g77 will likely follow suit by adding this feature. + +- g77 doesn't support "FORMAT(I)" and the like. See the answer for + not supporting STRUCTURE, UNION, RECORD, and MAP. + +*OPEN QUESTIONS* + +Please consider offering useful answers to these! + +- g77 treats constants like Z'ABCD' and 'ABCD'Z as typeless. It seems + like maybe the prefix-letter form, Z'ABCD', should be INTEGER + instead. Perhaps this will be changed for 0.6. + +- LOC() and other intrinsics are probably somewhat misclassified. Is + the a need for more precise classification of intrinsics, and if so, + what are the appropriate groupings? Is there a need to individually + enable/disable/delete/hide intrinsics from the command line? + +*INTERFACING, DEBUGGING, ETC.* + +GNU Fortran currently generates code that is object-compatible with +the f2c converter. Also, it avoids limitations in the current GNU +Back End (GBE), such as the inability to generate a procedure with +multiple entry points, by generating code that is structured +differently (in terms of procedure names, scopes, arguments, and +so on) than might be expected. + +As a result, writing code in other languages that calls on, is +called by, or shares in-memory data with g77-compiled code generally +requires some understanding of the way g77 compiles code for +various constructs. Similarly, using a debugger to debug g77-compiled +code, even if that debugger supports native Fortran debugging, generally +requires this sort of information. + +This section describes some of the basic information on how +g77 compiles code for constructs involving interfaces to other +languages and to debuggers. + +NOTE: Much or all of this information pertains to only the current +release of g77, sometimes even to using certain compiler options +with g77 (such as -fno-f2c). Do not write code that depends on this +information without clearly marking said code as nonportable and +subject to review for every new release of g77. This information +is provided primarily to make debugging of code generated by this +particular release of g77 easier for the user, and partly to make +writing (generally nonportable) interface code easier. Both of these +activities require tracking changes in new version of g77 as they +are installed, because new versions can change the behaviors +described in this section. + +Names +----- + +Fortran permits each implementation to decide how to represent +names as far as how they're seen in other contexts, such as debuggers +and when interfacing to other languages, and especially as far +as how casing is handled. + +External names -- names of entities that are public, i.e. accessible +to all modules in a program -- normally have an underscore (_) +appended by g77, to generate code that is compatible with f2c. +External names include names of Fortran things like common blocks, +external procedures (subroutines and functions, but not including +statement functions, which are internal procedures), and entry point +names. However, use of the -fno-underscoring command-line option +disables this kind of transformation of external names (though inhibiting +the transformation certainly improves the chances of colliding with +incompatible externals written in other languages -- but that +might be intentional). + +When -funderscoring is in force, any name (external or local) that already +has at least one underscore in it is implemented by g77 by appending two +underscores. External names are changed this way for f2c compatibility. +Local names are changed this way to avoid collisions with external names +that are different in the source code -- f2c does the same thing, but +there's no compatibility issue there except for user expectations while +debugging. + +Therefore, given + + Max_Cost = 0 + +a user would, in the debugger, refer to this variable using the +name `max_cost__' (or `MAX_COST__' or `Max_Cost__', as described +below). (We hope to improve g77 in this regard in the future -- +don't write scripts depending on this behavior! Also, consider +experimenting with the `-fno-underscoring' option to try out +debugging without having to massage names by hand like this.) + +g77 provides a number of command-line options that allow the user +to control how case mapping is handled for source files. The default +is the traditional UNIX model -- names are mapped to lower case. +Other command-line options can be specified to map names to upper +case, or to leave them exactly as written in the source file. + +For example, given the statement + + Foo = 3.14159 + +it is normally the case that the variable assigned will be named +`foo'. This would be the name to enter when using a debugger to +access the variable, for example. + +However, depending on the command-line options specified, the +name implemented by g77 might instead be `FOO' or even `Foo', +thus affecting how debugging is done. + +Also, + + Call Foo + +would normally call a procedure that, if it were in a separate C program, +be defined starting with the line: + + void foo_() + +However, g77 command-line options could be used to change the casing +of names, resulting in the name `FOO_' or `Foo_' being given to the +procedure instead of `foo_', and the -fno-underscoring option could be used +to inhibit the appending of the underscore to the name. + +Main Program Unit (The PROGRAM Statement) +----------------------------------------- + +When g77 compiles a main program unit, it gives it the public +procedure name `MAIN__'. The libf2c library has the actual +`main()' procedure as is typical of C-based environments, and +it is this procedure that performs some initial start-up +activity and then calls MAIN__. + +Generally, g77 and libf2c are designed so that you need not +include a main program unit written in Fortran in your program -- +it can be written in C or some other language. Especially for +I/O handling, this is the case, although g77-0.5.16 includes +a bug fix for libf2c that solved a problem with using the +OPEN statement as the first Fortran I/O activity in a program +without a Fortran main program unit. + +However, if you don't intend to use g77 (or f2c) to compile your +main program unit -- that is, if you intend to compile a `main()' +procedure using some other language -- you should carefully +examine the code for main() in libf2c, found in the source +file gcc/f/runtime/libF77/main.c, to see what kinds of things +might need to be done by your main() in order to provide the +Fortran environment your Fortran code is expecting. + +For example, libf2c's main() sets up the information used by +the IARGC() and GETARG() intrinsics. Bypassing libf2c's main() +without providing a substitute for this activity would mean +that invoking IARGC() and GETARG() would produce undefined +results. + +When debugging, one implication of the fact that main(), which +is the place where the debugged program "starts" from the +debugger's point of view, is in libf2c is that you won't be +starting your Fortran program at a point you recognize as your +Fortran code. + +The standard way to get around this problem is to set a break +point (a one-time, or temporary, break point will do) at +the entrance to MAIN__, and then run the program. + +After doing this, the debugger will see the current execution +point of the program as at the beginning of the main program +unit of your program. + +Of course, if you really want to set a break point at some +other place in your program and just start the program +running, without first breaking at MAIN__, that should work fine. + +Arrays (The DIMENSION Statement) +-------------------------------- + +Fortran uses "column-major ordering" in its arrays. This differs +from other languages, such as C, which use "row-major ordering". +The difference is that, with Fortran, array elements ajacent to +each other in memory differ in the _first_ subscript instead of +the last; A(5,10,20) immediately follows A(4,10,20), whereas with +row-major ordering it would follow A(5,10,19). This consideration +affects not only interfacing with and debugging Fortran code, +it can greatly affect how code is designed and written, especially +when code speed and size is a concern. + +Fortran also differs from C, a popular language for interfacing and +to support directly in debuggers, in the way arrays are treated. +In C, arrays are single-dimensional and have interesting relationships +to pointers, neither of which is true for Fortran. As a result, +dealing with Fortran arrays from within an environment limited to +C concepts can be challenging. + +For example, accessing the array element A(5,10,20) is easy enough +in Fortran (use `A(5,10,20)'), but in C some difficult machinations +are needed. First, C would treat the A array as a single-dimension +array. Second, C does not understand low bounds for arrays as +does Fortran. Third, C assumes a low bound of zero (0), while Fortran +defaults to a low bound of one (1). Therefore, calculations must be done +to determine what the C equivalent of A(5,10,20) would be, and these +calculations require knowing the dimensions of A. + +For DIMENSION A(2:11,21,0:29), the calculation of the offset of +A(5,10,20) would be: + + (5-2) + + (10-1)*(11-2+1) + + (20-0)*(11-2+1)*(21-1+1) + = 4293 + +So the C equivalent in this case would be a[4293]. + +When using a debugger directly on Fortran code, the C equivalent +might not work, because some debuggers cannot understand the notion +of low bounds other than zero. However, unlike f2c, g77 does +inform the GBE that a multi-dimensional array (like A in the above +example) is really multi-dimensional, rather than a single- +dimensional array, so at least the dimensionality of the array +is preserved. + +Debuggers that understand Fortran should have no trouble with +non-zero low bounds, but for non-Fortran debuggers, especially +C debuggers, the above example might have a C equivalent of +a[4305]. This calculation is arrived at by eliminating the subtraction +of the lower bound in the first parenthesized expression on each +line -- that is, for (5-2) substitute (5), for (10-1) substitute +(10), and for (20-0) substitute (20). Actually, the implication of +this can be that the expression `*(&a[2][1][0] + 4293)' works fine, but +that `a[20][10][5]' produces the equivalent of `*(&a[0][0][0] + 4305)' +because of the missing lower bounds. Come to think of it, perhaps +the behavior is due to the debugger internally compensating for +the lower bounds by offsetting the base address of a, leaving +`&a' set lower, in this case, than `&a[2][1][0]' (the address of +its first element as identified by subscripts equal to the +corresponding lower bounds). + +You know, maybe nobody really needs to use arrays. + +Procedures (The SUBROUTINE, FUNCTION, and ENTRY Statements) +----------------------------------------------------------- + +Procedures that accept CHARACTER arguments are implemented by +g77 so that each CHARACTER argument has two actual arguments. +The first argument occupies the expected position in the +argument list and has the user-specified name. This argument +is a pointer to an array of characters, passed by the caller. +The second argument is appended to the end of the user-specified +calling sequence and is named `__g77_length_X', where X is +the user-specified name. This argument is of the C type `ftnlen' +(see gcc/f/runtime/f2c.h.in for information on that type) and +is the number of characters the caller has allocated in the +array pointed to by the first argument. (A procedure will +ignore the `__g77_length_X' argument if X is not declared +CHARACTER*(*), because for other declarations, it knows the +length. Not all callers necessarily know this, however, which +is why they all pass the extra argument.) + +The contents of the CHARACTER argument are specified by the +address passed in the first argument (named after it). The +procedure can read or write these contents as appropriate. + +When more than one CHARACTER argument is present in the argument +list, the `__g77_length_X' arguments are appended in the order +they appear. So "CALL FOO('HI','THERE')" is implemented in +C as `foo("hi","there",2,5);', ignoring the fact that g77 +does not provide the trailing null bytes on the constant +strings (f2c does provide them, but they are unnecessary in +a Fortran environment, and you should not expect them to be +there). + +Note that this discussion applies to CHARACTER variables and +arrays _only_. It does _not_ apply to external CHARACTER +functions or to intrinsic CHARACTER functions. That is, no +second `__g77_length_X' argument is passed to FOO in this case: + + CHARACTER X + EXTERNAL X + CALL FOO(X) + +Nor does FOO expect such an argument in this case: + + SUBROUTINE FOO(X) + CHARACTER X + EXTERNAL X + +Because of this implementation detail, if a program has a bug +such that there is disagreement as to whether an argument is +a procedure, and the type of the argument is CHARACTER, subtle +symptoms might appear. + +Adjustable Arrays (The DIMENSION Statement) +------------------------------------------- + +Adjustable and automatic arrays in Fortran require the implementation +(in this case, the g77 compiler) to "memorize" the expressions that +dimension the arrays each time the procedure is invoked. +This is so that subsequent changes to variables used in those +expressions, made during execution of the procedure, do not +have any effect on the dimensions of those arrays. + +For example, given + + REAL ARRAY(5) + DATA ARRAY/5*2/ + CALL X(ARRAY,5) + END + SUBROUTINE X(A,N) + DIMENSION A(N) + N = 20 + PRINT *,N,A + END + +the implementation should, when running the program, print something +like: + + 20 2. 2. 2. 2. 2. + +Note that this shows that while the value of N was successfully +changed, the size of the A array remained at 5 elements. + +To support this, g77 generates code that executes before any user +code (and before the internally generated computed GOTO to handle +alternate entry points, as described below) that evaluates each +(nonconstant) expression in the list of subscripts for an +array, and saves the result of each such evaluation to be used when +determining the size of the array (instead of re-evaluating the +expressions). + +So, in the above example, when X is first invoked, code is +executed that copies the value of N to a temporary. And that +same temporary serves as the actual high bound for the single +dimension of the A array (the low bound being the constant 1). +Since the user program cannot (legitimately) change the value +of the temporary during execution of the procedure, the size +of the array remains constant during each invocation. + +For alternate entry points, the code g77 generates takes into +account the possibility that the adjustable array is not actually +passed to the actual entry point being invoked at that time. +In that case, the public procedure implementing the entry point +passes to the master private procedure implementing all the +code for the entry points a NULL pointer where a pointer to that +adjustable array would be expected. The g77-generated code +doesn't attempt to evaluate any of the expressions in the subscripts +for an array if the pointer to that array is NULL at run time in +such cases. (Don't depend on this particular implementation +by writing code that purposely passes NULL pointers where the +callee expects adjustable arrays, even if you know the callee +won't reference the arrays -- nor should you pass NULL pointers +for any dummy arguments used in calculating the bounds of such +arrays or leave undefined any values used for that purpose in +COMMON -- because the way g77 implements these things might +change in the future!) + +Subroutines (The SUBROUTINE and ENTRY Statements) +------------------------------------------------- + +Subroutines with alternate returns (e.g. "SUBROUTINE X(*)" and +"CALL X(*50)") are implemented by g77 as functions returning +the C `int' type. The actual alternate-return arguments are +omitted from the calling sequence. Instead, the caller uses +the return value to do a rough equivalent of the Fortran +computed-GOTO statement, as in "GOTO (50), X()" in the +example above (where X is quietly declared as an INTEGER +function), and the callee just returns whatever integer +is specified in the RETURN statement for the subroutine +(e.g. "RETURN 1" is implemented as "X = 1" followed by "RETURN" +in C, and "RETURN" by itself is "X = 0" and "RETURN"). + +Functions (The FUNCTION and ENTRY Statements) +--------------------------------------------- + +g77 handles in a special way functions that return the following +types: + +- CHARACTER +- COMPLEX (and DOUBLE COMPLEX) +- REAL + +For CHARACTER, g77 implements a subroutine (a C function returning `void') +with two arguments prepended: `__g77_result', which the caller passes +as a pointer to a `char' array expected to hold the return value, +and `__g77_length', which the caller passes as an `ftnlen' value +specifying the length of the return value as declared in the calling +program. For CHARACTER*(*), the called function uses `__g77_length' +to determine the size of the array that `__g77_result' points to; +otherwise, it ignores that argument. + +For COMPLEX and DOUBLE COMPLEX, when -ff2c is in force, g77 implements +a subroutine with one argument prepended: `__g77_result', which the +caller passes as a pointer to a variable of the type of the function. +The called function writes the return value into this variable instead +of returning it as a function value. When -fno-f2c is in force, +g77 implements gcc's `__complex__ float /* or double */' function, +returning the result of the function in the same way as gcc would. + +For REAL, when -ff2c is in force, g77 implements a function that actually +returns DOUBLE PRECISION (usually C's `double' type). When -fno-f2c +is in force, REAL functions return `float'. + +Common Blocks (The COMMON Statement) +------------------------------------ + +g77 names and lays out COMMON areas the same way f2c does, +for compatibility with f2c. + +Currently, g77 does not emit any debugging information for +items in a COMMON area, due to an apparent bug in the GBE. + +Moreover, g77 will implement a COMMON area such that its +type will be an array of the C `char' data type. + +So, when debugging, you must know the offset into a COMMON area +for a particular item in that area, and you have to take into +account the appropriate multiplier for the respective sizes +of the types (as declared in your code) for the items preceding +the item in question as compared to the size of the `char' type. + +For example, using default implicit typing, the statement + + COMMON I(15),R(20),T + +will result in a public 144-byte `char' array named `_BLNK__' +with I placed at _BLNK__[0], R at _BLNK__[60], and T at +_BLNK__[140]. (This is assuming that the target machine for +the compilation has 4-byte INTEGER and REAL types.) + +Local Equivalence Areas (The EQUIVALENCE Statement) +--------------------------------------------------- + +g77 treats equivalence areas involving a COMMON block as explained +in the section on common blocks. + +A local EQUIVALENCE area is a collection of variables and arrays +connected to each other in any way via EQUIVALENCE, none of which are +listed in a COMMON statement. + +Currently, g77 does not emit any debugging information for +items in a local EQUIVALENCE area, due to an apparent bug in the GBE. + +Moreover, g77 will implement a local EQUIVALENCE area such that its +type will be an array of the C `char' data type. + +The name g77 gives this array of `char' type is `__g77_equiv_X', +where X is the name of the first item listed in the EQUIVALENCE +statements for that area that is placed at the beginning (offset 0) +of this array. + +When debugging, you must therefore access members of EQUIVALENCE +areas by specifying the appropriate __g77_equiv_X array section with +the appropriate offset. See the explanation of debugging COMMON blocks +for info applicable to debugging local EQUIVALENCE areas. + +(NOTE: g77 version 0.5.16 fixed a bug in how certain EQUIVALENCE cases +were handled. The bug caused the debugger to not know the size of the +array if any variable or array in the EQUIVALENCE was given an initial +value via DATA or similar.) + +Alternate Entry Points (The ENTRY Statement) +-------------------------------------------- + +The GNU Back End (GBE) does not understand the general concept of +alternate entry points as Fortran provides via the ENTRY statement. +g77 gets around this by using an approach to compiling procedures +having at least one ENTRY statement that is almost identical to the +approach used by f2c. (An alternate approach could be used that +would probably generate faster, but larger, code that would also +be a bit easier to debug.) + +Information on how g77 implements ENTRY is provided for those +trying to debug such code. The choice of implementation seems +unlikely to affect code (compiled in other languages) that interfaces +to such code. + +g77 compiles exactly one public procedure for the primary entry +point of a procedure plus each ENTRY point it specifies, as usual. +That is, in terms of the public interface, there is no difference +between + + SUBROUTINE X + END + SUBROUTINE Y + END + +and: + + SUBROUTINE X + ENTRY Y + END + +The difference between the above two cases lies in the code compiled +for the X and Y procedures themselves, plus the fact that for the +second case an extra internal procedure is compiled. + +For every Fortran procedure with at least one ENTRY statement, g77 +compiles an extra procedure named `__g77_masterfun_X', where X is +the name of the primary entry point (which, in the above case, +using the standard compiler options, would be `x'). + +This extra procedure is compiled as a private procedure -- that is, +a procedure not accessible by name to separately compiled modules. +It contains all the code in the program unit, including the code +for the primary entry point plus for every entry point. (The code +for each public procedure is quite short, and explained later.) + +The extra procedure has some other interesting characteristics. + +The argument list for this procedure is invented by g77. It contains +a single integer argument named `__g77_which_entrypoint', +passed by value (as in Fortran's %VAL() intrinsic), specifying the +entry point index -- 0 for the primary entry point, 1 for the +first entry point (the first ENTRY statement encountered), 2 for +the second entry point, and so on. + +It also contains, for functions returning CHARACTER and (when -ff2c +is in effect) COMPLEX functions, and for functions returning +different types among the ENTRY statements (e.g. REAL FUNCTION R() +containing ENTRY I()), an argument named `__g77_result' that +is expected at run time to contain a pointer to where to store +the result of the entry point. For CHARACTER functions, this +storage area is an array of the appropriate number of characters; +for COMPLEX functions, it is the appropriate area for the return +type (currently either COMPLEX or DOUBLE COMPLEX); for multiple- +return-type functions, it is a union of all the supported return +types (which cannot include CHARACTER, since combining CHARACTER +and non-character return types via ENTRY in a single function +is not supported by g77). + +For CHARACTER functions, the `__g77_result' argument is followed +by yet another argument named `__g77_length' that, at run time, +specifies the caller's expected length of the returned value. +Note that only CHARACTER*(*) functions and entry points actually +make use of this argument, even though it is always passed by +all callers of public CHARACTER functions (since the caller does not +generally know whether such a function is CHARACTER*(*) or whether +there are any other callers that don't have that information). + +The rest of the argument list is the union of all the arguments +specified for all the entry points (in their usual forms, e.g. +CHARACTER arguments have extra length arguments, all appended at +the end of this list). This is considered the "master list" of +arguments. + +The code for this procedure has, before the code for the first +executable statement, code much like that for the following Fortran +statement: + + GOTO (100000,100001,100002), __g77_which_entrypoint +100000 ...code for primary entry point... +100001 ...code immediately following first ENTRY statement... +100002 ...code immediately following second ENTRY statement... + +(Note that invalid Fortran statement labels and variable names +are used in the above example to highlight the fact that it +represents code generated by the g77 internals, not code to be +written by the user.) + +It is this code that, when the procedure is called, picks which +entry point to start executing. + +Getting back to the public procedures (X and Y in the original +example), those procedures are fairly simple. Their interfaces +are just like they would be if they were self-contained procedures +(without ENTRY), of course, since that is what the callers +expect. Their code consists of simply calling the private +procedure, described above, with the appropriate extra arguments +(the entry point index, and perhaps a pointer to a multiple-type- +return variable, local to the public procedure, that contains +all the supported returnable non-character types). For arguments +that are not listed for a given entry point that are listed for +other entry points, and therefore that are in the "master list" +for the private procedure, null pointers (in C, the NULL macro) +are passed. Also, for entry points that are part of a multiple-type- +returning function, code is compiled after the call of the private +procedure to extract from the multi-type union the appropriate result, +depending on the type of the entry point in question, returning +that result to the original caller. + +When debugging a procedure containing alternate entry points, you +can either set a break point on the public procedure itself (e.g. +a break point on X or Y) or on the private procedure that +contains most of the pertinent code (e.g. __g77_masterfun_x). +If you do the former, you should use the debugger's command to +"step into" the called procedure to get to the actual code; with +the latter approach, the break point leaves you right at the +actual code, skipping over the public entry point and its call +to the private procedure (unless you have set a break point there +as well, of course). + +Further, the list of dummy arguments that is visible when the +private procedure is active is going to be the expanded version +of the list for whichever particular entry point is active, +as explained above, and the way in which return values are +handled might well be different from how they would be handled +for an equivalent single-entry FUNCTION. + +Assigned Statement Labels (The ASSIGN and GOTO Statements) +---------------------------------------------------------- + +For portability to machines where a pointer (such as to a label, +which is how g77 implements ASSIGN and its cousin, the assigned +GOTO) is wider (bitwise) than an INTEGER, g77 does not necessarily +use the same memory location to hold the ASSIGNed value of an +variable as it does the numerical value in that variable unless the +variable is wide enough (can hold enough bits). + +In particular, while g77 will implement + + I = 10 + +as, in C notation, "i = 10;", it might implement + + ASSIGN 10 TO I + +as, in GNU's extended C notation (for the label syntax), +"__g77_ASSIGN_I = &&L10;" (where L10 is just a massaging +of the Fortran label 10 to make the syntax C-like; g77 doesn't +actually generate the name "L10" or any other name like that, +since debuggers cannot access labels anyway). + +While this currently means that an ASSIGN statement might not +overwrite the numeric contents of its target variable, _do not_ +write any code depending on this feature. g77 has already +changed this implementation across versions and might do so +in the future. This information is provided only to make debugging +Fortran programs compiled with the current version of g77 somewhat +easier. If there's no debugger-visible variable named "__g77_ASSIGN_I" +in a program unit that does "ASSIGN 10 TO I", then g77 has decided +it can store the pointer to the label directly into "I" itself. + +(Currently g77 always chooses to make the separate variable, to +improve the likelihood that `-O -Wuninitialized' will diagnose +failures to do things like "GOTO I" without "ASSIGN 10 TO I" +despite doing "I=5".) diff --git a/gnu/usr.bin/gcc/f/INSTALL b/gnu/usr.bin/gcc/f/INSTALL index e95420a101f..01fefceae0d 100644 --- a/gnu/usr.bin/gcc/f/INSTALL +++ b/gnu/usr.bin/gcc/f/INSTALL @@ -38,20 +38,20 @@ follow the `g77' installation instructions: available--in fact, a complete GNU UNIX system can be put together on most systems, if desired. -`gcc-2.7.2.2.tar.gz' +`gcc-2.7.2.tar.gz' You need to have this, or some other applicable, version of `gcc' on your system. The version should be an exact copy of a distribution from the FSF. It is approximately 7MB large. - If you've already unpacked `gcc-2.7.2.2.tar.gz' into a directory - (named `gcc-2.7.2.2') called the "source tree" for `gcc', you can + If you've already unpacked `gcc-2.7.2.tar.gz' into a directory + (named `gcc-2.7.2') called the "source tree" for `gcc', you can delete the distribution itself, but you'll need to remember to skip any instructions to unpack this distribution. Without an applicable `gcc' source tree, you cannot build `g77'. You can obtain an FSF distribution of `gcc' from the FSF. -`g77-0.5.20.tar.gz' +`g77-0.5.19.tar.gz' You probably have already unpacked this distribution, or you are reading an advanced copy of this manual, which is contained in this distribution. This distribution approximately 1MB large. @@ -142,90 +142,61 @@ information on installation problems that can afflict either `gcc' or General Problems ---------------- - These problems can occur on most or all systems. + * On SunOS systems, linking the `f771' program produces an error + message concerning an undefined symbol named `_strtoul'. + + This is not a `g77' bug. *Note Patching GNU Fortran::, for + information on a workaround provided by `g77'. + + The proper fix is either to upgrade your system to one that + provides a complete ANSI C environment, or improve `gcc' so that + it provides one for all the languages and configurations it + supports. + + *Note:* In earlier versions of `g77', an automated workaround for + this problem was attempted. It worked for systems without + `_strtoul', substituting the incomplete-yet-sufficient version + supplied with `g77' for those systems. However, the automated + workaround failed mysteriously for systems that appeared to have + conforming ANSI C environments, and it was decided that, lacking + resources to more fully investigate the problem, it was better to + not punish users of those systems either by requiring them to work + around the problem by hand or by always substituting an incomplete + `strtoul()' implementation when their systems had a complete, + working one. Unfortunately, this meant inconveniencing users of + systems not having `strtoul()', but they're using obsolete (and + generally unsupported) systems anyway. + + * It'd be helpful if `g77''s `Makefile.in' or `Make-lang.in' would + create the various `stageN' directories and their subdirectories, + so expert installers wouldn't have to reconfigure after cleaning + up. -GNU C Required -.............. + * Improvements to the way `libf2c' is built could make building + `g77' as a cross-compiler easier--for example, passing and using + `LD' and `AR' in the appropriate ways. - Compiling `g77' requires GNU C, not just ANSI C. Fixing this -wouldn't be very hard (just tedious), but the code using GNU extensions -to the C language is expected to be rewritten for 0.6 anyway, so there -are no plans for an interim fix. - - This requirement does not mean you must already have `gcc' installed -to build `g77'. As long as you have a working C compiler, you can use a -bootstrap build to automate the process of first building `gcc' using -the working C compiler you have, then building `g77' and rebuilding -`gcc' using that just-built `gcc', and so on. - -Patching GNU CC Necessary -......................... - - `g77' currently requires application of a patch file to the gcc -compiler tree. The necessary patches should be folded in to the -mainline gcc distribution. - - Some combinations of versions of `g77' and `gcc' might actually -*require* no patches, but the patch files will be provided anyway as -long as there are more changes expected in subsequent releases. These -patch files might contain unnecessary, but possibly helpful, patches. -As a result, it is possible this issue might never be resolved, except -by eliminating the need for the person configuring `g77' to apply a -patch by hand, by going to a more automated approach (such as -configure-time patching). - -Building GNU CC Necessary -......................... - - It should be possible to build the runtime without building `cc1' -and other non-Fortran items, but, for now, an easy way to do that is -not yet established. - -Missing strtoul -............... + * `g77' currently requires application of a patch file to the gcc + compiler tree. The necessary patches should be folded in to the + mainline gcc distribution. + + Some combinations of versions of `g77' and `gcc' might actually + *require* no patches, but the patch files will be provided anyway + as long as there are more changes expected in subsequent releases. + These patch files might contain unnecessary, but possibly helpful, + patches. As a result, it is possible this issue might never be + resolved, except by eliminating the need for the person + configuring `g77' to apply a patch by hand, by going to a more + automated approach (such as configure-time patching). + + * It should be possible to build the runtime without building `cc1' + and other non-Fortran items, but, for now, an easy way to do that + is not yet established. - On SunOS4 systems, linking the `f771' program produces an error -message concerning an undefined symbol named `_strtoul'. - - This is not a `g77' bug. *Note Patching GNU Fortran::, for -information on a workaround provided by `g77'. - - The proper fix is either to upgrade your system to one that provides -a complete ANSI C environment, or improve `gcc' so that it provides one -for all the languages and configurations it supports. - - *Note:* In earlier versions of `g77', an automated workaround for -this problem was attempted. It worked for systems without `_strtoul', -substituting the incomplete-yet-sufficient version supplied with `g77' -for those systems. However, the automated workaround failed -mysteriously for systems that appeared to have conforming ANSI C -environments, and it was decided that, lacking resources to more fully -investigate the problem, it was better to not punish users of those -systems either by requiring them to work around the problem by hand or -by always substituting an incomplete `strtoul()' implementation when -their systems had a complete, working one. Unfortunately, this meant -inconveniencing users of systems not having `strtoul()', but they're -using obsolete (and generally unsupported) systems anyway. - -Object File Differences -....................... - - A comparison of object files after building Stage 3 during a -bootstrap build will result in `gcc/f/zzz.o' being flagged as different -from the Stage 2 version. That is because it contains a string with an -expansion of the `__TIME__' macro, which expands to the current time of -day. It is nothing to worry about, since `gcc/f/zzz.c' doesn't contain -any actual code. It does allow you to override its use of `__DATE__' -and `__TIME__' by defining macros for the compilation--see the source -code for details. - -Cleanup Kills Stage Directories -............................... - - It'd be helpful if `g77''s `Makefile.in' or `Make-lang.in' would -create the various `stageN' directories and their subdirectories, so -developers and expert installers wouldn't have to reconfigure after -cleaning up. + * Compiling `g77' requires GNU C, not just ANSI C. Fixing this + wouldn't be very hard (just tedious), but the code using GNU + extensions to the C language is expected to be rewritten for 0.6 + anyway, so there are no plans for an interim fix. Cross-compiler Problems ----------------------- @@ -261,178 +232,12 @@ reasons. combinations of machines. For example, it might not know how to handle floating-point constants. - * Improvements to the way `libf2c' is built could make building - `g77' as a cross-compiler easier--for example, passing and using - `LD' and `AR' in the appropriate ways. - * There are still some challenges putting together the right run-time libraries (needed by `libf2c') for a target system, depending on the systems involved in the configuration. (This is a general problem with cross-compilation, and with `gcc' in particular.) -Changing Settings Before Building -================================= - - Here are some internal `g77' settings that can be changed by editing -source files in `gcc/f/' before building. - - This information, and perhaps even these settings, represent -stop-gap solutions to problems people doing various ports of `g77' have -encountered. As such, none of the following information is expected to -be pertinent in future versions of `g77'. - -Larger File Unit Numbers ------------------------- - - As distributed, whether as part of `f2c' or `g77', `libf2c' accepts -file unit numbers only in the range 0 through 99. For example, a -statement such as `WRITE (UNIT=100)' causes a run-time crash in -`libf2c', because the unit number, 100, is out of range. - - If you know that Fortran programs at your installation require the -use of unit numbers higher than 99, you can change the value of the -`MXUNIT' macro, which represents the maximum unit number, to an -appropriately higher value. - - To do this, edit the file `f/runtime/libI77/fio.h' in your `g77' -source tree, changing the following line: - - #define MXUNIT 100 - - Change the line so that the value of `MXUNIT' is defined to be at -least one *greater* than the maximum unit number used by the Fortran -programs on your system. - - (For example, a program that does `WRITE (UNIT=255)' would require -`MXUNIT' set to at least 256 to avoid crashing.) - - Then build or rebuild `g77' as appropriate. - - *Note:* Changing this macro has *no* effect on other limits your -system might place on the number of files open at the same time. That -is, the macro might allow a program to do `WRITE (UNIT=100)', but the -library and operating system underlying `libf2c' might disallow it if -many other files have already been opened (via `OPEN' or implicitly via -`READ', `WRITE', and so on). Information on how to increase these -other limits should be found in your system's documentation. - -Always Flush Output -------------------- - - Some Fortran programs require output (writes) to be flushed to the -operating system (under UNIX, via the `fflush()' library call) so that -errors, such as disk full, are immediately flagged via the relevant -`ERR=' and `IOSTAT=' mechanism, instead of such errors being flagged -later as subsequent writes occur, forcing the previously written data -to disk, or when the file is closed. - - Essentially, the difference can be viewed as synchronous error -reporting (immediate flagging of errors during writes) versus -asynchronous, or, more precisely, buffered error reporting (detection -of errors might be delayed). - - `libf2c' supports flagging write errors immediately when it is built -with the `ALWAYS_FLUSH' macro defined. This results in a `libf2c' that -runs slower, sometimes quite a bit slower, under certain -circumstances--for example, accessing files via the networked file -system NFS--but the effect can be more reliable, robust file I/O. - - If you know that Fortran programs requiring this level of precision -of error reporting are to be compiled using the version of `g77' you -are building, you might wish to modify the `g77' source tree so that -the version of `libf2c' is built with the `ALWAYS_FLUSH' macro defined, -enabling this behavior. - - To do this, find this line in `f/runtime/configure.in' in your `g77' -source tree: - - dnl AC_DEFINE(ALWAYS_FLUSH) - - Remove the leading `dnl ', so the line begins with `AC_DEFINE(', and -run `autoconf' in that file's directory. (Or, if you don't have -`autoconf', you can modify `f2c.h.in' in the same directory to include -the line `#define ALWAYS_FLUSH' after `#define F2C_INCLUDE'.) - - Then build or rebuild `g77' as appropriate. - -Maximum Stackable Size ----------------------- - - `g77', on most machines, puts many variables and arrays on the stack -where possible, and can be configured (by changing -`FFECOM_sizeMAXSTACKITEM' in `gcc/f/com.c') to force smaller-sized -entities into static storage (saving on stack space) or permit -larger-sized entities to be put on the stack (which can improve -run-time performance, as it presents more opportunities for the GBE to -optimize the generated code). - - *Note:* Putting more variables and arrays on the stack might cause -problems due to system-dependent limits on stack size. Also, the value -of `FFECOM_sizeMAXSTACKITEM' has no effect on automatic variables and -arrays. *Note But-bugs::, for more information. - -Floating-point Bit Patterns ---------------------------- - - The `g77' build will crash if an attempt is made to build it as a -cross-compiler for a target when `g77' cannot reliably determine the -bit pattern of floating-point constants for the target. Planned -improvements for g77-0.6 will give it the capabilities it needs to not -have to crash the build but rather generate correct code for the target. -(Currently, `g77' would generate bad code under such circumstances if -it didn't crash during the build, e.g. when compiling a source file -that does something like `EQUIVALENCE (I,R)' and `DATA R/9.43578/'.) - -Initialization of Large Aggregate Areas ---------------------------------------- - - A warning message is issued when `g77' sees code that provides -initial values (e.g. via `DATA') to an aggregate area (`COMMON' or -`EQUIVALENCE', or even a large enough array or `CHARACTER' variable) -that is large enough to increase `g77''s compile time by roughly a -factor of 10. - - This size currently is quite small, since `g77' currently has a -known bug requiring too much memory and time to handle such cases. In -`gcc/f/data.c', the macro `FFEDATA_sizeTOO_BIG_INIT_' is defined to the -minimum size for the warning to appear. The size is specified in -storage units, which can be bytes, words, or whatever, on a -case-by-case basis. - - After changing this macro definition, you must (of course) rebuild -and reinstall `g77' for the change to take effect. - - Note that, as of version 0.5.18, improvements have reduced the scope -of the problem for *sparse* initialization of large arrays, especially -those with large, contiguous uninitialized areas. However, the warning -is issued at a point prior to when `g77' knows whether the -initialization is sparse, and delaying the warning could mean it is -produced too late to be helpful. - - Therefore, the macro definition should not be adjusted to reflect -sparse cases. Instead, adjust it to generate the warning when densely -initialized arrays begin to cause responses noticeably slower than -linear performance would suggest. - -Alpha Problems Fixed --------------------- - - `g77' used to warn when it was used to compile Fortran code for a -target configuration that is not basically a 32-bit machine (such as an -Alpha, which is a 64-bit machine, especially if it has a 64-bit -operating system running on it). That was because `g77' was known to -not work properly on such configurations. - - As of version 0.5.20, `g77' is believed to work well enough on such -systems. So, the warning is no longer needed or provided. - - However, support for 64-bit systems, especially in areas such as -cross-compilation and handling of intrinsics, is still incomplete. The -symptoms are believed to be compile-time diagnostics rather than the -generation of bad code. It is hoped that version 0.6 will completely -support 64-bit systems. - Quick Start =========== @@ -453,14 +258,16 @@ is assumed that the source distributions themselves already reside in `/usr/FSF', a naming convention used by the author of `g77' on his own system: - /usr/FSF/gcc-2.7.2.2.tar.gz - /usr/FSF/g77-0.5.20.tar.gz + /usr/FSF/gcc-2.7.2.tar.gz + /usr/FSF/g77-0.5.19.tar.gz Users of the following systems should not blindly follow these quick-start instructions, because of problems their systems have coping with straightforward installation of `g77': - * SunOS4 + * SunOS + + * Alpha Instead, see *Note Complete Installation::, for detailed information on how to configure, build, and install `g77' for your particular @@ -477,49 +284,49 @@ of some of the steps. These explanations follow this list of steps. sh[ 1]# cd /usr/src - sh[ 2]# gunzip -c < /usr/FSF/gcc-2.7.2.2.tar.gz | tar xf - + sh[ 2]# gunzip -c < /usr/FSF/gcc-2.7.2.tar.gz | tar xf - + [Might say "Broken pipe"...that is normal on some systems.] + sh[ 3]# gunzip -c < /usr/FSF/g77-0.5.19.tar.gz | tar xf - - sh[ 3]# gunzip -c < /usr/FSF/g77-0.5.20.tar.gz | tar xf - ["Broken pipe" again possible.] + sh[ 4]# ln -s gcc-2.7.2 gcc - sh[ 4]# ln -s gcc-2.7.2.2 gcc - - sh[ 5]# ln -s g77-0.5.20 g77 + sh[ 5]# ln -s g77-0.5.19 g77 sh[ 6]# mv -i g77/* gcc + [No questions should be asked by mv here; or, you made a mistake.] + sh[ 7]# patch -p1 -V t -d gcc-2.7.2 < gcc-2.7.2/f/gbe/2.7.2.diff - sh[ 7]# patch -p1 -V t -d gcc < gcc/f/gbe/2.7.2.2.diff [Unless patch complains about rejected patches, this step worked.] - sh[ 8]# cd gcc sh[ 9]# touch f77-install-ok + [Do not do the above if your system already has an f77 command, unless you've checked that overwriting it is okay.] - sh[10]# touch f2c-install-ok + [Do not do the above if your system already has an f2c command, unless you've checked that overwriting it is okay. Else, touch f2c-exists-ok.] - sh[11]# ./configure --prefix=/usr + [Do not do the above if gcc is not installed in /usr/bin. You might need a different --prefix=..., as described below.] - sh[12]# make bootstrap - [This takes a long time, and is where most problems occur.] + [This takes a long time, and is where most problems occur.] sh[13]# rm -fr stage1 sh[14]# make -k install - [The actual installation.] + [The actual installation.] sh[15]# g77 -v - [Verify that g77 is installed, obtain version info.] + [Verify that g77 is installed, obtain version info.] sh[16]# *Note Updating Your Info Directory: Updating Documentation, for @@ -535,16 +342,8 @@ Step 1: `cd /usr/src' your system knew where to look for the source code for the installed version of `g77' and `gcc' in any case. -Step 3: `gunzip -d < /usr/FSF/g77-0.5.20.tar.gz | tar xf -' - It is not always necessary to obtain the latest version of `g77' - as a complete `.tar.gz' file if you have a complete, earlier - distribution of `g77'. If appropriate, you can unpack that earlier - version of `g77', and then apply the appropriate patches to - achieve the same result--a source tree containing version 0.5.20 - of `g77'. - -Step 4: `ln -s gcc-2.7.2.2 gcc' -Step 5: `ln -s g77-0.5.20 g77' +Step 4: `ln -s gcc-2.7.2 gcc' +Step 5: `ln -s g77-0.5.19 g77' These commands mainly help reduce typing, and help reduce visual clutter in examples in this manual showing what to type to install `g77'. @@ -554,7 +353,7 @@ Step 5: `ln -s g77-0.5.20 g77' Step 6: `mv -i g77/* gcc' After doing this, you can, if you like, type `rm g77' and `rmdir - g77-0.5.20' to remove the empty directory and the symbol link to + g77-0.5.19' to remove the empty directory and the symbol link to it. But, it might be helpful to leave them around as quick reminders of which version(s) of `g77' are installed on your system. @@ -608,7 +407,7 @@ Step 11: `./configure --prefix=/usr' it does not fully replace the existing installation of `gcc' is likely to result in the inability to compile Fortran programs. - *Note Where in the World Does Fortran (and GNU CC) Go?: Where to + *Note Where in the World Does Fortran (and GNU C) Go?: Where to Install, for more information on determining where to install `g77'. *Note Configuring gcc::, for more information on the configuration process triggered by invoking the `./configure' @@ -635,46 +434,6 @@ Step 14: `make -k install' information on entering this manual into your system's list of texinfo manuals. -Step 15: `g77 -v' - If this command prints approximately 25 lines of output, including - the GNU Fortran Front End version number (which should be the same - as the version number for the version of `g77' you just built and - installed) and the version numbers for the three parts of the - `libf2c' library (`libF77', `libI77', `libU77'), and those version - numbers are all in agreement, then there is a high likelihood that - the installation has been successfully completed. - - You might consider doing further testing. For example, log in as - a non-privileged user, then create a small Fortran program, such - as: - - PROGRAM SMTEST - DO 10 I=1, 10 - PRINT *, 'Hello World #', I - 10 CONTINUE - END - - Compile, link, and run the above program, and, assuming you named - the source file `smtest.f', the session should look like this: - - sh# g77 -o smtest smtest.f - sh# ./smtest - Hello World # 1 - Hello World # 2 - Hello World # 3 - Hello World # 4 - Hello World # 5 - Hello World # 6 - Hello World # 7 - Hello World # 8 - Hello World # 9 - Hello World # 10 - sh# - - After proper installation, you don't need to keep your gcc and g77 - source and build directories around anymore. Removing them can - free up a lot of disk space. - Complete Installation ===================== @@ -703,10 +462,10 @@ generally only the documentation is immediately usable. A sequence of commands typically used to unpack `gcc' and `g77' is: sh# cd /usr/src - sh# gunzip -d < /usr/FSF/gcc-2.7.2.2.tar.gz | tar xf - - sh# gunzip -d < /usr/FSF/g77-0.5.20.tar.gz | tar xf - - sh# ln -s gcc-2.7.2.2 gcc - sh# ln -s g77-0.5.20 g77 + sh# gunzip -d < /usr/FSF/gcc-2.7.2.tar.gz | tar xf - + sh# gunzip -d < /usr/FSF/g77-0.5.19.tar.gz | tar xf - + sh# ln -s gcc-2.7.2 gcc + sh# ln -s g77-0.5.19 g77 sh# mv -i g77/* gcc *Notes:* The commands beginning with `gunzip...' might print `Broken @@ -725,7 +484,7 @@ and the top level of just the `g77' source tree (prior to issuing the All three entries should be moved (or copied) into a `gcc' source tree (typically named after its version number and as it appears in the -FSF distributions--e.g. `gcc-2.7.2.2'). +FSF distributions--e.g. `gcc-2.7.2'). `g77/f' is the subdirectory containing all of the code, documentation, and other information that is specific to `g77'. The @@ -770,7 +529,7 @@ fact that there are some differences. version of a distribution is newer or older than some other version of that distribution. The format is, generally, MAJOR.MINOR.PATCH, with each field being a decimal number. (You can safely ignore leading -zeros; for example, 1.5.3 is the same as 1.5.03.) The MAJOR field only +zeros; for example, 1.5.3 is the same as 1.5.03.) The MAJOR field only increases with time. The other two fields are reset to 0 when the field to their left is incremented; otherwise, they, too, only increase with time. So, version 2.6.2 is newer than version 2.5.8, and version @@ -938,22 +697,21 @@ and change the definition of the `F2CLIBOK' macro appropriately. Patching GNU Fortran -------------------- - If you're using a SunOS4 system, you'll need to make the following + If you're using a SunOS system, you'll need to make the following change to `gcc/f/proj.h': edit the line reading #define FFEPROJ_STRTOUL 1 ... by replacing the `1' with `0'. Or, you can avoid editing the source by adding - CFLAGS='-DFFEPROJ_STRTOUL=0 -g -O' + CFLAGS='-DFFEPROJ_STRTOUL=0 -g' to the command line for `make' when you invoke it. (`-g' is the default for `CFLAGS'.) This causes a minimal version of `strtoul()' provided as part of the `g77' distribution to be compiled and linked into whatever `g77' -programs need it, since some systems (like SunOS4 with only the bundled -compiler and its runtime) do not provide this function in their system -libraries. +programs need it, since some systems (like SunOS) do not provide this +function in their system libraries. Similarly, a minimal version of `bsearch()' is available and can be enabled by editing a line similar to the one for `strtoul()' above in @@ -969,8 +727,8 @@ provide one to all `gcc'-based compilers in future `gcc' distributions. comes up missing and on approaches to dealing with this problem that have already been tried. -Where in the World Does Fortran (and GNU CC) Go? ------------------------------------------------- +Where in the World Does Fortran (and GNU C) Go? +----------------------------------------------- Before configuring, you should make sure you know where you want the `g77' and `gcc' binaries to be installed after they're built, because @@ -987,7 +745,7 @@ the system. Sometimes people make the mistake of installing `gcc' as `/usr/local/bin/gcc', leaving an older, non-Fortran-aware version in -`/usr/bin/gcc'. (Or, the opposite happens.) This can result in `g77' +`/usr/bin/gcc'. (Or, the opposite happens.) This can result in `g77' being unable to compile Fortran source files, because when it calls on `gcc' to do the actual compilation, `gcc' complains that it does not recognize the language, or the file name suffix. @@ -1133,13 +891,16 @@ large number of object files to ensure they're identical). you can type `rm -fr stage1' to remove the binaries built during Stage 1. - *Note:* *Note Object File Differences::, for information on expected -differences in object files produced during Stage 2 and Stage 3 of a -bootstrap build. These differences will be encountered as a result of -using the `make compare' or similar command sequence recommended by the -GNU CC installation documentation. + *Note:* If you do build Stage 3 and you compare the object files +produced by various stages, the file `gcc/f/zzz.o' *will* be different. +That is because it contains a string with an expansion of the +`__TIME__' macro, which expands to the current time of day. It is +nothing to worry about, since `gcc/f/zzz.c' doesn't contain any actual +code. It does allow you to override its use of `__DATE__' and +`__TIME__' by defining macros for the compilation--see the source code +for details. - Also, *Note Installing GNU CC: (gcc)Installation, for important + *Note Installing GNU CC: (gcc)Installation, for important information on building `gcc' that is not described in this `g77' manual. For example, explanations of diagnostic messages and whether they're expected, or indicate trouble, are found there. @@ -1190,51 +951,43 @@ them when they work: sh# cd /usr/src/gcc sh# ./g77 --driver=./xgcc -B./ -v - g77 version 0.5.20 - ./xgcc -B./ -v -fnull-version -o /tmp/gfa18047 ... + ./xgcc -B./ -v -fnull-version -o /tmp/gfa03648 ... Reading specs from ./specs - gcc version 2.7.2.2.f.2 + gcc version 2.7.1 ./cpp -lang-c -v -isystem ./include -undef ... - GNU CPP version 2.7.2.2.f.2 (Linux/Alpha) + GNU CPP version 2.7.1 (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: ./include - /usr/local/include - /usr/alpha-unknown-linux/include - /usr/lib/gcc-lib/alpha-unknown-linux/2.7.2.2.f.2/include + /usr/include + /usr/i486-unknown-linuxaout/include + /usr/lib/gcc-lib/i486-unknown-linuxaout/2.7.1/include /usr/include End of search list. - ./f771 /tmp/cca18048.i -fset-g77-defaults -quiet -dumpbase ... - GNU F77 version 2.7.2.2.f.2 (Linux/Alpha) compiled ... - GNU Fortran Front End version 0.5.20-970224 compiled: ... - as -nocpp -o /tmp/cca180481.o /tmp/cca18048.s - ld -G 8 -O1 -o /tmp/gfa18047 /usr/lib/crt0.o -L. ... - __G77_LIBF77_VERSION__: 0.5.20 - @(#)LIBF77 VERSION 19960619 - __G77_LIBI77_VERSION__: 0.5.20 - @(#) LIBI77 VERSION pjw,dmg-mods 19961209 - __G77_LIBU77_VERSION__: 0.5.20 - @(#) LIBU77 VERSION 19970204 + ./f771 /tmp/cca03648.i -quiet -dumpbase null.F -version ... + GNU F77 version 2.7.1 (80386, BSD syntax) compiled ... + GNU Fortran Front End version 0.5.19 compiled: ... + as -o /tmp/cca036481.o /tmp/cca03648.s + ld -m i386linux -o /tmp/gfa03648 /usr/lib/crt0.o -L. ... + /usr/lib/crt0.o(.text+0x35): undefined reference to `main' sh# ./xgcc -B./ -v -o /tmp/delete-me -xc /dev/null -xnone Reading specs from ./specs - gcc version 2.7.2.2.f.2 + gcc version 2.7.1 ./cpp -lang-c -v -isystem ./include -undef ... - GNU CPP version 2.7.2.2.f.2 (Linux/Alpha) + GNU CPP version 2.7.1 (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: ./include - /usr/local/include - /usr/alpha-unknown-linux/include - /usr/lib/gcc-lib/alpha-unknown-linux/2.7.2.2.f.2/include + /usr/include + /usr/i486-unknown-linuxaout/include + /usr/lib/gcc-lib/i486-unknown-linuxaout/2.7.1/include /usr/include End of search list. - ./cc1 /tmp/cca18063.i -quiet -dumpbase null.c -version ... - GNU C version 2.7.2.2.f.2 (Linux/Alpha) compiled ... - as -nocpp -o /tmp/cca180631.o /tmp/cca18063.s - ld -G 8 -O1 -o /tmp/delete-me /usr/lib/crt0.o -L. ... - /usr/lib/crt0.o: In function `__start': - crt0.S:110: undefined reference to `main' - /usr/lib/crt0.o(.lita+0x28): undefined reference to `main' + ./cc1 /tmp/cca03659.i -quiet -dumpbase null.c -version ... + GNU C version 2.7.1 (80386, BSD syntax) compiled ... + as -o /tmp/cca036591.o /tmp/cca03659.s + ld -m i386linux -o /tmp/delete-me /usr/lib/crt0.o -L. ... + /usr/lib/crt0.o(.text+0x35): undefined reference to `main' sh# (Note that long lines have been truncated, and `...' used to @@ -1242,11 +995,13 @@ indicate such truncations.) The above two commands test whether `g77' and `gcc', respectively, are able to compile empty (null) source files, whether invocation of -the C preprocessor works, whether libraries can be linked, and so on. +the C preprocessor works, whether libraries can be linked (even though +there is an undefined reference due to there being no main program +unit), and so on. If the output you get from either of the above two commands is -noticeably different, especially if it is shorter or longer in ways -that do not look consistent with the above sample output, you probably +noticably different, especially if it is shorter or longer in ways that +do not look consistent with the above sample output, you probably should not install `gcc' and `g77' until you have investigated further. For example, you could try compiling actual applications and seeing @@ -1294,7 +1049,7 @@ the above command.) Note that using the `-k' option tells `make' to continue after some installation problems, like not having `makeinfo' installed on your -system. It might not be necessary for your system. +system. It might not be necessary. Updating Your Info Directory ---------------------------- @@ -1308,9 +1063,7 @@ the top-level file in the `info' directory on your system (perhaps * g77: (g77). The GNU Fortran programming language. If the menu in `dir' is organized into sections, `g77' probably -belongs in a section with a name such as one of the following: - - * Fortran Programming +belongs in a section with a name such as the following: * Writing Programs @@ -1422,9 +1175,7 @@ binaries you distribute include: not get overwritten. `info/g77.info*' - This is the documentation for `g77'. If it is not included, users - will have trouble understanding diagnostics messages and other - such things, and will send you a lot of email asking questions. + This is the documentation for `g77'. Please edit this documentation (by editing `gcc/f/*.texi' and doing `make doc' from the `/usr/src/gcc' directory) to reflect any @@ -1439,8 +1190,7 @@ binaries you distribute include: Documentation. `man/man1/g77.1' - This is the short man page for `g77'. It is out of date, but you - might as well include it for people who really like man pages. + This is the short man page for `g77'. `man/man1/f77.1' In installations where `f77' is the same as `g77', this is the @@ -1476,9 +1226,92 @@ general) are broken, at least for their system. until you're sure your distribution is widely used and has been well tested. This especially goes for those of you making any changes to the `g77' sources to port `g77', e.g. to OS/2. - has received a fair number of bug reports that +`fortran@gnu.ai.mit.edu' has received a fair amount of bug reports that turned out to be problems with other peoples' ports and distributions, about which nothing could be done for the user. Once you are quite certain a bug report does not involve your efforts, you can forward it to us. +Changing Settings Before Building +================================= + + Here are some internal `g77' settings that can be changed by editing +source files in `gcc/f/' before building. + + This information, and perhaps even these settings, represent +stop-gap solutions to problems people doing various ports of `g77' have +encountered. As such, none of the following information is expected to +be pertinent in future versions of `g77'. + +Maximum Stackable Size +---------------------- + + `g77', on most machines, puts many variables and arrays on the stack +where possible, and can be configured (by changing +`FFECOM_sizeMAXSTACKITEM' in `gcc/f/com.c') to force smaller-sized +entities into static storage (saving on stack space) or permit +larger-sized entities to be put on the stack (which can improve +run-time performance, as it presents more opportunities for the GBE to +optimize the generated code). + + *Note:* Putting more variables and arrays on the stack might cause +problems due to system-dependent limits on stack size. Also, the value +of `FFECOM_sizeMAXSTACKITEM' has no effect on automatic variables and +arrays. *Note But-bugs::, for more information. + +Floating-point Bit Patterns +--------------------------- + + The `g77' build will crash if an attempt is made to build it as a +cross-compiler for a target when `g77' cannot reliably determine the +bit pattern of floating-point constants for the target. Planned +improvements for g77-0.6 will give it the capabilities it needs to not +have to crash the build but rather generate correct code for the target. +(Currently, `g77' would generate bad code under such circumstances if +it didn't crash during the build, e.g. when compiling a source file +that does something like `EQUIVALENCE (I,R)' and `DATA R/9.43578/'.) + +Initialization of Large Aggregate Areas +--------------------------------------- + + A warning message is issued when `g77' sees code that provides +initial values (e.g. via `DATA') to an aggregate area (`COMMON' or +`EQUIVALENCE', or even a large enough array or `CHARACTER' variable) +that is large enough to increase `g77''s compile time by roughly a +factor of 10. + + This size currently is quite small, since `g77' currently has a +known bug requiring too much memory and time to handle such cases. In +`gcc/f/data.c', the macro `FFEDATA_sizeTOO_BIG_INIT_' is defined to the +minimum size for the warning to appear. The size is specified in +storage units, which can be bytes, words, or whatever, on a +case-by-case basis. + + After changing this macro definition, you must (of course) rebuild +and reinstall `g77' for the change to take effect. + + Note that, as of version 0.5.18, improvements have reduced the scope +of the problem for *sparse* initialization of large arrays, especially +those with large, contiguous uninitialized areas. However, the warning +is issued at a point prior to when `g77' knows whether the +initialization is sparse, and delaying the warning could mean it is +produced too late to be helpful. + + Therefore, the macro definition should not be adjusted to reflect +sparse cases. Instead, adjust it to generate the warning when densely +initialized arrays begin to cause responses noticably slower than +linear performance would suggest. + +Alpha Problems +-------------- + + `g77' might warn when it is used to compile Fortran code for a +target configuration that is not basically a 32-bit machine (such as an +Alpha, which is a 64-bit machine, especially if it has a 64-bit +operating system running on it). This is because `g77' is known to not +work properly on such configurations. This is expected to be +completely fixed at 0.6, at which point the warning would be dropped. + + (Version 0.5.20 is expected to solve most of these problems, though, +as of this writing, work is still progressing in this area.) + diff --git a/gnu/usr.bin/gcc/f/Make b/gnu/usr.bin/gcc/f/Make new file mode 100644 index 00000000000..af29add2383 --- /dev/null +++ b/gnu/usr.bin/gcc/f/Make @@ -0,0 +1,244 @@ +# Makefile for GNU F77 stand-alone front end. +# Copyright (C) 1995 Free Software Foundation, Inc. +# Contributed by James Craig Burley (burley@gnu.ai.mit.edu). + +#This file is part of GNU Fortran. + +#GNU Fortran is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 2, or (at your option) +#any later version. + +#GNU Fortran is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +#You should have received a copy of the GNU General Public License +#along with GNU Fortran; see the file COPYING. If not, write to +#the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +#02111-1307, USA. + +objs=\ +parse.o \ +bad.o \ +bit.o \ +bld.o \ +com.o \ +data.o \ +equiv.o \ +expr.o \ +global.o \ +implic.o \ +info.o \ +intrin.o \ +lab.o \ +lex.o \ +malloc.o \ +name.o \ +proj.o \ +src.o \ +st.o \ +sta.o \ +stb.o \ +stc.o \ +std.o \ +ste.o \ +storag.o \ +stp.o \ +str.o \ +sts.o \ +stt.o \ +stu.o \ +stv.o \ +stw.o \ +symbol.o \ +target.o \ +top.o \ +where.o \ +zzz.o + +# Use appropriate compiler and options. -Wall will produce complaints about +# certain "fuzzy" (but hand-checked) uses of uninitialized variables, and +# other annoying warnings about uses of assert if assert.h doesn't specify +# it as volatile (effectively). -DNO_STDLIB is needed only on systems where +# including won't work (not found or doesn't contain the good +# stuff ANSI says it must). Similarly, -DLAME_STDIO is needed only on +# systems where the varying-args functions aren't prototyped and you want to +# catch references to non-prototyped functions. And -DLAME_ASSERT is needed +# if the assert macro is not defined as volatile, effectively, but you +# want to catch certain other warnings. -DFFE_STANDALONE is what builds +# the front end in stand-alone mode; otherwise it tries to build as GNU +# Fortran (i.e. with the GNU back end). + +CC=gcc +CFLAGS=-O6 -g -Wall + +ffe: cktyps.out $(objs) + $(CC) $(CFLAGS) -DFFE_STANDALONE -o ffe $(objs) + +cktyps.out: cktyps + ./cktyps > cktyps.out + +cktyps: cktyps.o proj.o + $(CC) $(CFLAGS) -DFFE_STANDALONE -o cktyps cktyps.o proj.o + +# Begin results obtained from "make -f Make deps-kinda". +# Note that this command uses the host C compiler; use CC="./xgcc -B./" to +# use GCC in the build directory, for example. + +bad.o : bad.c proj.h malloc.h bad.h bad.def where.h top.h com.h bld.h bld-op.def \ + bit.h info.h info-b.def info-k.def info-w.def target.h lex.h intrin.h intrin.def \ + lab.h symbol.h symbol.def equiv.h storag.h global.h name.h +bit.o : bit.c proj.h malloc.h bit.h +bld.o : bld.c proj.h malloc.h bld.h bld-op.def bit.h com.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def +cktyps.o : cktyps.c proj.h malloc.h target.h bad.h bad.def where.h top.h info.h \ + info-b.def info-k.def info-w.def lex.h +com.o : com.c proj.h malloc.h com.h bld.h bld-op.def bit.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h intrin.h intrin.def \ + lab.h symbol.h symbol.def equiv.h storag.h global.h name.h expr.h implic.h src.h \ + st.h +data.o : data.c proj.h malloc.h data.h bld.h bld-op.def bit.h com.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def expr.h st.h +equiv.o : equiv.c proj.h malloc.h equiv.h bld.h bld-op.def bit.h com.h info.h \ + info-b.def info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h \ + lab.h storag.h symbol.h symbol.def global.h name.h intrin.h intrin.def data.h +expr.o : expr.c proj.h malloc.h expr.h bld.h bld-op.def bit.h com.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def implic.h src.h \ + st.h +fini.o : fini.c proj.h malloc.h +g77.o : g77.c config.h +global.o : global.c proj.h malloc.h global.h lex.h top.h where.h name.h symbol.h \ + symbol.def bad.h bad.def bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def \ + info-w.def target.h lab.h storag.h intrin.h intrin.def equiv.h +implic.o : implic.c proj.h malloc.h implic.h info.h info-b.def info-k.def info-w.def \ + target.h bad.h bad.def where.h top.h lex.h symbol.h symbol.def bld.h bld-op.def \ + bit.h com.h lab.h storag.h intrin.h intrin.def equiv.h global.h name.h src.h +info.o : info.c proj.h malloc.h info.h info-b.def info-k.def info-w.def target.h \ + bad.h bad.def where.h top.h lex.h +intrin.o : intrin.c proj.h malloc.h intrin.h intrin.def bld.h bld-op.def bit.h \ + com.h info.h info-b.def info-k.def info-w.def target.h bad.h bad.def where.h \ + top.h lex.h lab.h storag.h symbol.h symbol.def equiv.h global.h name.h src.h +lab.o : lab.c proj.h malloc.h lab.h com.h bld.h bld-op.def bit.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h intrin.h intrin.def \ + symbol.h symbol.def equiv.h storag.h global.h name.h +lex.o : lex.c proj.h malloc.h top.h where.h bad.h bad.def lex.h src.h +malloc.o : malloc.c proj.h malloc.h +name.o : name.c proj.h malloc.h bad.h bad.def where.h top.h name.h global.h \ + lex.h symbol.h symbol.def bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def \ + info-w.def target.h lab.h storag.h intrin.h intrin.def equiv.h src.h +parse.o : parse.c proj.h malloc.h top.h where.h com.h bld.h bld-op.def bit.h \ + info.h info-b.def info-k.def info-w.def target.h bad.h bad.def lex.h intrin.h \ + intrin.def lab.h symbol.h symbol.def equiv.h storag.h global.h name.h zzz.h +proj.o : proj.c proj.h malloc.h +src.o : src.c proj.h malloc.h src.h bad.h bad.def where.h top.h +st.o : st.c proj.h malloc.h st.h bad.h bad.def where.h top.h lex.h symbol.h \ + symbol.def bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def info-w.def \ + target.h lab.h storag.h intrin.h intrin.def equiv.h global.h name.h sta.h stamp-str \ + stb.h expr.h stp.h stt.h stc.h std.h stv.h stw.h ste.h sts.h stu.h +sta.o : sta.c proj.h malloc.h sta.h bad.h bad.def where.h top.h lex.h stamp-str \ + symbol.h symbol.def bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def \ + info-w.def target.h lab.h storag.h intrin.h intrin.def equiv.h global.h name.h \ + implic.h stb.h expr.h stp.h stt.h stc.h std.h stv.h stw.h +stb.o : stb.c proj.h malloc.h stb.h bad.h bad.def where.h top.h expr.h bld.h \ + bld-op.def bit.h com.h info.h info-b.def info-k.def info-w.def target.h lex.h \ + lab.h storag.h symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def \ + stp.h stt.h stamp-str src.h sta.h stc.h +stc.o : stc.c proj.h malloc.h stc.h bad.h bad.def where.h top.h bld.h bld-op.def \ + bit.h com.h info.h info-b.def info-k.def info-w.def target.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def expr.h stp.h \ + stt.h stamp-str data.h implic.h src.h sta.h std.h stv.h stw.h +std.o : std.c proj.h malloc.h std.h bld.h bld-op.def bit.h com.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def stp.h stt.h \ + stamp-str stv.h stw.h sta.h ste.h sts.h +ste.o : ste.c proj.h malloc.h ste.h bld.h bld-op.def bit.h com.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def stp.h stt.h \ + stamp-str sts.h stv.h stw.h sta.h +storag.o : storag.c proj.h malloc.h storag.h bld.h bld-op.def bit.h com.h info.h \ + info-b.def info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h \ + lab.h symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def data.h +stp.o : stp.c proj.h malloc.h stp.h bld.h bld-op.def bit.h com.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def stt.h +str.o : str.c proj.h malloc.h src.h bad.h bad.def where.h top.h stamp-str lex.h +sts.o : sts.c proj.h malloc.h sts.h com.h bld.h bld-op.def bit.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h intrin.h intrin.def \ + lab.h symbol.h symbol.def equiv.h storag.h global.h name.h +stt.o : stt.c proj.h malloc.h stt.h top.h where.h bld.h bld-op.def bit.h com.h \ + info.h info-b.def info-k.def info-w.def target.h bad.h bad.def lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def stp.h expr.h \ + sta.h stamp-str +stu.o : stu.c proj.h malloc.h bld.h bld-op.def bit.h com.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def implic.h stu.h \ + sta.h stamp-str +stv.o : stv.c proj.h malloc.h stv.h lab.h com.h bld.h bld-op.def bit.h info.h \ + info-b.def info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h \ + intrin.h intrin.def symbol.h symbol.def equiv.h storag.h global.h name.h +stw.o : stw.c proj.h malloc.h stw.h bld.h bld-op.def bit.h com.h info.h info-b.def \ + info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def stv.h sta.h \ + stamp-str +symbol.o : symbol.c proj.h malloc.h symbol.h symbol.def bad.h bad.def where.h \ + top.h bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def info-w.def target.h \ + lex.h lab.h storag.h intrin.h intrin.def equiv.h global.h name.h src.h st.h +target.o : target.c proj.h malloc.h target.h bad.h bad.def where.h top.h info.h \ + info-b.def info-k.def info-w.def lex.h +top.o : top.c proj.h malloc.h top.h where.h bad.h bad.def bit.h bld.h bld-op.def \ + com.h info.h info-b.def info-k.def info-w.def target.h lex.h lab.h storag.h \ + symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def data.h expr.h \ + implic.h src.h st.h +where.o : where.c proj.h malloc.h lex.h top.h where.h +zzz.o : zzz.c proj.h malloc.h zzz.h + +# The rest of this list (Fortran 77 language-specific files) is hand-generated. + +stamp-str: str-1t.h str-1t.j str-2t.h str-2t.j str-fo.h str-fo.j \ + str-io.h str-io.j str-nq.h str-nq.j str-op.h str-op.j str-ot.h str-ot.j + touch stamp-str + +str-1t.h str-1t.j: fini str-1t.fin + ./fini str-1t + +str-2t.h str-2t.j: fini str-2t.fin + ./fini str-2t + +str-fo.h str-fo.j: fini str-fo.fin + ./fini str-fo + +str-io.h str-io.j: fini str-io.fin + ./fini str-io + +str-nq.h str-nq.j: fini str-nq.fin + ./fini str-nq + +str-op.h str-op.j: fini str-op.fin + ./fini str-op + +str-ot.h str-ot.j: fini str-ot.fin + ./fini str-ot + +fini: fini.o proj.o + $(CC) $(CFLAGS) -DFFE_STANDALONE -o fini fini.o proj.o + +deps-kinda: str-1t.h str-1t.j str-2t.h str-2t.j \ + str-fo.h str-fo.j str-io.h str-io.j str-nq.h str-nq.j \ + str-op.h str-op.j str-ot.h str-ot.j + $(CC) $(CFLAGS) -DFFE_STANDALONE -DMAKING_DEPENDENCIES -MM *.c | \ + sed -e 's: \([.]/\)*str[.]h : stamp-str :g' + +.c.o: + $(CC) $(CFLAGS) -DFFE_STANDALONE -c $< + +clean: + -rm -f ffe fini cktyps cktyps.out stamp-str *.o str-*.h str-*.j + +.PHONY: clean deps-kinda + +force: diff --git a/gnu/usr.bin/gcc/f/Make-lang.in b/gnu/usr.bin/gcc/f/Make-lang.in index 58d2ad00751..92f2fa7b134 100644 --- a/gnu/usr.bin/gcc/f/Make-lang.in +++ b/gnu/usr.bin/gcc/f/Make-lang.in @@ -1,5 +1,5 @@ # Top level makefile fragment for GNU Fortran. -*-makefile-*- -# Copyright (C) 1995-1997 Free Software Foundation, Inc. +# Copyright (C) 1995, 1996 Free Software Foundation, Inc. #This file is part of GNU Fortran. @@ -35,8 +35,6 @@ # - making any compiler driver (eg: g77) # - the compiler proper (eg: f771) # - define the names for selecting the language in LANGUAGES. -# -# $(srcdir) must be set to the gcc/ source directory (not gcc/f/). # Extra flags to pass to recursive makes (and to sub-configure). # Use different quoting rules compared with FLAGS_TO_PASS so we can use @@ -111,7 +109,7 @@ F77 f77: f771 f77-runtime f77.stage4 f77.distdir f77.rebuilt # Create the compiler driver for g77 (only if `f77' is in LANGUAGES). -g77: $(srcdir)/f/g77.c $(srcdir)/f/zzz.c $(CONFIG_H) $(LIBDEPS) +g77: f/g77.c $(CONFIG_H) $(LIBDEPS) case '$(LANGUAGES)' in \ *f77*) \ $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) \ @@ -120,7 +118,7 @@ g77: $(srcdir)/f/g77.c $(srcdir)/f/zzz.c $(CONFIG_H) $(LIBDEPS) # Create a version of the g77 driver which calls the cross-compiler # (only if `f77' is in LANGUAGES). -g77-cross: $(srcdir)f/g77.c $(srcdir)/f/zzz.c version.o $(LIBDEPS) +g77-cross: f/g77.c version.o $(LIBDEPS) case '$(LANGUAGES)' in \ *f77*) \ $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) \ @@ -128,6 +126,15 @@ g77-cross: $(srcdir)f/g77.c $(srcdir)/f/zzz.c version.o $(LIBDEPS) -o $@ $(srcdir)/f/g77.c $(srcdir)/f/zzz.c $(LIBS) ;; \ esac +# g77 documentation. +$(build_infodir)/f/g77.info: f/g77.texi f/bugs.texi f/install.texi f/news.texi + $(MAKEINFO) -P$(srcdir)/f $(srcdir)/f/g77.texi \ + -o $(build_infodir)/f/g77.info + +# XXX OpenBSD What to do with dvi builds...? +$(srcdir)/f/g77.dvi: f/g77.texi f/bugs.texi f/install.texi f/news.texi + $(TEXI2DVI) $(srcdir)/f/g77.texi + F77_SRCS = \ $(srcdir)/f/assert.j \ $(srcdir)/f/bad.c \ @@ -233,7 +240,7 @@ F77_SRCS = \ $(srcdir)/f/zzz.h f771: $(P) $(F77_SRCS) $(LIBDEPS) stamp-objlist f/Makefile - $(MAKE) -f f/Makefile $(FLAGS_TO_PASS) VPATH=$(srcdir) srcdir=$(srcdir) f771 + $(MAKE) -f f/Makefile $(FLAGS_TO_PASS) VPATH=$(srcdir) srcdir=$(srcdir)/f f771 f/Makefile: $(srcdir)/f/Makefile.in $(srcdir)/configure $(SHELL) config.status @@ -247,7 +254,7 @@ f/Makefile: $(srcdir)/f/Makefile.in $(srcdir)/configure stmp-headers = stmp-headers # to be overrideable in unsafe version # Depend on stmp-headers, not stmp-int-hdrs, since libF77 needs float.h. f77-runtime: f/runtime/Makefile include/f2c.h $(stmp-headers) \ - f/runtime/libF77/Makefile f/runtime/libI77/Makefile f/runtime/libU77/Makefile + f/runtime/libF77/Makefile f/runtime/libI77/Makefile case "$(LANGUAGES)" in \ *f77*) top=`pwd`; \ cd f/runtime && $(MAKE) \ @@ -267,19 +274,12 @@ f77-runtime-unsafe: # configure, not a Cygnus-type one. It needs to be run *after* the # appropriate (cross-)compiler has been built, thus depend on GCC_PARTS. # NB, sh uses the *first* value of $a from `a=fred a=joe prog'. -include/f2c.h \ -f/runtime/Makefile \ -f/runtime/libF77/Makefile \ -f/runtime/libI77/Makefile \ -f/runtime/libU77/Makefile: \ +include/f2c.h f/runtime/Makefile \ +f/runtime/libF77/Makefile f/runtime/libI77/Makefile: \ $(srcdir)/f/runtime/f2c.h.in \ - $(srcdir)/f/com.h $(srcdir)/f/proj.h \ - $(srcdir)/f/runtime/Makefile.in \ + $(srcdir)/f/com.h f/proj.h $(srcdir)/f/runtime/Makefile.in \ $(srcdir)/f/runtime/libF77/Makefile.in \ $(srcdir)/f/runtime/libI77/Makefile.in \ - $(srcdir)/f/runtime/libU77/Makefile.in \ - $(srcdir)/f/runtime/configure \ - $(srcdir)/f/runtime/libU77/configure \ $(GCC_PARTS) # The make "stage?" in compiler spec. is fully qualified as above top=`pwd`; \ @@ -290,14 +290,6 @@ f/runtime/libU77/Makefile: \ *) echo '$(GCC_FOR_TARGET)';; esac`" \ $(F77_FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) \ $${src}/f/runtime/configure --srcdir=$${src}/f/runtime - top=`pwd`; \ - src=`cd $(srcdir); pwd`; \ - cd f/runtime/libU77; \ - CC="`case '$(GCC_FOR_TARGET)' in \ - './xgcc -B./') echo $${top}/xgcc -B$${top}/;; \ - *) echo '$(GCC_FOR_TARGET)';; esac`" \ - $(F77_FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) \ - $${src}/f/runtime/libU77/configure --srcdir=$${src}/f/runtime/libU77 #For now, omit f2c stuff. -- burley #f2c: stmp-headers f/f2c/Makefile @@ -319,56 +311,26 @@ f77.start.encap: g77 maybe-f2c f77.rest.encap: f77.info: $(build_infodir)/f/g77.info -# XXX OpenBSD - what to do with dvi rules ...? +# XXX OpenBSD What to do with dvi rules...? f77.dvi: $(srcdir)/f/g77.dvi -# XXX OpenBSD - these are the documentation rules for OpenBSD - for now -# we will only install the g77 info files - the original -# g77 documentation rules will follow then commented out -# g77 documentation. -$(build_infodir)/f/g77.info: f/g77.texi f/bugs.texi f/install.texi f/news.texi - $(MAKEINFO) -P$(srcdir)/f $(srcdir)/f/g77.texi \ - -o $(build_infodir)/f/g77.info +$(srcdir)/f/BUGS: f/bugs0.texi f/bugs.texi + cd $(srcdir)/f; $(MAKEINFO) -D BUGSONLY --no-header --no-split \ + --no-validate bugs0.texi -o BUGS -# XXX OpenBSD - what to do with dvi rules ...? -$(srcdir)/f/g77.dvi: f/g77.texi f/bugs.texi f/install.texi f/news.texi - $(TEXI2DVI) $(srcdir)/f/g77.texi +$(srcdir)/f/INSTALL: f/install0.texi f/install.texi + cd $(srcdir)/f; $(MAKEINFO) -D INSTALLONLY --no-header --no-split \ + --no-validate install0.texi -o INSTALL -# XXX OpenBSD - these are the original g77-0.5.20 documentation rules -# g77 documentation. -#$(srcdir)/f/g77.info: f/g77.texi f/bugs.texi f/install.texi f/news.texi f/intdoc.texi -# cd $(srcdir)/f; $(MAKEINFO) g77.texi -# -#$(srcdir)/f/g77.dvi: f/g77.texi f/bugs.texi f/install.texi f/news.texi f/intdoc.texi -# cd $(srcdir)/f; $(TEXI2DVI) g77.texi -# -#$(srcdir)/f/intdoc.texi: f/intdoc -# f/intdoc > $(srcdir)/f/intdoc.texi -# -#f/intdoc: f/intdoc.c f/intdoc.h f/intrin.def f/intrin.h -# $(HOST_CC) $(HOST_CFLAGS) -W -Wall $(HOST_LDFLAGS) \ -# `echo $(srcdir)/f/intdoc.c | sed 's,^\./,,'` -o f/intdoc -# -#$(srcdir)/f/BUGS: f/bugs0.texi f/bugs.texi -# cd $(srcdir)/f; $(MAKEINFO) -D BUGSONLY --no-header --no-split \ -# --no-validate bugs0.texi -o BUGS -# -#$(srcdir)/f/INSTALL: f/install0.texi f/install.texi -# cd $(srcdir)/f; $(MAKEINFO) -D INSTALLONLY --no-header --no-split \ -# --no-validate install0.texi -o INSTALL -# -#$(srcdir)/f/NEWS: f/news0.texi f/news.texi -# cd $(srcdir)/f; $(MAKEINFO) -D NEWSONLY --no-header --no-split \ -# --no-validate news0.texi -o NEWS +$(srcdir)/f/NEWS: f/news0.texi f/news.texi + cd $(srcdir)/f; $(MAKEINFO) -D NEWSONLY --no-header --no-split \ + --no-validate news0.texi -o NEWS -$(srcdir)/f/runtime/configure: $(srcdir)/f/runtime/configure.in - cd f/runtime && $(MAKE) srcdir=$(srcdir)/f/runtime -f $(srcdir)/f/runtime/Makefile.in rebuilt -$(srcdir)/f/runtime/libU77/configure: $(srcdir)/f/runtime/libU77/configure.in - cd f/runtime && $(MAKE) srcdir=$(srcdir)/f/runtime -f $(srcdir)/f/runtime/Makefile.in rebuilt +$(srcdir)/f/runtime/configure: f/runtime/configure.in + cd f/runtime && $(MAKE) rebuilt -f77.rebuilt: $(srcdir)/f/g77.info $(srcdir)/f/BUGS $(srcdir)/f/INSTALL \ - $(srcdir)/f/NEWS $(srcdir)/f/runtime/configure \ - $(srcdir)/f/runtime/libU77/configure +f77.rebuilt: f/g77.info f/BUGS f/INSTALL f/NEWS f/runtime/configure + echo Fortran rebuildable files rebuilt. maybe-f2c: #For now, omit f2c stuff. -- burley @@ -507,16 +469,17 @@ f77.uninstall: f77.mostlyclean: -rm -f f/*$(objext) - -rm -f f/fini f/f771 f/stamp-str f/str-*.h f/str-*.j f/intdoc - -cd f/runtime; $(MAKE) -f $(srcdir)/f/runtime/Makefile.in mostlyclean + -rm -f f/fini f/f771 f/stamp-str f/str-*.h f/str-*.j + -cd f/runtime; $(MAKE) mostlyclean f77.clean: - -cd f/runtime; $(MAKE) -f $(srcdir)/f/runtime/Makefile.in clean + -cd f/runtime; $(MAKE) mostlyclean + -$(MAKE) f77.mostlyclean f77.distclean: - -cd f/runtime; $(MAKE) -f $(srcdir)/f/runtime/Makefile.in distclean + -cd f/runtime; $(MAKE) distclean + -$(MAKE) f77.clean -rm -f f/Makefile # like gcc's extraclean, which does clean f/ for us, but not f/gbe, -# f/runtime, f/runtime/libF77, f/runtime/libI77, and f/runtime/libU77, -# so do those. +# f/runtime, f/runtime/libF77, and f/runtime/libI77, so do those. f77.extraclean: f77.distclean -rm -f f/*/=* f/*/"#"* f/*/*~* -rm -f f/*/patch* f/*/*.orig f/*/*.rej @@ -530,46 +493,37 @@ f77.extraclean: f77.distclean -rm -f f/*/*/*lose f/*/*/*.s f/*/*/*.s[0-9] f/*/*/*.i # realclean is the pre-2.7.0 name for maintainer-clean f77.maintainer-clean f77.realclean: f77.distclean - -cd f/runtime; $(MAKE) -f $(srcdir)/f/runtime/Makefile.in maintainer-clean - -$(MAKE) f77.maintainer-clean - -rm -f f/g77.info* f/g77.*aux f/TAGS f/BUGS f/INSTALL f/NEWS f/intdoc.texi + -rm -f f/g77.info* f/g77.*aux f/TAGS f/BUGS f/INSTALL f/NEWS # Stage hooks: # The main makefile has already created stage?/f. G77STAGESTUFF = f/*$(objext) f/fini f/stamp-str f/str-*.h f/str-*.j RUNTIMESTAGESTUFF = f/runtime/config.cache f/runtime/config.log \ - f/runtime/config.status f/runtime/Makefile + f/runtime/config.status f/runtime/Makefile LIBF77STAGESTUFF = f/runtime/libF77/*$(objext) f/runtime/libF77/Makefile LIBI77STAGESTUFF = f/runtime/libI77/*$(objext) f/runtime/libI77/Makefile -LIBU77STAGESTUFF = f/runtime/libU77/*$(objext) f/runtime/libU77/Makefile \ - f/runtime/libU77/config.cache f/runtime/libU77/config.log \ - f/runtime/libU77/config.status f77.stage1: -mv $(G77STAGESTUFF) stage1/f -mv $(RUNTIMESTAGESTUFF) stage1/f/runtime -mv $(LIBF77STAGESTUFF) stage1/f/runtime/libF77 -mv $(LIBI77STAGESTUFF) stage1/f/runtime/libI77 - -mv $(LIBU77STAGESTUFF) stage1/f/runtime/libU77 f77.stage2: -mv $(G77STAGESTUFF) stage2/f -mv $(RUNTIMESTAGESTUFF) stage2/f/runtime -mv $(LIBF77STAGESTUFF) stage2/f/runtime/libF77 -mv $(LIBI77STAGESTUFF) stage2/f/runtime/libI77 - -mv $(LIBU77STAGESTUFF) stage2/f/runtime/libU77 f77.stage3: -mv $(G77STAGESTUFF) stage3/f -mv $(RUNTIMESTAGESTUFF) stage3/f/runtime -mv $(LIBF77STAGESTUFF) stage3/f/runtime/libF77 -mv $(LIBI77STAGESTUFF) stage3/f/runtime/libI77 - -mv $(LIBU77STAGESTUFF) stage3/f/runtime/libU77 f77.stage4: -mv $(G77STAGESTUFF) stage4/f -mv $(RUNTIMESTAGESTUFF) stage4/f/runtime -mv $(LIBF77STAGESTUFF) stage4/f/runtime/libF77 -mv $(LIBI77STAGESTUFF) stage4/f/runtime/libI77 - -mv $(LIBU77STAGESTUFF) stage4/f/runtime/libU77 # Maintenance hooks: diff --git a/gnu/usr.bin/gcc/f/Makefile.in b/gnu/usr.bin/gcc/f/Makefile.in index a074f7b0327..fd29ecc10c5 100644 --- a/gnu/usr.bin/gcc/f/Makefile.in +++ b/gnu/usr.bin/gcc/f/Makefile.in @@ -1,5 +1,5 @@ # Makefile for GNU F77 compiler. -# Copyright (C) 1995-1997 Free Software Foundation, Inc. +# Copyright (C) 1995 Free Software Foundation, Inc. #This file is part of GNU Fortran. @@ -87,12 +87,17 @@ GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) target= ... `configure' substitutes actual target name here. xmake_file= ... `configure' substitutes actual x- file name here. tmake_file= ... `configure' substitutes actual t- file name here. +#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c` +#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c` -# Directory where gcc sources are (gcc/), from where we are. +# Directory where sources are, from where we are. # Note that this should be overridden when building f771, which happens # at the top level, not in f. Likewise for VPATH (if added). srcdir = . -VPATH = . +# The following overriding of the VPATH inserted by configure (as well as +# the change to the standard srcdir above) is due to not building in the f +# directory as standard. +#VPATH = $(srcdir)../ # Additional system libraries to link with. CLIB= @@ -137,7 +142,7 @@ ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) # appropriate for the linker on AIX 4.1 and above. F771_LDFLAGS = `case "${target}" in\ m68k-next-nextstep*) echo -segaddr __DATA 6000000;;\ - *-*-aix[4-9]*) \`$(CC) --print-prog-name=ld\` -v 2>&1 | grep BFD >/dev/null || echo -Wl,-bbigtoc;; esac` + *-*-aix[4-9]*) echo -Wl,-bbigtoc;; esac` # Even if ALLOCA is set, don't use it if compiling with GCC. @@ -152,8 +157,11 @@ LIBS = $(SUBDIR_OBSTACK) $(SUBDIR_USE_ALLOCA) $(SUBDIR_MALLOC) $(CLIB) # Specify the directories to be searched for header files. # Both . and srcdir are used, in that order, # so that tm.h and config.h will be found in the compilation -# directory rather than in the source directory. -INCLUDES = -If -I$(srcdir)/f -I. -I$(srcdir) -I$(srcdir)/config +# subdirectory rather than in the source directory. +INCLUDES = -If -I. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config + +#(Old way of doing things, new way being better for -g:) +#INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config # Flags_to_pass to recursive makes. # Note that we don't need to distinguish the `_FOR_TARGET' cross tools @@ -182,6 +190,7 @@ FLAGS_TO_PASS = \ "bindir=$(bindir)" \ "libsubdir=$(libsubdir)" +# Always use -I$(srcdir)/config when compiling. .c.o: $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< -o $@ @@ -236,7 +245,7 @@ OBJDEPS = stamp-objlist compiler: f771 # This is now meant to be built in the top level directory, not `f': f771: $(P) f/Makefile $(F77_OBJS) $(OBJDEPS) $(LIBDEPS) - rm -f f771$(exeext) + rm -f ../f771$(exeext) $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(F771_LDFLAGS) -o $@ \ $(F77_OBJS) $(OBJS) $(LIBS) @@ -246,7 +255,7 @@ f/Makefile: then echo "Build f771 only at the top level." 2>&1; exit 1; \ else true; fi -Makefile: $(srcdir)/f/Makefile.in $(srcdir)/configure +Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure native: f771 @@ -261,22 +270,22 @@ native: f771 # the gcc-source files involved (each file itself, plus whatever # files on which it depends, but without including stuff resulting # from configuration, since we can't guess at that). The files -# that live in a distclean'd gcc source directory have "$(srcdir)/" +# that live in a distclean'd gcc source directory have "$(srcdir)/../" # prefixes, while the others don't because they'll be created # only in the build directory. -ASSERT_H = $(srcdir)/f/assert.j $(srcdir)/assert.h -CONFIG_H = $(srcdir)/f/config.j config.h -CONVERT_H = $(srcdir)/f/convert.j $(srcdir)/convert.h -FLAGS_H = $(srcdir)/f/flags.j $(srcdir)/flags.h -GLIMITS_H = $(srcdir)/f/glimits.j $(srcdir)/glimits.h -HCONFIG_H = $(srcdir)/f/hconfig.j hconfig.h -INPUT_H = $(srcdir)/f/input.j $(srcdir)/input.h -RTL_H = $(srcdir)/f/rtl.j $(srcdir)/rtl.h $(srcdir)/rtl.def \ - $(srcdir)/machmode.h $(srcdir)/machmode.def -TCONFIG_H = $(srcdir)/f/tconfig.j tconfig.h -TM_H = $(srcdir)/f/tm.j tm.h -TREE_H = $(srcdir)/f/tree.j $(srcdir)/tree.h $(srcdir)/real.h \ - $(srcdir)/tree.def $(srcdir)/machmode.h $(srcdir)/machmode.def +ASSERT_H = $(srcdir)/assert.j $(srcdir)/../assert.h +CONFIG_H = $(srcdir)/config.j config.h +CONVERT_H = $(srcdir)/convert.j $(srcdir)/../convert.h +FLAGS_H = $(srcdir)/flags.j $(srcdir)/../flags.h +GLIMITS_H = $(srcdir)/glimits.j $(srcdir)/../glimits.h +HCONFIG_H = $(srcdir)/hconfig.j hconfig.h +INPUT_H = $(srcdir)/input.j $(srcdir)/../input.h +RTL_H = $(srcdir)/rtl.j $(srcdir)/../rtl.h $(srcdir)/../rtl.def \ + $(srcdir)/../machmode.h $(srcdir)/../machmode.def +TCONFIG_H = $(srcdir)/tconfig.j tconfig.h +TM_H = $(srcdir)/tm.j tm.h +TREE_H = $(srcdir)/tree.j $(srcdir)/../tree.h $(srcdir)/../real.h \ + $(srcdir)/../tree.def $(srcdir)/../machmode.h $(srcdir)/../machmode.def #Build the first part of this list with the command line: # cd gcc/; make deps-kinda -f f/Makefile.in @@ -462,36 +471,36 @@ f/stamp-str: f/str-1t.h f/str-1t.j f/str-2t.h f/str-2t.j \ touch f/stamp-str f/str-1t.h f/str-1t.j: f/fini f/str-1t.fin - ./f/fini `echo $(srcdir)/f/str-1t.fin | sed 's,^\./,,'` f/str-1t.j f/str-1t.h + ./f/fini `echo $(srcdir)/str-1t.fin | sed 's,^\./,,'` f/str-1t.j f/str-1t.h f/str-2t.h f/str-2t.j: f/fini f/str-2t.fin - ./f/fini `echo $(srcdir)/f/str-2t.fin | sed 's,^\./,,'` f/str-2t.j f/str-2t.h + ./f/fini `echo $(srcdir)/str-2t.fin | sed 's,^\./,,'` f/str-2t.j f/str-2t.h f/str-fo.h f/str-fo.j: f/fini f/str-fo.fin - ./f/fini `echo $(srcdir)/f/str-fo.fin | sed 's,^\./,,'` f/str-fo.j f/str-fo.h + ./f/fini `echo $(srcdir)/str-fo.fin | sed 's,^\./,,'` f/str-fo.j f/str-fo.h f/str-io.h f/str-io.j: f/fini f/str-io.fin - ./f/fini `echo $(srcdir)/f/str-io.fin | sed 's,^\./,,'` f/str-io.j f/str-io.h + ./f/fini `echo $(srcdir)/str-io.fin | sed 's,^\./,,'` f/str-io.j f/str-io.h f/str-nq.h f/str-nq.j: f/fini f/str-nq.fin - ./f/fini `echo $(srcdir)/f/str-nq.fin | sed 's,^\./,,'` f/str-nq.j f/str-nq.h + ./f/fini `echo $(srcdir)/str-nq.fin | sed 's,^\./,,'` f/str-nq.j f/str-nq.h f/str-op.h f/str-op.j: f/fini f/str-op.fin - ./f/fini `echo $(srcdir)/f/str-op.fin | sed 's,^\./,,'` f/str-op.j f/str-op.h + ./f/fini `echo $(srcdir)/str-op.fin | sed 's,^\./,,'` f/str-op.j f/str-op.h f/str-ot.h f/str-ot.j: f/fini f/str-ot.fin - ./f/fini `echo $(srcdir)/f/str-ot.fin | sed 's,^\./,,'` f/str-ot.j f/str-ot.h + ./f/fini `echo $(srcdir)/str-ot.fin | sed 's,^\./,,'` f/str-ot.j f/str-ot.h f/fini: f/fini.o f/proj-h.o $(HOST_CC) $(HOST_CFLAGS) -W -Wall $(HOST_LDFLAGS) -o f/fini f/fini.o f/proj-h.o f/fini.o: $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ - `echo $(srcdir)/f/fini.c | sed 's,^\./,,'` -o $@ + `echo $(srcdir)/fini.c | sed 's,^\./,,'` -o $@ f/proj-h.o: f/proj.o $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ - `echo $(srcdir)/f/proj.c | sed 's,^\./,,'` -o $@ + `echo $(srcdir)/proj.c | sed 's,^\./,,'` -o $@ # Other than str-*.j, the *.j files are dummy #include files # that normally just #include the corresponding back-end *.h @@ -533,7 +542,7 @@ deps-kinda: # Update the tags table. TAGS: force - cd $(srcdir)/f ; \ + cd $(srcdir) ; \ etags *.c *.h ; \ echo 'l' | tr 'l' '\f' >> TAGS ; \ echo 'parse.y,0' >> TAGS ; \ diff --git a/gnu/usr.bin/gcc/f/NEWS b/gnu/usr.bin/gcc/f/NEWS index 116b89a3012..1ac6a81f94c 100644 --- a/gnu/usr.bin/gcc/f/NEWS +++ b/gnu/usr.bin/gcc/f/NEWS @@ -6,211 +6,6 @@ notice and permission notice. News About GNU Fortran ********************** -In 0.5.20: -========== - - * The `-fno-typeless-boz' option is now the default. - - This option specifies that non-decimal-radix constants using the - prefixed-radix form (such as `Z'1234'') are to be interpreted as - `INTEGER' constants. Specify `-ftypeless-boz' to cause such - constants to be interpreted as typeless. - - (Version 0.5.19 introduced `-fno-typeless-boz' and its inverse.) - - * Options `-ff90-intrinsics-enable' and `-fvxt-intrinsics-enable' - now are the defaults. - - Some programs might use names that clash with intrinsic names - defined (and now enabled) by these options or by the new `libU77' - intrinsics. Users of such programs might need to compile them - differently (using, for example, `-ff90-intrinsics-disable') or, - better yet, insert appropriate `EXTERNAL' statements specifying - that these names are not intended to be names of intrinsics. - - * The `ALWAYS_FLUSH' macro is no longer defined when building - `libf2c', which should result in improved I/O performance, - especially over NFS. - - *Note:* If you have code that depends on the behavior of `libf2c' - when built with `ALWAYS_FLUSH' defined, you will have to modify - `libf2c' accordingly before building it from this and future - versions of `g77'. - - * Dave Love's implementation of `libU77' has been added to the - version of `libf2c' distributed with and built as part of `g77'. - `g77' now knows about the routines in this library as intrinsics. - - * New option `-fvxt' specifies that the source file is written in - VXT Fortran, instead of GNU Fortran. - - * The `-fvxt-not-f90' option has been deleted, along with its - inverse, `-ff90-not-vxt'. - - If you used one of these deleted options, you should re-read the - pertinent documentation to determine which options, if any, are - appropriate for compiling your code with this version of `g77'. - - * The `-fugly' option now issues a warning, as it likely will be - removed in a future version. - - (Enabling all the `-fugly-*' options is unlikely to be feasible, - or sensible, in the future, so users should learn to specify only - those `-fugly-*' options they really need for a particular source - file.) - - * The `-fugly-assumed' option, introduced in version 0.5.19, has - been changed to better accommodate old and new code. - - * Make a number of fixes to the `g77' front end and the `gcc' back - end to better support Alpha (AXP) machines. This includes - providing at least one bug-fix to the `gcc' back end for Alphas. - - * Related to supporting Alpha (AXP) machines, the `LOC()' intrinsic - and `%LOC()' construct now return values of integer type that is - the same width (holds the same number of bits) as the pointer type - on the machine. - - On most machines, this won't make a difference, whereas on Alphas, - the type these constructs return is `INTEGER*8' instead of the - more common `INTEGER*4'. - - * Emulate `COMPLEX' arithmetic in the `g77' front end, to avoid bugs - in `complex' support in the `gcc' back end. New option - `-fno-emulate-complex' causes `g77' to revert the 0.5.19 behavior. - - * Fix bug whereby `REAL A(1)', for example, caused a compiler crash - if `-fugly-assumed' was in effect and A was a local (automatic) - array. That case is no longer affected by the new handling of - `-fugly-assumed'. - - * Fix `g77' command driver so that `g77 -o foo.f' no longer deletes - `foo.f' before issuing other diagnostics, and so the `-x' option - is properly handled. - - * Enable inlining of subroutines and functions by the `gcc' back end. - This works as it does for `gcc' itself--program units may be - inlined for invocations that follow them in the same program unit, - as long as the appropriate compile-time options are specified. - - * Dummy arguments are no longer assumed to potentially alias - (overlap) other dummy arguments or `COMMON' areas when any of - these are defined (assigned to) by Fortran code. - - This can result in faster and/or smaller programs when compiling - with optimization enabled, though on some systems this effect is - observed only when `-fforce-addr' also is specified. - - New options `-falias-check', `-fargument-alias', - `-fargument-noalias', and `-fno-argument-noalias-global' control - the way `g77' handles potential aliasing. - - * The `CONJG()' and `DCONJG()' intrinsics now are compiled in-line. - - * The bug-fix for 0.5.19.1 has been re-done. The `g77' compiler has - been changed back to assume `libf2c' has no aliasing problems in - its implementations of the `COMPLEX' (and `DOUBLE COMPLEX') - intrinsics. The `libf2c' has been changed to have no such - problems. - - As a result, 0.5.20 is expected to offer improved performance over - 0.5.19.1, perhaps as good as 0.5.19 in most or all cases, due to - this change alone. - - *Note:* This change requires version 0.5.20 of `libf2c', at least, - when linking code produced by any versions of `g77' other than - 0.5.19.1. Use `g77 -v' to determine the version numbers of the - `libF77', `libI77', and `libU77' components of the `libf2c' - library. (If these version numbers are not printed--in - particular, if the linker complains about unresolved references to - names like `g77__fvers__'--that strongly suggests your - installation has an obsolete version of `libf2c'.) - - * New option `-fugly-assign' specifies that the same memory - locations are to be used to hold the values assigned by both - statements `I = 3' and `ASSIGN 10 TO I', for example. (Normally, - `g77' uses a separate memory location to hold assigned statement - labels.) - - * `FORMAT' and `ENTRY' statements now are allowed to precede - `IMPLICIT NONE' statements. - - * Produce diagnostic for unsupported `SELECT CASE' on `CHARACTER' - type, instead of crashing, at compile time. - - * Fix crashes involving diagnosed or invalid code. - - * Change approach to building `libf2c' archive (`libf2c.a') so that - members are added to it only when truly necessary, so the user - that installs an already-built `g77' doesn't need to have write - access to the build tree (whereas the user doing the build might - not have access to install new software on the system). - - * Support `gcc' version 2.7.2.2 (modified by `g77' into version - 2.7.2.2.f.2), and remove support for prior versions of `gcc'. - - * Upgrade to `libf2c' as of 1997-02-08, and fix up some of the build - procedures. - - * Improve general build procedures for `g77', fixing minor bugs - (such as deletion of any file named `f771' in the parent directory - of `gcc/'). - - * Enable full support of `INTEGER*8' available in `libf2c' and - `f2c.h' so that `f2c' users may make full use of its features via - the `g77' version of `f2c.h' and the `INTEGER*8' support routines - in the `g77' version of `libf2c'. - - * Improve `g77' driver and `libf2c' so that `g77 -v' yields version - information on the library. - - * The `SNGL' and `FLOAT' intrinsics now are specific intrinsics, - instead of synonyms for the generic intrinsic `REAL'. - - * New intrinsics have been added. These are `REALPART', `IMAGPART', - `COMPLEX', `LONG', and `SHORT'. - - * A new group of intrinsics, `gnu', has been added to contain the - new `REALPART', `IMAGPART', and `COMPLEX' intrinsics. An old - group, `dcp', has been removed. - - * Complain about industry-wide ambiguous references `REAL(EXPR)' and - `AIMAG(EXPR)', where EXPR is `DOUBLE COMPLEX' (or any complex type - other than `COMPLEX'), unless `-ff90' option specifies Fortran 90 - interpretation or new `-fugly-complex' option, in conjunction with - `-fnot-f90', specifies `f2c' interpretation. - - * Make improvements to diagnostics. - - * Speed up compiler a bit. - - * Improvements to documentation and indexing, including a new - chapter containing information on one, later more, diagnostics - that users are directed to pull up automatically via a message in - the diagnostic itself. - - (Hence the menu item `M' for the node `Diagnostics' in the - top-level menu of the Info documentation.) - -In 0.5.19.1: -============ - - * Code-generation bugs afflicting operations on complex data have - been fixed. - - These bugs occurred when assigning the result of an operation to a - complex variable (or array element) that also served as an input - to that operation. - - The operations affected by this bug were: `CONJG()', `DCONJG()', - `CCOS()', `CDCOS()', `CLOG()', `CDLOG()', `CSIN()', `CDSIN()', - `CSQRT()', `CDSQRT()', complex division, and raising a `DOUBLE - COMPLEX' operand to an `INTEGER' power. (The related generic and - `Z'-prefixed intrinsics, such as `ZSIN()', also were affected.) - - For example, `C = CSQRT(C)', `Z = Z/C', and `Z = Z**I' (where `C' - is `COMPLEX' and `Z' is `DOUBLE COMPLEX') have been fixed. - In 0.5.19: ========== @@ -305,7 +100,7 @@ In 0.5.18: `INTEGER*8', and their `LOGICAL' equivalents. (This support works on most, maybe all, `gcc' targets.) - Thanks to Scott Snyder () for providing + Thanks to Scott Snyder (`snyder@d0sgif.fnal.gov') for providing the patch for this! Among the missing elements from the support for these features are @@ -315,7 +110,7 @@ In 0.5.18: type-declaration statements. `BYTE' corresponds to `INTEGER*1', while `WORD' corresponds to `INTEGER*2'. - Thanks to Scott Snyder () for providing + Thanks to Scott Snyder (`snyder@d0sgif.fnal.gov') for providing the patch for this! * The compiler code handling intrinsics has been largely rewritten @@ -387,7 +182,7 @@ In 0.5.18: enhanced for Fortran, and N is `1' for the first Fortran patch for that version of `gcc', `2' for the second, and so on. - So, this introduces version 2.7.2.f.1 of `gcc'. + So, this introduces version `2.7.2.f.1' of `gcc'. * Make several improvements and fixes to diagnostics, including the removal of two that were inappropriate or inadequate. @@ -411,7 +206,7 @@ In 0.5.18: This effort was inspired by a first pass at translating `g77-0.5.16/f/DOC' that was contributed to Craig by David Ronis - (). + (`ronis@onsager.chem.mcgill.ca'). * New `-fno-second-underscore' option to specify that, when `-funderscoring' is in effect, a second underscore is not to be @@ -436,7 +231,7 @@ In 0.5.18: Note that the email addresses related to `f2c' have changed--the distribution site now is named `netlib.bell-labs.com', and the - maintainer's new address is . + maintainer's new address is `dmg@bell-labs.com'. In 0.5.17: ========== @@ -648,7 +443,7 @@ In 0.5.16: `gcc/f/expr.c'. * Add warning to be printed for each invocation of the compiler if - the target machine `INTEGER', `REAL', or `LOGICAL' size is not 32 + the target machine `INTEGER', REAL, or `LOGICAL' size is not 32 bits, since `g77' is known to not work well for such cases (to be fixed in Version 0.6--*note Actual Bugs We Haven't Fixed Yet: Actual Bugs.). @@ -809,7 +604,7 @@ In 0.5.14: - Hollerith "format specifications" in the form of arrays of non-character allowed. - - Warnings issued when non-space truncation occurs when + - Warnings issued when non-blank truncation occurs when converting to another type. - When specified as actual argument, now passed by reference to @@ -820,7 +615,7 @@ In 0.5.14: *Warning:* `f2c' differs on the interpretation of `CALL FOO(1HX)', which it treats exactly the same as `CALL FOO('X')', but which the standard and `g77' treat as `CALL FOO(%REF('X '))' (padded with - as many spaces as necessary to widen to `INTEGER'), essentially. + as many blanks as necessary to widen to `INTEGER'), essentially. * Changes and fixes to typeless-constant support: @@ -865,5 +660,5 @@ In 0.5.14: * Generate better code for some kinds of array references. * Speed up lexing somewhat (this makes the compilation phase - noticeably faster). + noticably faster). diff --git a/gnu/usr.bin/gcc/f/PROJECTS b/gnu/usr.bin/gcc/f/PROJECTS new file mode 100644 index 00000000000..4e863c58f6f --- /dev/null +++ b/gnu/usr.bin/gcc/f/PROJECTS @@ -0,0 +1,5 @@ +THIS FILE HAS BEEN OBSOLETED in the GNU Fortran distribution as +of version 0.5.18. It will be removed in a future distribution. + +Its contents have been assimilated into the Info documentation, +the source to which is in gcc/f/g77.texi. diff --git a/gnu/usr.bin/gcc/f/README.NEXTSTEP b/gnu/usr.bin/gcc/f/README.NEXTSTEP new file mode 100644 index 00000000000..6ea24ac89f2 --- /dev/null +++ b/gnu/usr.bin/gcc/f/README.NEXTSTEP @@ -0,0 +1,6 @@ +THIS FILE HAS BEEN OBSOLETED in the GNU Fortran distribution as +of version 0.5.18. It will be removed in a future distribution. + +Its contents have been assimilated into the Info documentation, +the source to which is in gcc/f/g77.texi. In particular, see +the node ``(g77)But-bugs''. diff --git a/gnu/usr.bin/gcc/f/bad.def b/gnu/usr.bin/gcc/f/bad.def index ce2866dcdc8..4fc20eccec2 100644 --- a/gnu/usr.bin/gcc/f/bad.def +++ b/gnu/usr.bin/gcc/f/bad.def @@ -1,5 +1,5 @@ /* bad.def -- Public #include File (module.h template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -172,6 +172,9 @@ FFEBAD_MSGS1 (FFEBAD_SEMICOLON, FATAL, FFEBAD_MSGS2 (FFEBAD_UNREC_STMT, FATAL, "Unrecognized statement name at %0 and invalid form for assignment or statement-function definition at %1", "Invalid statement at %0") +FFEBAD_MSGS2 (FFEBAD_UNIMPL_STMT, FATAL, +"Unimplemented or invalid form of statement at %0 (this is a catchall diagnostic that currently applies to a wide variety of errors, including things like invalid ordering of statements and invalid reference to intrinsic procedure)", +"Invalid statement at %0") FFEBAD_MSGS2 (FFEBAD_INVALID_STMT_FORM, FATAL, "Invalid form for %A statement at %0", "Invalid %A statement at %0") @@ -485,34 +488,29 @@ FFEBAD_MSGS2 (FFEBAD_RELOP_ARG_KIND, FATAL, "Relational operator at %0 must operate on two scalar (not array) subexpressions, two function invocations returning integer, real, or character scalars, or a combination of both -- but the subexpression at %1 is %A", "Invalid operand (is %A) at %1 for relational operator at %0") FFEBAD_MSGS2 (FFEBAD_INTRINSIC_REF, FATAL, -"Reference to intrinsic %A at %0 invalid -- one or more arguments have incorrect type", -"Invalid reference to intrinsic %A at %0") +"Reference to intrinsic function or subroutine `%A' at %0 invalid -- number or nature of arguments incorrect", +"Invalid reference to intrinsic `%A' at %0") FFEBAD_MSGS2 (FFEBAD_INTRINSIC_TOOFEW, FATAL, -"Too few arguments passed to intrinsic %A at %0", -"Too few arguments for intrinsic %A at %0") +"Too few arguments passed to intrinsic function or subroutine `%A' at %0", +"Too few arguments for intrinsic `%A' at %0") FFEBAD_MSGS2 (FFEBAD_INTRINSIC_TOOMANY, FATAL, -"Too many arguments passed to intrinsic %A at %0", -"Too many arguments for intrinsic %A at %0") +"Too many arguments passed to intrinsic function or subroutine `%A' at %0", +"Too many arguments for intrinsic `%A' at %0") FFEBAD_MSGS2 (FFEBAD_INTRINSIC_DISABLED, FATAL, -"Reference to disabled intrinsic %A at %0", -"Disabled intrinsic %A at %0") +"Reference to disabled intrinsic function or subroutine `%A' at %0", +"Disabled intrinsic `%A' at %0") FFEBAD_MSGS2 (FFEBAD_INTRINSIC_IS_SUBR, FATAL, -"Reference to intrinsic subroutine %A as if it were a function at %0", -"Function reference to intrinsic subroutine %A at %0") +"Reference to intrinsic subroutine `%A' as if it were a function at %0", +"Function reference to intrinsic subroutine `%A' at %0") FFEBAD_MSGS2 (FFEBAD_INTRINSIC_IS_FUNC, FATAL, -"Reference to intrinsic function %A as if it were a subroutine at %0", -"Subroutine reference to intrinsic function %A at %0") +"Reference to intrinsic function `%A' as if it were a subroutine at %0", +"Subroutine reference to intrinsic function `%A' at %0") FFEBAD_MSGS2 (FFEBAD_INTRINSIC_UNIMPL, FATAL, -"Reference to unimplemented intrinsic %A at %0 -- use EXTERNAL to reference user-written procedure with this name", -"Unimplemented intrinsic %A at %0") -FFEBAD_MSGS2 (FFEBAD_INTRINSIC_UNIMPLW, WARN, -"Reference to unimplemented intrinsic %A at %0 (assumed EXTERNAL)", -"Unimplemented intrinsic %A at %0 (assumed EXTERNAL)") +"Reference to unimplemented intrinsic procedure `%A' at %0 -- use EXTERNAL to reference non-intrinsic procedure with this name", +"Unimplemented intrinsic `%A' at %0") FFEBAD_MSGS2 (FFEBAD_INTRINSIC_AMBIG, FATAL, -"Reference to generic intrinsic %A at %0 could be for specific intrinsic %B or %C", -"Ambiguous reference to generic intrinsic %A (could be %B or %C) at %0") -FFEBAD_MSGS1 (FFEBAD_INTRINSIC_CMPAMBIG, FATAL, -"Ambiguous use of intrinsic %A at %0 [info -f g77 M CMPAMBIG]") +"Reference to generic intrinsic procedure `%A' at %0 could be for specific intrinsic procedure `%B' or `%C'", +"Ambiguous reference to generic intrinsic `%A' at %0") FFEBAD_MSGS1 (FFEBAD_OPEN_INCLUDE, FATAL, "Unable to open INCLUDE file `%A' at %0") FFEBAD_MSGS2 (FFEBAD_DOITER, FATAL, @@ -620,7 +618,7 @@ FFEBAD_MSGS2 (FFEBAD_COMMON_ENLARGED, FATAL, FFEBAD_MSGS1 (FFEBAD_COMMON_BLANK_INIT, WARN, "Blank common initialized at %0") FFEBAD_MSGS1 (FFEBAD_NEED_INTRINSIC, WARN, -"Intrinsic %A is passed as actual argument at %0 but not explicitly declared INTRINSIC") +"Intrinsic procedure `%A' is passed as actual argument at %0 but not explicitly declared INTRINSIC") FFEBAD_MSGS1 (FFEBAD_NEED_EXTERNAL, WARN, "External procedure `%A' is passed as actual argument at %0 but not explicitly declared EXTERNAL") FFEBAD_MSGS1 (FFEBAD_SYMBOL_UPPER_CASE, WARN, @@ -649,6 +647,8 @@ FFEBAD_MSGS2 (FFEBAD_TOO_BIG_INIT, WARN, "This could take a while (initializing `%A' at %0)...") FFEBAD_MSGS1 (FFEBAD_BLOCKDATA_STMT, WARN, "Statement at %0 invalid in BLOCK DATA program unit at %1") +FFEBAD_MSGS1 (FFEBAD_TYPELESS_TOO_LARGE, WARN, +"Typeless constant at %0 too large") FFEBAD_MSGS1 (FFEBAD_TRUNCATING_CHARACTER, WARN, "Truncating characters on right side of character constant at %0") FFEBAD_MSGS1 (FFEBAD_TRUNCATING_HOLLERITH, WARN, diff --git a/gnu/usr.bin/gcc/f/bld.c b/gnu/usr.bin/gcc/f/bld.c index 3a95727adc1..63fe91d678a 100644 --- a/gnu/usr.bin/gcc/f/bld.c +++ b/gnu/usr.bin/gcc/f/bld.c @@ -1,5 +1,5 @@ /* bld.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -1067,7 +1067,7 @@ ffebld_constant_is_zero (ffebldConstant c) #endif #if FFETARGET_okCHARACTER2 || FFETARGET_okCHARACTER3 /* ... */ -#error "no support for these!!" +#error no support for these!! #endif case FFEBLD_constHOLLERITH: @@ -2007,7 +2007,6 @@ ffebld_constantarray_dump (ffebldConstantArray array, ffeinfoBasictype bt, ffeinfoKindtype kt, ffetargetOffset size, ffebit bits) { ffetargetOffset i; - ffebitCount j; ffebld_dump_prefix (dmpout, bt, kt); @@ -2039,12 +2038,12 @@ ffebld_constantarray_dump (ffebldConstantArray array, ffeinfoBasictype bt, else fprintf (dmpout, "[%" ffetargetOffset_f "u..%" ffetargetOffset_f "d]:", - offset, offset + (ffetargetOffset) length - 1); - for (j = 0; j < length; ++j, ++offset) + offset, offset + length - 1); + for (i = 0; i < length; ++i, ++offset) { ffebld_constantunion_dump (ffebld_constantarray_get (array, bt, kt, offset), bt, kt); - if (j != length - 1) + if (i != length - 1) fputc (',', dmpout); } fprintf (dmpout, ";"); diff --git a/gnu/usr.bin/gcc/f/bld.h b/gnu/usr.bin/gcc/f/bld.h index a9dbe9f2e03..7e77c1e26cb 100644 --- a/gnu/usr.bin/gcc/f/bld.h +++ b/gnu/usr.bin/gcc/f/bld.h @@ -1,5 +1,5 @@ /* bld.h -- Public #include File (module.h template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/bugs.texi b/gnu/usr.bin/gcc/f/bugs.texi index 35df036727a..4feeab0d0ca 100644 --- a/gnu/usr.bin/gcc/f/bugs.texi +++ b/gnu/usr.bin/gcc/f/bugs.texi @@ -1,11 +1,11 @@ -@c Copyright (C) 1995-1997 Free Software Foundation, Inc. +@c Copyright (C) 1995, 1996 Free Software Foundation, Inc. @c This is part of the G77 manual. @c For copying conditions, see the file g77.texi. @c The text of this file appears in the file BUGS @c in the G77 distribution, as well as in the G77 manual. -@c 1996-02-24 +@c 1996-11-27 @ifclear BUGSONLY @node Actual Bugs @@ -25,19 +25,12 @@ configure, port, build, and install @code{g77}, @ref{Problems Installing}. @itemize @bullet -@cindex SIGNAL() intrinsic -@cindex intrinsics, SIGNAL() +@cindex -fugly option +@cindex options, -fugly @item -Work is needed on the @code{SIGNAL()} intrinsic to ensure -that pointers and integers are properly handled on all -targets, including 64-bit machines. - -@cindex -fugly-comma option -@cindex options, -fugly-comma -@item -When using @samp{-fugly-comma}, @code{g77} assumes an extra +When using @samp{-fugly}, @code{g77} assumes an extra @samp{%VAL(0)} argument is to be passed to intrinsics -taking no arguments, such as @code{IARGC()}, which in +taking no arguments, such as @samp{IARGC()}, which in turn reject such a call. Although this has been worked around for 0.5.18 due to changes in the handling of intrinsics, @@ -46,12 +39,30 @@ only for external-function invocation, as this would probably be more consistent with compilers that default to using that trick. +@item +Although @code{g77} generally supports @samp{SELECT CASE}, +it doesn't do so for @samp{CHARACTER} types. +Worse, it just crashes with a barely servicable +diagnostic. +If the time can't be taken soon to finish implementing +this feature, at least a better way of diagnosing +the problem should be provided. + +@item +To accept a lot of fine code, @code{g77} needs to +accept @samp{FORMAT} and @samp{ENTRY} before an +@samp{IMPLICIT NONE}. + +@item +Some crashes occur when compiling under Solaris on x86 +machines. + @item Something about @code{g77}'s straightforward handling of label references and definitions sometimes prevents the GBE from unrolling loops. -Until this is solved, try inserting or removing @code{CONTINUE} -statements as the terminal statement, using the @code{END DO} +Until this is solved, try inserting or removing @samp{CONTINUE} +statements as the terminal statement, using the @samp{END DO} form instead, and so on. @item @@ -61,16 +72,20 @@ For example, @code{gcc} accepts abbreviated forms of long options, @code{g77} generally doesn't. @item -Some confusion in diagnostics concerning failing @code{INCLUDE} -statements from within @code{INCLUDE}'d or @code{#include}'d files. +Some confusion in diagnostics concerning failing @samp{INCLUDE} +statements from within @samp{INCLUDE}'d or @samp{#include}'d files. + +@item +Some problems on RS/6000 regarding statement functions and/or +@samp{COMPLEX} arithmetic? @cindex integer constants @cindex constants, integer @item -@code{g77} assumes that @code{INTEGER(KIND=1)} constants range +@code{g77} assumes that @samp{INTEGER} constants range from @samp{-2**31} to @samp{2**31-1} (the range for two's-complement 32-bit values), -instead of determining their range from the actual range of the +instead of determining their range from the actual range of the @samp{INTEGER} type for the configuration (and, someday, for the constant). Further, it generally doesn't implement the handling @@ -152,33 +167,14 @@ main program unit is activated and about to execute its first executable statement, but that's the state in which the debugger should start up, as is the case for languages like C. -@cindex debugger -@item -Debugging @code{g77}-compiled code using debuggers other than -@code{gdb} is likely not to work. - -Getting @code{g77} and @code{gdb} to work together is a known -problem---getting @code{g77} to work properly with other -debuggers, for which source code often is unavailable to @code{g77} -developers, seems like a much larger, unknown problem, -and is a lower priority than making @code{g77} and @code{gdb} -work together properly. - -On the other hand, information about problems other debuggers -have with @code{g77} output might make it easier to properly -fix @code{g77}, and perhaps even improve @code{gdb}, so it -is definitely welcome. -Such information might even lead to all relevant products -working together properly sooner. - @cindex padding @cindex structures @cindex common blocks @cindex equivalence areas @item @code{g77} currently inserts needless padding for things like -@samp{COMMON A,IPAD} where @samp{A} is @code{CHARACTER*1} and @samp{IPAD} -is @code{INTEGER(KIND=1)} on machines like x86, because +@samp{COMMON A,IPAD} where @samp{A} is @samp{CHARACTER*1} and @samp{IPAD} +is @samp{INTEGER*4} on machines like x86, because the back end insists that @samp{IPAD} be aligned to a 4-byte boundary, but the processor has no such requirement (though it's good for performance). @@ -191,15 +187,6 @@ is the potential, with the current setup, for interface differences in the way such areas are laid out between @code{g77} and other compilers. -@item -Some crashes occur when compiling under Solaris on x86 -machines. - -Nothing has been heard about any such problems for some time, -so this is considering a closed item as of 0.5.20. -Please submit any bug reports pertinent to @code{g77}'s support -for Solaris/x86 systems. - @cindex RS/6000 support @cindex support, RS/6000 @item @@ -210,11 +197,6 @@ likely to be a code-generation bug in @file{gcc-2.7.0} plus @file{g77-0.5.16}. This problem shows up only when compiling the Fortran program with @samp{-O}. -Nothing has been heard about any RS/6000 problems for some time, -so this is considering a closed item as of 0.5.20. -Please submit any bug reports pertinent to @code{g77}'s support -for RS/6000 systems. - @cindex SGI support @cindex support, SGI @item @@ -222,50 +204,29 @@ SGI support is known to be a bit buggy. The known problem shows up only when compiling the Fortran program with @samp{-O}. -It is possible these problems have all been fixed in 0.5.20 by -emulating complex arithmetic in the front end. -Please submit any bug reports pertinent to @code{g77}'s support -for SGI systems. - -@cindex Alpha, support +@cindex Alpha support @cindex support, Alpha @item -@code{g77} doesn't work perfectly on 64-bit configurations such as the Alpha. +@code{g77} doesn't work on 64-bit configurations such as the Alpha. This problem is expected to be largely resolved as of version 0.5.20, and version 0.6 should solve most or all related problems (such as 64-bit machines other than DEC Alphas). -One known bug that causes a compile-time crash occurs when compiling -code such as the following with optimization: - -@example -SUBROUTINE CRASH (TEMP) -INTEGER*2 HALF(2) -REAL TEMP -HALF(1) = NINT (TEMP) -END -@end example - -It is expected that a future version of @code{g77} will have a fix for this -problem, almost certainly by the time @code{g77} supports the forthcoming -version 2.8.0 of @code{gcc}. - @cindex COMPLEX support @cindex support, COMPLEX @item Maintainers of gcc report that the back end definitely has ``broken'' -support for @code{COMPLEX} types. +support for @samp{COMPLEX} types. Based on their input, it seems many of the problems affect only the more-general facilities for gcc's -@code{__complex__} type, such as @code{__complex__ int} +@samp{__complex__} type, such as @samp{__complex__ int} (where the real and imaginary parts are integers) that GNU Fortran does not use. -Version 0.5.20 of @code{g77} works around this -problem by not using the back end's support for @code{COMPLEX}. -The new option @samp{-fno-emulate-complex} avoids the work-around, -reverting to using the same ``broken'' mechanism as that used -by versions of @code{g77} prior to 0.5.20. +Version 0.5.20 of @code{g77} is expected to work around this +problem by not using the back end's support for @samp{COMPLEX}. +This work has already been done, and is being tested by +developers. @cindex ELF support @cindex support, ELF @@ -281,5 +242,7 @@ More investigation is needed, but the problem is almost certainly in the gcc back end, and it apparently occurs only when compiling sufficiently complicated functions @emph{without} the @samp{-O} option. + +This might be fixed in version 2.7.2 of @code{gcc}. @end itemize diff --git a/gnu/usr.bin/gcc/f/com-rt.def b/gnu/usr.bin/gcc/f/com-rt.def index e32cce03c53..dae8b2a864f 100644 --- a/gnu/usr.bin/gcc/f/com-rt.def +++ b/gnu/usr.bin/gcc/f/com-rt.def @@ -1,5 +1,5 @@ /* com-rt.def -- Public #include File (module.h template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -108,7 +108,6 @@ DEFGFRT (FFECOM_gfrtFREW, "f_rew", FFECOM_rttypeINTEGER_, 0, FALSE, FALSE) DEFGFRT (FFECOM_gfrtABORT, "abort_", FFECOM_rttypeVOID_, 0, TRUE, FALSE) DEFGFRT (FFECOM_gfrtABS, "r_abs", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtACCESS, "access_", FFECOM_rttypeINTEGER_, "&a&a", FALSE, FALSE) DEFGFRT (FFECOM_gfrtACOS, "r_acos", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) DEFGFRT (FFECOM_gfrtAIMAG, "r_imag", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) DEFGFRT (FFECOM_gfrtAINT, "r_int", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) @@ -119,43 +118,27 @@ DEFGFRT (FFECOM_gfrtANINT, "r_nint", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) DEFGFRT (FFECOM_gfrtASIN, "r_asin", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) DEFGFRT (FFECOM_gfrtATAN, "r_atan", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) DEFGFRT (FFECOM_gfrtATAN2, "r_atn2", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtBESJ0, "j0", FFECOM_rttypeDOUBLE_, "d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtBESJ1, "j1", FFECOM_rttypeDOUBLE_, "d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtBESJN, "jn", FFECOM_rttypeDOUBLE_, "id", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtBESY0, "y0", FFECOM_rttypeDOUBLE_, "d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtBESY1, "y1", FFECOM_rttypeDOUBLE_, "d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtBESYN, "yn", FFECOM_rttypeDOUBLE_, "id", FALSE, FALSE) DEFGFRT (FFECOM_gfrtCABS, "c_abs", FFECOM_rttypeDOUBLE_, "&c", FALSE, FALSE) DEFGFRT (FFECOM_gfrtCCOS, "c_cos", FFECOM_rttypeCOMPLEX_, "&c", FALSE, TRUE) DEFGFRT (FFECOM_gfrtCEXP, "c_exp", FFECOM_rttypeCOMPLEX_, "&c", FALSE, TRUE) -DEFGFRT (FFECOM_gfrtCHDIR, "chdir_", FFECOM_rttypeINTEGER_, "&a", FALSE, FALSE) DEFGFRT (FFECOM_gfrtCLOG, "c_log", FFECOM_rttypeCOMPLEX_, "&c", FALSE, TRUE) -DEFGFRT (FFECOM_gfrtCHMOD, "chmod_", FFECOM_rttypeINTEGER_, "&a&a", FALSE, FALSE) DEFGFRT (FFECOM_gfrtCONJG, "r_cnjg", FFECOM_rttypeCOMPLEX_, "&c", FALSE, TRUE) DEFGFRT (FFECOM_gfrtCOS, "r_cos", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) DEFGFRT (FFECOM_gfrtCOSH, "r_cosh", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) DEFGFRT (FFECOM_gfrtCSIN, "c_sin", FFECOM_rttypeCOMPLEX_, "&c", FALSE, TRUE) DEFGFRT (FFECOM_gfrtCSQRT, "c_sqrt", FFECOM_rttypeCOMPLEX_, "&c", FALSE, TRUE) -DEFGFRT (FFECOM_gfrtCTIME, "ctime_", FFECOM_rttypeCHARACTER_, "j", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDABS, "d_abs", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDACOS, "d_acos", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDASIN, "d_asin", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDATAN, "d_atan", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDATAN2, "d_atn2", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtDATE, "date_", FFECOM_rttypeVOID_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtDBESJ0, "j0", FFECOM_rttypeDOUBLE_, "d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtDBESJ1, "j1", FFECOM_rttypeDOUBLE_, "d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtDBESJN, "jn", FFECOM_rttypeDOUBLE_, "id", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtDBESY0, "y0", FFECOM_rttypeDOUBLE_, "d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtDBESY1, "y1", FFECOM_rttypeDOUBLE_, "d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtDBESYN, "yn", FFECOM_rttypeDOUBLE_, "id", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDCOS, "d_cos", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDCOSH, "d_cosh", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDDIM, "d_dim", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDERF, "derf_", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDERFC, "derfc_", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDEXP, "d_exp", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtDIM, "r_dim", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtDIM, "r_dim", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDINT, "d_int", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDLOG, "d_log", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDLOG10, "d_lg10", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) @@ -168,81 +151,36 @@ DEFGFRT (FFECOM_gfrtDSINH, "d_sinh", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDSQRT, "d_sqrt", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDTAN, "d_tan", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) DEFGFRT (FFECOM_gfrtDTANH, "d_tanh", FFECOM_rttypeDOUBLE_, "&d", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtDTIME, "dtime_", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtERF, "erf_", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtERFC, "erfc_", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtETIME, "etime_", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtERF, "erf_", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtERFC, "erfc_", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) DEFGFRT (FFECOM_gfrtEXIT, "exit_", FFECOM_rttypeVOID_, "&i", TRUE, FALSE) -DEFGFRT (FFECOM_gfrtEXP, "r_exp", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtFDATE, "fdate_", FFECOM_rttypeCHARACTER_, 0, FALSE, FALSE) -DEFGFRT (FFECOM_gfrtFGET, "fget_", FFECOM_rttypeINTEGER_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtFGETC, "fgetc_", FFECOM_rttypeINTEGER_, "&i&a", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtEXP, "r_exp", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) DEFGFRT (FFECOM_gfrtFLUSH, "flush_", FFECOM_rttypeVOID_, 0, FALSE, FALSE) -DEFGFRT (FFECOM_gfrtFLUSH1, "flush1_", FFECOM_rttypeVOID_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtFNUM, "fnum_", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtFPUT, "fput_", FFECOM_rttypeINTEGER_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtFPUTC, "fputc_", FFECOM_rttypeINTEGER_, "&i&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtFSTAT, "fstat_", FFECOM_rttypeINTEGER_, "&i&", FALSE, FALSE) DEFGFRT (FFECOM_gfrtFTELL, "ftell_", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtFSEEK, "fseek_", FFECOM_rttypeINTEGER_, "&i&i&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtGERROR, "gerror_", FFECOM_rttypeVOID_, "&a", FALSE, FALSE) DEFGFRT (FFECOM_gfrtGETARG, "getarg_", FFECOM_rttypeVOID_, "&i&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtGETCWD, "getcwd_", FFECOM_rttypeINTEGER_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtGETGID, "getgid_", FFECOM_rttypeINTEGER_, 0, FALSE, FALSE) -DEFGFRT (FFECOM_gfrtGETLOG, "getlog_", FFECOM_rttypeVOID_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtGETPID, "getpid_", FFECOM_rttypeINTEGER_, 0, FALSE, FALSE) -DEFGFRT (FFECOM_gfrtGETUID, "getuid_", FFECOM_rttypeINTEGER_, 0, FALSE, FALSE) DEFGFRT (FFECOM_gfrtGETENV, "getenv_", FFECOM_rttypeVOID_, "&a&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtGMTIME, "gmtime_", FFECOM_rttypeVOID_, "&i&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtHOSTNM, "hostnm_", FFECOM_rttypeINTEGER_, "&a", FALSE, FALSE) DEFGFRT (FFECOM_gfrtIABS, "i_abs", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtIARGC, "iargc_", FFECOM_rttypeINTEGER_, 0, FALSE, FALSE) -DEFGFRT (FFECOM_gfrtIDATE, "idate_", FFECOM_rttypeVOID_, "&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtIDIM, "i_dim", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtIDNINT, "i_dnnt", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtIERRNO, "ierrno_", FFECOM_rttypeINTEGER_, 0, FALSE, FALSE) DEFGFRT (FFECOM_gfrtINDEX, "i_indx", FFECOM_rttypeINTEGER_, "&a&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtIRAND, "irand_", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtISIGN, "i_sign", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtISATTY, "isatty_", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtITIME, "itime_", FFECOM_rttypeVOID_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtKILL, "kill_", FFECOM_rttypeINTEGER_, "&i&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtLEN, "i_len", FFECOM_rttypeINTEGER_, "&a", FALSE, FALSE) DEFGFRT (FFECOM_gfrtLGE, "l_ge", FFECOM_rttypeLOGICAL_, "&a", FALSE, FALSE) DEFGFRT (FFECOM_gfrtLGT, "l_gt", FFECOM_rttypeLOGICAL_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtLINK, "link_", FFECOM_rttypeINTEGER_, "&a&a", FALSE, FALSE) DEFGFRT (FFECOM_gfrtLLE, "l_le", FFECOM_rttypeLOGICAL_, "&a", FALSE, FALSE) DEFGFRT (FFECOM_gfrtLLT, "l_lt", FFECOM_rttypeLOGICAL_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtLNBLNK, "lnblnk_", FFECOM_rttypeINTEGER_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtLSTAT, "lstat_", FFECOM_rttypeINTEGER_, "&a&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtLTIME, "ltime_", FFECOM_rttypeVOID_, "&i&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtMCLOCK, "mclock_", FFECOM_rttypeLONGINT_, 0, FALSE, FALSE) DEFGFRT (FFECOM_gfrtMOD, "i_mod", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtNINT, "i_nint", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtPERROR, "perror_", FFECOM_rttypeVOID_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtRAND, "rand_", FFECOM_rttypeDOUBLE_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtRENAME, "rename_", FFECOM_rttypeINTEGER_, "&a&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSECNDS, "secnds_", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSECOND, "second_", FFECOM_rttypeDOUBLE_, 0, FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSIGN, "r_sign", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtSIGN, "r_sign", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) DEFGFRT (FFECOM_gfrtSIGNAL, "signal_", FFECOM_rttypeINTEGER_, "&i0", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSIN, "r_sin", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSINH, "r_sinh", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSLEEP, "sleep_", FFECOM_rttypeVOID_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSQRT, "r_sqrt", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSRAND, "srand_", FFECOM_rttypeVOID_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSTAT, "stat_", FFECOM_rttypeINTEGER_, "&a&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSYMLNK, "symlnk_", FFECOM_rttypeINTEGER_, "&a&a", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtSIN, "r_sin", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtSINH, "r_sinh", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtSQRT, "r_sqrt", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) DEFGFRT (FFECOM_gfrtSYSTEM, "system_", FFECOM_rttypeINTEGER_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtSYSTEM_CLOCK, "system_clock_", FFECOM_rttypeVOID_, "&i&i&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtTAN, "r_tan", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtTANH, "r_tanh", FFECOM_rttypeDOUBLE_, "&f", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtTIME, "time_", FFECOM_rttypeLONGINT_, 0, FALSE, FALSE) -DEFGFRT (FFECOM_gfrtTTYNAM, "ttynam_", FFECOM_rttypeCHARACTER_, "i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtUNLINK, "unlink_", FFECOM_rttypeINTEGER_, "&a", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtUMASK, "umask_", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtVXTIDATE, "vxtidate_", FFECOM_rttypeVOID_, "&i&i&i", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtVXTTIME, "vxttime_", FFECOM_rttypeVOID_, "&a", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtTAN, "r_tan", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtTANH, "r_tanh", FFECOM_rttypeDOUBLE_, "&r", FALSE, FALSE) DEFGFRT (FFECOM_gfrtCDABS, "z_abs", FFECOM_rttypeDOUBLE_, "&e", FALSE, FALSE) DEFGFRT (FFECOM_gfrtCDCOS, "z_cos", FFECOM_rttypeDBLCMPLX_, "&e", FALSE, TRUE) DEFGFRT (FFECOM_gfrtCDEXP, "z_exp", FFECOM_rttypeDBLCMPLX_, "&e", FALSE, TRUE) @@ -274,7 +212,7 @@ DEFGFRT (FFECOM_gfrtPOW_DD, "pow_dd", FFECOM_rttypeDOUBLE_, "&d&d", FALSE, FALSE DEFGFRT (FFECOM_gfrtPOW_DI, "pow_di", FFECOM_rttypeDOUBLE_, "&d&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtPOW_II, "pow_ii", FFECOM_rttypeINTEGER_, "&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtPOW_QQ, "pow_qq", FFECOM_rttypeLONGINT_, "&j&j", FALSE, FALSE) -DEFGFRT (FFECOM_gfrtPOW_RI, "pow_ri", FFECOM_rttypeDOUBLE_, "&f&i", FALSE, FALSE) +DEFGFRT (FFECOM_gfrtPOW_RI, "pow_ri", FFECOM_rttypeDOUBLE_, "&r&i", FALSE, FALSE) DEFGFRT (FFECOM_gfrtPOW_ZI, "pow_zi", FFECOM_rttypeDBLCMPLX_, "&e&i", FALSE, TRUE) DEFGFRT (FFECOM_gfrtPOW_ZZ, "pow_zz", FFECOM_rttypeDBLCMPLX_, "&e&e", FALSE, TRUE) DEFGFRT (FFECOM_gfrtDIV_CC, "c_div", FFECOM_rttypeCOMPLEX_, "&c", FALSE, TRUE) diff --git a/gnu/usr.bin/gcc/f/com.c b/gnu/usr.bin/gcc/f/com.c index f1f3a50c799..e6661c6b53a 100644 --- a/gnu/usr.bin/gcc/f/com.c +++ b/gnu/usr.bin/gcc/f/com.c @@ -1,5 +1,5 @@ /* com.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -302,15 +302,11 @@ ffecomSymbol ffecom_symbol_null_ NULL_TREE, NULL_TREE, }; -ffeinfoKindtype ffecom_pointer_kind_ = FFEINFO_basictypeNONE; -ffeinfoKindtype ffecom_label_kind_ = FFEINFO_basictypeNONE; int ffecom_f2c_typecode_[FFEINFO_basictype][FFEINFO_kindtype]; tree ffecom_f2c_integer_type_node; -tree ffecom_f2c_ptr_to_integer_type_node; tree ffecom_f2c_address_type_node; tree ffecom_f2c_real_type_node; -tree ffecom_f2c_ptr_to_real_type_node; tree ffecom_f2c_doublereal_type_node; tree ffecom_f2c_complex_type_node; tree ffecom_f2c_doublecomplex_type_node; @@ -354,7 +350,6 @@ typedef enum FFECOM_rttypeDOUBLE_, /* C's `double' type. */ FFECOM_rttypeDOUBLEREAL_, FFECOM_rttypeDBLCMPLX_, - FFECOM_rttypeCHARACTER_, /* f2c `char *'/`ftnlen' pair. */ FFECOM_rttype_ } ffecomRttype_; @@ -754,210 +749,6 @@ static tree shadowed_labels; #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */ -/* This is like gcc's stabilize_reference -- in fact, most of the code - comes from that -- but it handles the situation where the reference - is going to have its subparts picked at, and it shouldn't change - (or trigger extra invocations of functions in the subtrees) due to - this. save_expr is a bit overzealous, because we don't need the - entire thing calculated and saved like a temp. So, for DECLs, no - change is needed, because these are stable aggregates, and ARRAY_REF - and such might well be stable too, but for things like calculations, - we do need to calculate a snapshot of a value before picking at it. */ - -#if FFECOM_targetCURRENT == FFECOM_targetGCC -tree -ffecom_stabilize_aggregate_ (tree ref) -{ - tree result; - enum tree_code code = TREE_CODE (ref); - - switch (code) - { - case VAR_DECL: - case PARM_DECL: - case RESULT_DECL: - /* No action is needed in this case. */ - return ref; - - case NOP_EXPR: - case CONVERT_EXPR: - case FLOAT_EXPR: - case FIX_TRUNC_EXPR: - case FIX_FLOOR_EXPR: - case FIX_ROUND_EXPR: - case FIX_CEIL_EXPR: - result = build_nt (code, stabilize_reference (TREE_OPERAND (ref, 0))); - break; - - case INDIRECT_REF: - result = build_nt (INDIRECT_REF, - stabilize_reference_1 (TREE_OPERAND (ref, 0))); - break; - - case COMPONENT_REF: - result = build_nt (COMPONENT_REF, - stabilize_reference (TREE_OPERAND (ref, 0)), - TREE_OPERAND (ref, 1)); - break; - - case BIT_FIELD_REF: - result = build_nt (BIT_FIELD_REF, - stabilize_reference (TREE_OPERAND (ref, 0)), - stabilize_reference_1 (TREE_OPERAND (ref, 1)), - stabilize_reference_1 (TREE_OPERAND (ref, 2))); - break; - - case ARRAY_REF: - result = build_nt (ARRAY_REF, - stabilize_reference (TREE_OPERAND (ref, 0)), - stabilize_reference_1 (TREE_OPERAND (ref, 1))); - break; - - case COMPOUND_EXPR: - result = build_nt (COMPOUND_EXPR, - stabilize_reference_1 (TREE_OPERAND (ref, 0)), - stabilize_reference (TREE_OPERAND (ref, 1))); - break; - - case RTL_EXPR: - result = build1 (INDIRECT_REF, TREE_TYPE (ref), - save_expr (build1 (ADDR_EXPR, - build_pointer_type (TREE_TYPE (ref)), - ref))); - break; - - - default: - return save_expr (ref); - - case ERROR_MARK: - return error_mark_node; - } - - TREE_TYPE (result) = TREE_TYPE (ref); - TREE_READONLY (result) = TREE_READONLY (ref); - TREE_SIDE_EFFECTS (result) = TREE_SIDE_EFFECTS (ref); - TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (ref); - TREE_RAISES (result) = TREE_RAISES (ref); - - return result; -} -#endif - -/* A rip-off of gcc's convert.c convert_to_complex function, - reworked to handle complex implemented as C structures - (RECORD_TYPE with two fields, real and imaginary `r' and `i'). */ - -#if FFECOM_targetCURRENT == FFECOM_targetGCC -tree -ffecom_convert_to_complex_ (tree type, tree expr) -{ - register enum tree_code form = TREE_CODE (TREE_TYPE (expr)); - tree subtype; - - assert (TREE_CODE (type) == RECORD_TYPE); - - subtype = TREE_TYPE (TYPE_FIELDS (type)); - - if (form == REAL_TYPE || form == INTEGER_TYPE || form == ENUMERAL_TYPE) - { - expr = convert (subtype, expr); - return ffecom_2 (COMPLEX_EXPR, type, expr, - convert (subtype, integer_zero_node)); - } - - if (form == RECORD_TYPE) - { - tree elt_type = TREE_TYPE (TYPE_FIELDS (TREE_TYPE (expr))); - if (TYPE_MAIN_VARIANT (elt_type) == TYPE_MAIN_VARIANT (subtype)) - return expr; - else - { - expr = save_expr (expr); - return ffecom_2 (COMPLEX_EXPR, - type, - convert (subtype, - ffecom_1 (REALPART_EXPR, - TREE_TYPE (TYPE_FIELDS (TREE_TYPE (expr))), - expr)), - convert (subtype, - ffecom_1 (IMAGPART_EXPR, - TREE_TYPE (TYPE_FIELDS (TREE_TYPE (expr))), - expr))); - } - } - - if (form == POINTER_TYPE || form == REFERENCE_TYPE) - error ("pointer value used where a complex was expected"); - else - error ("aggregate value used where a complex was expected"); - - return ffecom_2 (COMPLEX_EXPR, type, - convert (subtype, integer_zero_node), - convert (subtype, integer_zero_node)); -} -#endif - -/* Handles making a COMPLEX type, either the standard - (but buggy?) gbe way, or the safer (but less elegant?) - f2c way. */ - -#if FFECOM_targetCURRENT == FFECOM_targetGCC -static tree -ffecom_make_complex_type_ (tree subtype) -{ - tree type; - tree realfield; - tree imagfield; - - if (ffe_is_emulate_complex ()) - { - type = make_node (RECORD_TYPE); - realfield = ffecom_decl_field (type, NULL_TREE, "r", subtype); - imagfield = ffecom_decl_field (type, realfield, "i", subtype); - TYPE_FIELDS (type) = realfield; - layout_type (type); - } - else - { - type = make_node (COMPLEX_TYPE); - TREE_TYPE (type) = subtype; - layout_type (type); - } - - return type; -} -#endif - -/* Chooses either the gbe or the f2c way to build a - complex constant. */ - -#if FFECOM_targetCURRENT == FFECOM_targetGCC -static tree -ffecom_build_complex_constant_ (tree type, tree realpart, tree imagpart) -{ - tree bothparts; - - if (ffe_is_emulate_complex ()) - { - bothparts = build_tree_list (TYPE_FIELDS (type), realpart); - TREE_CHAIN (bothparts) = build_tree_list (TREE_CHAIN (TYPE_FIELDS (type)), imagpart); - bothparts = build (CONSTRUCTOR, type, NULL_TREE, bothparts); - } - else - { -#if BUILT_FOR_280 - bothparts = build_complex (NULL_TREE, realpart, imagpart); -#else - bothparts = build_complex (realpart, imagpart); -#endif - TREE_TYPE (bothparts) = type; - } - - return bothparts; -} -#endif - #if FFECOM_targetCURRENT == FFECOM_targetGCC static tree ffecom_arglist_expr_ (char *c, ffebld expr) @@ -1378,7 +1169,7 @@ ffecom_build_f2c_string_ (int i, char *s) #endif /* Returns CALL_EXPR or equivalent with given type (pass NULL_TREE for type to just get whatever the function returns), handling the - f2c value-returning convention, if required, by prepending + f2c complex-returning convention, if required, by prepending to the arglist a pointer to a temporary to receive the return value. */ #if FFECOM_targetCURRENT == FFECOM_targetGCC @@ -1700,55 +1491,45 @@ ffecom_char_args_ (tree *xitem, tree *length, ffebld expr) { ffesymbol s = ffebld_symter (ffebld_left (expr)); tree tempvar; + tree dt; tree args; - ffetargetCharacterSize size = ffeinfo_size (ffebld_info (expr)); - - if (size == FFETARGET_charactersizeNONE) - size = 24; /* ~~~~ Kludge alert! This should someday be fixed. */ - *length = build_int_2 (size, 0); + *length = build_int_2 (ffeinfo_size (ffebld_info (expr)), 0); TREE_TYPE (*length) = ffecom_f2c_ftnlen_type_node; if (ffeinfo_where (ffebld_info (ffebld_left (expr))) == FFEINFO_whereINTRINSIC) - { - ffecomGfrt ix; - - if (size == 1) - { /* Invocation of an intrinsic returning CHARACTER*1. */ - item = ffecom_expr_intrinsic_ (expr, NULL_TREE, - NULL, NULL); - break; - } - ix = ffeintrin_gfrt (ffebld_symter_implementation (ffebld_left (expr))); - assert (ix != FFECOM_gfrt); - item = ffecom_gfrt_tree_ (ix); - } - else - { - item = ffesymbol_hook (s).decl_tree; - if (item == NULL_TREE) - { - s = ffecom_sym_transform_ (s); - item = ffesymbol_hook (s).decl_tree; - } - if (item == error_mark_node) - { - item = *length = error_mark_node; - break; - } - - if (!ffesymbol_hook (s).addr) - item = ffecom_1_fn (item); + { /* Invocation of an intrinsic. */ + item = ffecom_expr_intrinsic_ (expr, NULL_TREE, + NULL, NULL); + break; } assert (ffecom_pending_calls_ != 0); - tempvar = ffecom_push_tempvar (char_type_node, size, -1, TRUE); + tempvar = ffecom_push_tempvar (char_type_node, + ffeinfo_size (ffebld_info (expr)), + -1, TRUE); tempvar = ffecom_1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (tempvar)), tempvar); ffecom_push_calltemps (); + dt = ffesymbol_hook (s).decl_tree; + if (dt == NULL_TREE) + { + s = ffecom_sym_transform_ (s); + dt = ffesymbol_hook (s).decl_tree; + } + if (dt == error_mark_node) + { + item = *length = error_mark_node; + break; + } + + if (ffesymbol_hook (s).addr) + item = dt; + else + item = ffecom_1_fn (dt); args = build_tree_list (NULL_TREE, tempvar); @@ -2137,8 +1918,6 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) tree result; /* Var holding result. */ ffeinfoBasictype bt; ffeinfoKindtype kt; - ffeglobal g; - ffeglobalType gt; bool charfunc; /* All entry points return same type CHARACTER. */ bool cmplxfunc; /* Use f2c way of returning COMPLEX. */ @@ -2164,7 +1943,6 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) /* Determine actual return type for function. */ - gt = FFEGLOBAL_typeFUNC; bt = ffesymbol_basictype (fn); kt = ffesymbol_kindtype (fn); if (bt == FFEINFO_basictypeNONE) @@ -2199,7 +1977,6 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) break; case FFEINFO_kindSUBROUTINE: - gt = FFEGLOBAL_typeSUBR; bt = FFEINFO_basictypeNONE; kt = FFEINFO_kindtypeNONE; if (ffecom_is_altreturning_) @@ -2230,7 +2007,6 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) assert ("say what??" == NULL); /* Fall through. */ case FFEINFO_kindANY: - gt = FFEGLOBAL_typeANY; bt = FFEINFO_basictypeNONE; kt = FFEINFO_kindtypeNONE; type = error_mark_node; @@ -2250,12 +2026,6 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) 0, /* nested/inline */ 1); /* TREE_PUBLIC */ - if (((g = ffesymbol_global (fn)) != NULL) - && (ffeglobal_type (g) == gt)) - { - ffeglobal_set_hook (g, current_function_decl); - } - /* Reset args in master arg list so they get retransitioned. */ for (item = ffecom_master_arglist_; @@ -2531,7 +2301,7 @@ ffecom_expr_ (ffebld expr, tree dest_tree, case FFEBLD_opACCTER: tree_type = ffecom_tree_type[bt][kt]; { - ffebitCount i; + ffetargetOffset i; ffebit bits = ffebld_accter_bits (expr); ffetargetOffset source_offset = 0; size_t size; @@ -2640,54 +2410,9 @@ ffecom_expr_ (ffebld expr, tree dest_tree, || (ffebld_symter_specific (expr) != FFEINTRIN_specNONE)) return ffecom_ptr_to_expr (expr); /* Same as %REF(intrinsic). */ s = ffebld_symter (expr); - t = ffesymbol_hook (s).decl_tree; - if (assignp) { /* ASSIGN'ed-label expr. */ - if (ffe_is_ugly_assign ()) - { - /* User explicitly wants ASSIGN'ed variables to be at the same - memory address as the variables when used in non-ASSIGN - contexts. That can make old, arcane, non-standard code - work, but don't try to do it when a pointer wouldn't fit - in the normal variable (take other approach, and warn, - instead). */ - - if (t == NULL_TREE) - { - s = ffecom_sym_transform_ (s); - t = ffesymbol_hook (s).decl_tree; - assert (t != NULL_TREE); - } - - if (t == error_mark_node) - return t; - - if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (t))) - >= GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (null_pointer_node)))) - { - if (ffesymbol_hook (s).addr) - t = ffecom_1 (INDIRECT_REF, - TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (t))), t); - return t; - } - - if (ffesymbol_hook (s).assign_tree == NULL_TREE) - { - ffebad_start_msg ("ASSIGN'ed label cannot fit into `%A' at %0 -- using wider sibling", - FFEBAD_severityWARNING); - ffebad_string (ffesymbol_text (s)); - ffebad_here (0, ffesymbol_where_line (s), - ffesymbol_where_column (s)); - ffebad_finish (); - } - } - - /* Don't use the normal variable's tree for ASSIGN, though mark - it as in the system header (housekeeping). Use an explicit, - specially created sibling that is known to be wide enough - to hold pointers to labels. */ - + t = ffesymbol_hook (s).decl_tree; if (t != NULL_TREE) DECL_IN_SYSTEM_HEADER (t) = 1; /* Don't let -Wunused complain. */ @@ -2701,6 +2426,7 @@ ffecom_expr_ (ffebld expr, tree dest_tree, } else { + t = ffesymbol_hook (s).decl_tree; if (t == NULL_TREE) { s = ffecom_sym_transform_ (s); @@ -2855,7 +2581,10 @@ ffecom_expr_ (ffebld expr, tree dest_tree, == FFEINFO_kindtypeREAL1) code = FFECOM_gfrtPOW_CI; /* Overlapping result okay. */ else - code = FFECOM_gfrtPOW_ZI; /* Overlapping result okay. */ + { + code = FFECOM_gfrtPOW_ZI; + dest_used = NULL; /* This one doesn't work with overlapping result. */ + } break; default: @@ -3112,8 +2841,7 @@ ffecom_expr_ (ffebld expr, tree dest_tree, item = ffecom_expr (ffebld_left (expr)); if (item == error_mark_node) return error_mark_node; - /* convert() takes care of converting to the subtype first, - at least in gcc-2.7.2. */ + item = convert (TREE_TYPE (tree_type), item); item = convert (tree_type, item); return item; @@ -3185,16 +2913,8 @@ ffecom_expr_ (ffebld expr, tree dest_tree, arg1 = ffecom_save_tree (arg1); arg2 = ffecom_save_tree (arg2); - if (TREE_CODE (TREE_TYPE (arg1)) == COMPLEX_TYPE) - { - real_type = TREE_TYPE (TREE_TYPE (arg1)); - assert (real_type == TREE_TYPE (TREE_TYPE (arg2))); - } - else - { - real_type = TREE_TYPE (TYPE_FIELDS (TREE_TYPE (arg1))); - assert (real_type == TREE_TYPE (TYPE_FIELDS (TREE_TYPE (arg2)))); - } + real_type = TREE_TYPE (TREE_TYPE (arg1)); + assert (real_type == TREE_TYPE (TREE_TYPE (arg2))); item = ffecom_2 (TRUTH_ANDIF_EXPR, integer_type_node, @@ -3372,7 +3092,6 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, ffebld arg2; ffebld arg3; ffecomGfrt ix; - ffeintrinImp codegen_imp; assert (ffebld_op (ffebld_left (expr)) == FFEBLD_opSYMTER); @@ -3426,7 +3145,7 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, A standard call is made to the specific intrinsic just as if it had been passed in as a dummy procedure and called as any old procedure. This - method can produce slower code but in some cases it's the easiest way for + method can produce slower code but in some cases its the easiest way for now. goto library; @@ -3443,9 +3162,8 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, /* For info on how the switch statement cases were written, see the files enclosed in comments below the switch statement. */ - codegen_imp = ffeintrin_codegen_imp (ffebld_symter_implementation - (ffebld_left (expr))); - switch (codegen_imp) + switch (ffeintrin_codegen_imp + (ffebld_symter_implementation (ffebld_left (expr)))) { case FFEINTRIN_impABS: /* Plus impCABS, impCDABS, impDABS, impIABS. */ if (ffeinfo_basictype (ffebld_info (arg1)) @@ -3478,14 +3196,9 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, goto library; /* :::::::::::::::::::: */ case FFEINTRIN_impAIMAG: /* Plus impDIMAG. */ - if (TREE_CODE (arg1_type) == COMPLEX_TYPE) - arg1_type = TREE_TYPE (arg1_type); - else - arg1_type = TREE_TYPE (TYPE_FIELDS (arg1_type)); - return convert (tree_type, - ffecom_1 (IMAGPART_EXPR, arg1_type, + ffecom_1 (IMAGPART_EXPR, TREE_TYPE (arg1_type), ffecom_expr (arg1))); case FFEINTRIN_impAINT: /* Plus impDINT. */ @@ -3629,48 +3342,43 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, return expr_tree; case FFEINTRIN_impCMPLX: + real_type = ffecom_tree_type[FFEINFO_basictypeREAL][kt]; if (arg2 == NULL) return convert (tree_type, ffecom_expr (arg1)); - real_type = ffecom_tree_type[FFEINFO_basictypeREAL][kt]; return ffecom_2 (COMPLEX_EXPR, tree_type, convert (real_type, ffecom_expr (arg1)), convert (real_type, ffecom_expr (arg2))); - case FFEINTRIN_impCOMPLEX: - return - ffecom_2 (COMPLEX_EXPR, tree_type, - ffecom_expr (arg1), - ffecom_expr (arg2)); - case FFEINTRIN_impCONJG: /* Plus impDCONJG. */ - { - tree arg1_tree; - - real_type = ffecom_tree_type[FFEINFO_basictypeREAL][kt]; - arg1_tree = ffecom_save_tree (ffecom_expr (arg1)); - return - ffecom_2 (COMPLEX_EXPR, tree_type, - ffecom_1 (REALPART_EXPR, real_type, arg1_tree), - ffecom_1 (NEGATE_EXPR, real_type, - ffecom_1 (IMAGPART_EXPR, real_type, arg1_tree))); - } + if (kt == FFEINFO_kindtypeREAL1) + ix = FFECOM_gfrtCONJG; + else if (kt == FFEINFO_kindtypeREAL2) + ix = FFECOM_gfrtDCONJG; + else + { + assert ("bad CONJG kind type" == NULL); + ix = FFECOM_gfrt; + } + dest_used = NULL; /* These don't work with overlapping result. */ + goto library; /* :::::::::::::::::::: */ case FFEINTRIN_impCOS: /* Plus impCCOS, impCDCOS, impDCOS. */ if (bt == FFEINFO_basictypeCOMPLEX) { if (kt == FFEINFO_kindtypeREAL1) - ix = FFECOM_gfrtCCOS; /* Overlapping result okay. */ + ix = FFECOM_gfrtCCOS; else if (kt == FFEINFO_kindtypeREAL2) - ix = FFECOM_gfrtCDCOS; /* Overlapping result okay. */ + ix = FFECOM_gfrtCDCOS; else { assert ("bad COS COMPLEX kind type" == NULL); ix = FFECOM_gfrt; } + dest_used = NULL; /* These don't work with overlapping result. */ } else { @@ -3699,10 +3407,6 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, goto library; /* :::::::::::::::::::: */ case FFEINTRIN_impDBLE: - case FFEINTRIN_impINT: - case FFEINTRIN_impREAL: - case FFEINTRIN_impLONG: - case FFEINTRIN_impSHORT: return convert (tree_type, ffecom_expr (arg1)); case FFEINTRIN_impDIM: /* Plus impDDIM, impIDIM. */ @@ -3731,14 +3435,15 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, if (bt == FFEINFO_basictypeCOMPLEX) { if (kt == FFEINFO_kindtypeREAL1) - ix = FFECOM_gfrtCEXP; /* Overlapping result okay. */ + ix = FFECOM_gfrtCEXP; else if (kt == FFEINFO_kindtypeREAL2) - ix = FFECOM_gfrtCDEXP; /* Overlapping result okay. */ + ix = FFECOM_gfrtCDEXP; else { assert ("bad EXP COMPLEX kind type" == NULL); ix = FFECOM_gfrt; } + dest_used = NULL; /* These don't work with overlapping result. */ } else { @@ -3780,6 +3485,9 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, case FFEINTRIN_impINDEX: break; + case FFEINTRIN_impINT: + return convert (tree_type, ffecom_expr (arg1)); + case FFEINTRIN_impLEN: #if 0 /* The simple approach. */ break; @@ -3803,14 +3511,15 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, if (bt == FFEINFO_basictypeCOMPLEX) { if (kt == FFEINFO_kindtypeREAL1) - ix = FFECOM_gfrtCLOG; /* Overlapping result okay. */ + ix = FFECOM_gfrtCLOG; else if (kt == FFEINFO_kindtypeREAL2) - ix = FFECOM_gfrtCDLOG; /* Overlapping result okay. */ + ix = FFECOM_gfrtCDLOG; else { assert ("bad LOG COMPLEX kind type" == NULL); ix = FFECOM_gfrt; } + dest_used = NULL; /* These don't work with overlapping result. */ } else { @@ -3923,6 +3632,9 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, ffecom_float_half_)))); #endif + case FFEINTRIN_impREAL: + return convert (tree_type, ffecom_expr (arg1)); + case FFEINTRIN_impSIGN: /* Plus impDSIGN, impISIGN. */ { tree arg2_tree = ffecom_expr (arg2); @@ -3953,14 +3665,15 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, if (bt == FFEINFO_basictypeCOMPLEX) { if (kt == FFEINFO_kindtypeREAL1) - ix = FFECOM_gfrtCSIN; /* Overlapping result okay. */ + ix = FFECOM_gfrtCSIN; else if (kt == FFEINFO_kindtypeREAL2) - ix = FFECOM_gfrtCDSIN; /* Overlapping result okay. */ + ix = FFECOM_gfrtCDSIN; else { assert ("bad SIN COMPLEX kind type" == NULL); ix = FFECOM_gfrt; } + dest_used = NULL; /* These don't work with overlapping result. */ } else { @@ -3992,14 +3705,15 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, if (bt == FFEINFO_basictypeCOMPLEX) { if (kt == FFEINFO_kindtypeREAL1) - ix = FFECOM_gfrtCSQRT; /* Overlapping result okay. */ + ix = FFECOM_gfrtCSQRT; else if (kt == FFEINFO_kindtypeREAL2) - ix = FFECOM_gfrtCDSQRT; /* Overlapping result okay. */ + ix = FFECOM_gfrtCDSQRT; else { assert ("bad SQRT COMPLEX kind type" == NULL); ix = FFECOM_gfrt; } + dest_used = NULL; /* These don't work with overlapping result. */ } else { @@ -4039,17 +3753,6 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, } goto library; /* :::::::::::::::::::: */ - case FFEINTRIN_impREALPART: - if (TREE_CODE (arg1_type) == COMPLEX_TYPE) - arg1_type = TREE_TYPE (arg1_type); - else - arg1_type = TREE_TYPE (TYPE_FIELDS (arg1_type)); - - return - convert (tree_type, - ffecom_1 (REALPART_EXPR, arg1_type, - ffecom_expr (arg1))); - case FFEINTRIN_impIAND: return ffecom_2 (BIT_AND_EXPR, tree_type, convert (tree_type, @@ -4351,34 +4054,26 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, case FFEINTRIN_impMVBITS: { tree arg1_tree; - tree arg2_tree; - tree arg3_tree; + tree arg2_tree = convert (integer_type_node, + ffecom_expr (arg2)); + tree arg3_tree = ffecom_save_tree (convert (integer_type_node, + ffecom_expr (arg3))); ffebld arg4 = ffebld_head (ffebld_trail (list)); tree arg4_tree; tree arg4_type; ffebld arg5 = ffebld_head (ffebld_trail (ffebld_trail (list))); - tree arg5_tree; + tree arg5_tree = ffecom_save_tree (convert (integer_type_node, + ffecom_expr (arg5))); tree prep_arg1; tree prep_arg4; tree arg5_plus_arg3; - ffecom_push_calltemps (); - - arg2_tree = convert (integer_type_node, - ffecom_expr (arg2)); - arg3_tree = ffecom_save_tree (convert (integer_type_node, - ffecom_expr (arg3))); arg4_tree = ffecom_expr_rw (arg4); arg4_type = TREE_TYPE (arg4_tree); arg1_tree = ffecom_save_tree (convert (arg4_type, ffecom_expr (arg1))); - arg5_tree = ffecom_save_tree (convert (integer_type_node, - ffecom_expr (arg5))); - - ffecom_pop_calltemps (); - prep_arg1 = ffecom_2 (LSHIFT_EXPR, arg4_type, ffecom_2 (BIT_AND_EXPR, arg4_type, @@ -4557,15 +4252,10 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, return expr_tree; case FFEINTRIN_impSYSTEM: - case FFEINTRIN_impUNLINK: - case FFEINTRIN_impCHDIR: - case FFEINTRIN_impFPUT: - case FFEINTRIN_impFGET: { tree arg1_len = integer_zero_node; tree arg1_tree; tree arg2_tree; - ffecomGfrt gfrt = ffeintrin_gfrt (codegen_imp); ffecom_push_calltemps (); @@ -4583,10 +4273,10 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, TREE_CHAIN (arg1_tree) = arg1_len; expr_tree - = ffecom_call_ (ffecom_gfrt_tree_ (gfrt), - ffecom_gfrt_kind_type_ (gfrt), + = ffecom_call_ (ffecom_gfrt_tree_ (FFECOM_gfrtSYSTEM), + ffecom_gfrt_kind_type_ (FFECOM_gfrtSYSTEM), FALSE, - ffecom_f2c_integer_type_node, + integer_type_node, arg1_tree, NULL_TREE, NULL, NULL, NULL_TREE, TRUE); @@ -4602,11 +4292,17 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, if (arg1 != NULL) break; +#ifdef VMS_TARGET + expr_tree = ffecom_integer_zero_node; /* C lib translates this!! */ +#else + expr_tree = ffecom_integer_zero_node; +#endif + expr_tree = build_tree_list (NULL_TREE, ffecom_1 (ADDR_EXPR, build_pointer_type (ffecom_integer_type_node), - integer_zero_node)); + expr_tree)); return ffecom_call_ (ffecom_gfrt_tree_ (FFECOM_gfrtEXIT), @@ -4617,264 +4313,20 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, NULL_TREE, NULL, NULL, NULL_TREE, TRUE); case FFEINTRIN_impFLUSH: - if (arg1 == NULL) - ix = FFECOM_gfrtFLUSH; - else - ix = FFECOM_gfrtFLUSH1; - goto library; /* :::::::::::::::::::: */ - - case FFEINTRIN_impCHMOD: - case FFEINTRIN_impLINK: - case FFEINTRIN_impRENAME: - case FFEINTRIN_impSYMLNK: - { - tree arg1_len = integer_zero_node; - tree arg1_tree; - tree arg2_len = integer_zero_node; - tree arg2_tree; - tree arg3_tree; - ffecomGfrt gfrt = ffeintrin_gfrt (codegen_imp); - - ffecom_push_calltemps (); - - arg1_tree = ffecom_arg_ptr_to_expr (arg1, &arg1_len); - arg2_tree = ffecom_arg_ptr_to_expr (arg2, &arg2_len); - if (arg3 != NULL) - arg3_tree = ffecom_expr_rw (arg3); - else - arg3_tree = NULL_TREE; - - ffecom_pop_calltemps (); - - arg1_tree = build_tree_list (NULL_TREE, arg1_tree); - arg1_len = build_tree_list (NULL_TREE, arg1_len); - arg2_tree = build_tree_list (NULL_TREE, arg2_tree); - arg2_len = build_tree_list (NULL_TREE, arg2_len); - TREE_CHAIN (arg1_tree) = arg2_tree; - TREE_CHAIN (arg2_tree) = arg1_len; - TREE_CHAIN (arg1_len) = arg2_len; - expr_tree = ffecom_call_ (ffecom_gfrt_tree_ (gfrt), - ffecom_gfrt_kind_type_ (gfrt), - FALSE, - ffecom_f2c_integer_type_node, - arg1_tree, - NULL_TREE, NULL, NULL, NULL_TREE, TRUE); - if (arg3_tree != NULL_TREE) - expr_tree = ffecom_modify (NULL_TREE, arg3_tree, - convert (TREE_TYPE (arg3_tree), - expr_tree)); - } - return expr_tree; - - case FFEINTRIN_impFGETC: - case FFEINTRIN_impFPUTC: - { - tree arg1_tree; - tree arg2_tree; - tree arg2_len = integer_zero_node; - tree arg3_tree; - ffecomGfrt gfrt = ffeintrin_gfrt (codegen_imp); - - ffecom_push_calltemps (); - - arg1_tree = convert (ffecom_f2c_ptr_to_integer_type_node, - ffecom_ptr_to_expr (arg1)); - arg2_tree = ffecom_arg_ptr_to_expr (arg2, &arg2_len); - arg3_tree = ffecom_expr_rw (arg3); - - ffecom_pop_calltemps (); - - arg1_tree = build_tree_list (NULL_TREE, arg1_tree); - arg2_tree = build_tree_list (NULL_TREE, arg2_tree); - arg2_len = build_tree_list (NULL_TREE, arg2_len); - TREE_CHAIN (arg1_tree) = arg2_tree; - TREE_CHAIN (arg2_tree) = arg2_len; - - expr_tree = ffecom_call_ (ffecom_gfrt_tree_ (gfrt), - ffecom_gfrt_kind_type_ (gfrt), - FALSE, - ffecom_f2c_integer_type_node, - arg1_tree, - NULL_TREE, NULL, NULL, NULL_TREE, TRUE); - expr_tree = ffecom_modify (NULL_TREE, arg3_tree, - convert (TREE_TYPE (arg3_tree), - expr_tree)); - } - return expr_tree; - - case FFEINTRIN_impKILL: - { - tree arg1_tree; - tree arg2_tree; - tree arg3_tree; - ffecomGfrt gfrt = ffeintrin_gfrt (codegen_imp); - - ffecom_push_calltemps (); - - arg1_tree = convert (ffecom_f2c_ptr_to_integer_type_node, - ffecom_ptr_to_expr (arg1)); - arg2_tree = convert (ffecom_f2c_ptr_to_integer_type_node, - ffecom_ptr_to_expr (arg2)); - if (arg3 == NULL) - arg3_tree = NULL_TREE; - else - arg3_tree = ffecom_expr_rw (arg3); - - ffecom_pop_calltemps (); - - arg1_tree = build_tree_list (NULL_TREE, arg1_tree); - arg2_tree = build_tree_list (NULL_TREE, arg2_tree); - TREE_CHAIN (arg1_tree) = arg2_tree; - expr_tree = ffecom_call_ (ffecom_gfrt_tree_ (gfrt), - ffecom_gfrt_kind_type_ (gfrt), - FALSE, - ffecom_f2c_integer_type_node, - arg1_tree, - NULL_TREE, NULL, NULL, NULL_TREE, TRUE); - if (arg3_tree != NULL_TREE) { - expr_tree = ffecom_modify (NULL_TREE, arg3_tree, - convert (TREE_TYPE (arg3_tree), - expr_tree)); - } - } - return expr_tree; - - case FFEINTRIN_impIRAND: - case FFEINTRIN_impRAND: - /* Arg defaults to 0 (normal random case) */ - { - tree arg1_tree; - ffecomGfrt gfrt = ffeintrin_gfrt (codegen_imp); - - if (arg1 == NULL) - arg1_tree = ffecom_1 (ADDR_EXPR, - build_pointer_type - (ffecom_integer_type_node), - ffecom_integer_zero_node); - else - arg1_tree = ffecom_ptr_to_expr (arg1); - arg1_tree = convert (ffecom_f2c_ptr_to_integer_type_node, - arg1_tree); - arg1_tree = build_tree_list (NULL_TREE, arg1_tree); - return ffecom_call_ (ffecom_gfrt_tree_ (gfrt), - ffecom_gfrt_kind_type_ (gfrt), - FALSE, - ((codegen_imp == FFEINTRIN_impIRAND) ? - ffecom_f2c_integer_type_node : - ffecom_f2c_doublereal_type_node), - arg1_tree, - dest_tree, dest, dest_used, - NULL_TREE, TRUE); - } - - case FFEINTRIN_impUMASK: - { - tree arg1_tree; - tree arg2_tree; - ffecomGfrt gfrt = ffeintrin_gfrt (codegen_imp); - - ffecom_push_calltemps (); - - arg1_tree = convert (ffecom_f2c_ptr_to_integer_type_node, - ffecom_ptr_to_expr (arg1)); - if (arg2 == NULL) - arg2_tree = NULL_TREE; - else - arg2_tree = ffecom_expr_rw (arg2); - - ffecom_pop_calltemps (); - - expr_tree = ffecom_call_ (ffecom_gfrt_tree_ (gfrt), - ffecom_gfrt_kind_type_ (gfrt), - FALSE, - ffecom_f2c_integer_type_node, - build_tree_list (NULL_TREE, arg1_tree), - NULL_TREE, NULL, NULL, NULL_TREE, - TRUE); - if (arg2_tree != NULL_TREE) { - expr_tree = ffecom_modify (NULL_TREE, arg2_tree, - convert (TREE_TYPE (arg2_tree), - expr_tree)); - } - } - return expr_tree; - - case FFEINTRIN_impSECONDSUBR: - { - tree arg1_tree; - ffecomGfrt gfrt = ffeintrin_gfrt (codegen_imp); - - ffecom_push_calltemps (); - - arg1_tree = ffecom_expr_rw (arg1); - - ffecom_pop_calltemps (); - - expr_tree - = ffecom_call_ (ffecom_gfrt_tree_ (gfrt), - ffecom_gfrt_kind_type_ (gfrt), - FALSE, - NULL_TREE, - NULL_TREE, - NULL_TREE, NULL, NULL, NULL_TREE, TRUE); - - expr_tree - = ffecom_modify (NULL_TREE, arg1_tree, - convert (TREE_TYPE (arg1_tree), - expr_tree)); - } - return expr_tree; + /* Ignore the arg, since the library has no use for it yet. */ + return + ffecom_call_ (ffecom_gfrt_tree_ (FFECOM_gfrtFLUSH), + ffecom_gfrt_kind_type_ (FFECOM_gfrtFLUSH), + FALSE, + void_type_node, + NULL_TREE, + NULL_TREE, NULL, NULL, NULL_TREE, TRUE); - /* Straightforward calls of libf2c routines: */ case FFEINTRIN_impABORT: - case FFEINTRIN_impACCESS: - case FFEINTRIN_impBESJ0: - case FFEINTRIN_impBESJ1: - case FFEINTRIN_impBESJN: - case FFEINTRIN_impBESY0: - case FFEINTRIN_impBESY1: - case FFEINTRIN_impBESYN: - case FFEINTRIN_impDATE: - case FFEINTRIN_impDBESJ0: - case FFEINTRIN_impDBESJ1: - case FFEINTRIN_impDBESJN: - case FFEINTRIN_impDBESY0: - case FFEINTRIN_impDBESY1: - case FFEINTRIN_impDBESYN: - case FFEINTRIN_impDTIME: - case FFEINTRIN_impETIME: - case FFEINTRIN_impFNUM: - case FFEINTRIN_impFSTAT: - case FFEINTRIN_impFTELL: - case FFEINTRIN_impFSEEK: case FFEINTRIN_impGETARG: - case FFEINTRIN_impGERROR: - case FFEINTRIN_impGETCWD: case FFEINTRIN_impGETENV: - case FFEINTRIN_impGETGID: - case FFEINTRIN_impGETLOG: - case FFEINTRIN_impGETPID: - case FFEINTRIN_impGETUID: - case FFEINTRIN_impGMTIME: - case FFEINTRIN_impHOSTNM: - case FFEINTRIN_impIDATE: - case FFEINTRIN_impIDATEVXT: - case FFEINTRIN_impIERRNO: - case FFEINTRIN_impISATTY: - case FFEINTRIN_impITIME: - case FFEINTRIN_impLNBLNK: - case FFEINTRIN_impLSTAT: - case FFEINTRIN_impLTIME: - case FFEINTRIN_impMCLOCK: - case FFEINTRIN_impPERROR: - case FFEINTRIN_impSECNDS: - case FFEINTRIN_impSECONDFUNC: - case FFEINTRIN_impSLEEP: - case FFEINTRIN_impSRAND: - case FFEINTRIN_impSTAT: - case FFEINTRIN_impSYSTEM_CLOCK: - case FFEINTRIN_impTIME: - case FFEINTRIN_impTIMEVXT: + case FFEINTRIN_impFTELL: + case FFEINTRIN_impFSEEK: break; default: @@ -6128,10 +5580,7 @@ tail_recurse: /* :::::::::::::::::::: */ case FFEBLD_opSYMTER: s = ffebld_symter (expr); t = ffesymbol_hook (s).decl_tree; - if ((t == NULL_TREE) - && ((ffesymbol_kind (s) != FFEINFO_kindNONE) - || ((ffesymbol_where (s) != FFEINFO_whereNONE) - && (ffesymbol_where (s) != FFEINFO_whereINTRINSIC)))) + if (t == NULL_TREE) { s = ffecom_sym_transform_ (s); t = ffesymbol_hook (s).decl_tree; /* Sfunc expr non-dummy, @@ -6220,11 +5669,15 @@ ffecom_f2c_make_type_ (tree *type, int tcode, char *name) break; case FFECOM_f2ccodeTWOREALS: - *type = ffecom_make_complex_type_ (ffecom_f2c_real_type_node); + *type = make_node (COMPLEX_TYPE); + TREE_TYPE (*type) = ffecom_f2c_real_type_node; + layout_type (*type); break; case FFECOM_f2ccodeTWODOUBLEREALS: - *type = ffecom_make_complex_type_ (ffecom_f2c_doublereal_type_node); + *type = make_node (COMPLEX_TYPE); + TREE_TYPE (*type) = ffecom_f2c_doublereal_type_node; + layout_type (*type); break; default: @@ -6253,7 +5706,7 @@ ffecom_f2c_set_lio_code_ (ffeinfoBasictype bt, int size, for (j = 0; ((size_t) j) < ARRAY_SIZE (ffecom_tree_type[0]); ++j) if (((t = ffecom_tree_type[bt][j]) != NULL_TREE) - && (TREE_INT_CST_LOW (TYPE_SIZE (t)) == size)) + && (TYPE_PRECISION (t) == size)) { assert (code != -1); ffecom_f2c_typecode_[bt][j] = code; @@ -6330,8 +5783,7 @@ ffecom_finish_symbol_transform_ (ffesymbol s) if ((ffesymbol_hook (s).decl_tree == NULL_TREE) && ((ffesymbol_kind (s) != FFEINFO_kindNONE) - || ((ffesymbol_where (s) != FFEINFO_whereNONE) - && (ffesymbol_where (s) != FFEINFO_whereINTRINSIC)))) + || (ffesymbol_where (s) != FFEINFO_whereNONE))) /* Not transformed, and not CHARACTER*(*). */ s = ffecom_sym_transform_ (s); @@ -7208,11 +6660,6 @@ ffecom_make_gfrt_ (ffecomGfrt ix) kt = FFEINFO_kindtypeREAL2; break; - case FFECOM_rttypeCHARACTER_: - ttype = void_type_node; - kt = FFEINFO_kindtypeCHARACTER1; - break; - default: ttype = NULL; kt = FFEINFO_kindtypeANY; @@ -7402,8 +6849,6 @@ ffecom_start_progunit_ () tree result; /* Result of function. */ ffeinfoBasictype bt; ffeinfoKindtype kt; - ffeglobal g; - ffeglobalType gt; bool charfunc; bool cmplxfunc; bool altentries = (ffecom_num_entrypoints_ != 0); @@ -7436,16 +6881,8 @@ ffecom_start_progunit_ () { case FFEINFO_kindPROGRAM: main_program = TRUE; - gt = FFEGLOBAL_typeMAIN; - bt = FFEINFO_basictypeNONE; - kt = FFEINFO_kindtypeNONE; - type = ffecom_tree_fun_type_void; - charfunc = FALSE; - cmplxfunc = FALSE; - break; - + /* Fall through. */ case FFEINFO_kindBLOCKDATA: - gt = FFEGLOBAL_typeBDATA; bt = FFEINFO_basictypeNONE; kt = FFEINFO_kindtypeNONE; type = ffecom_tree_fun_type_void; @@ -7454,7 +6891,6 @@ ffecom_start_progunit_ () break; case FFEINFO_kindFUNCTION: - gt = FFEGLOBAL_typeFUNC; bt = ffesymbol_basictype (fn); kt = ffesymbol_kindtype (fn); if (bt == FFEINFO_basictypeNONE) @@ -7490,7 +6926,6 @@ ffecom_start_progunit_ () break; case FFEINFO_kindSUBROUTINE: - gt = FFEGLOBAL_typeSUBR; bt = FFEINFO_basictypeNONE; kt = FFEINFO_kindtypeNONE; if (ffecom_is_altreturning_) @@ -7505,7 +6940,6 @@ ffecom_start_progunit_ () assert ("say what??" == NULL); /* Fall through. */ case FFEINFO_kindANY: - gt = FFEGLOBAL_typeANY; bt = FFEINFO_basictypeNONE; kt = FFEINFO_kindtypeNONE; type = error_mark_node; @@ -7530,13 +6964,6 @@ ffecom_start_progunit_ () 0, /* nested/inline */ !altentries); /* TREE_PUBLIC */ - if (!altentries - && ((g = ffesymbol_global (fn)) != NULL) - && (ffeglobal_type (g) == gt)) - { - ffeglobal_set_hook (g, current_function_decl); - } - yes = suspend_momentary (); /* Arg handling needs exec-transitioned ffesymbols to work with. But @@ -7639,7 +7066,6 @@ ffecom_sym_transform_ (ffesymbol s) bool addr; /* Is t the address of the thingy? */ ffeinfoBasictype bt; ffeinfoKindtype kt; - ffeglobal g; int yes; int old_lineno = lineno; char *old_input_filename = input_filename; @@ -7690,15 +7116,6 @@ ffecom_sym_transform_ (ffesymbol s) case FFEINFO_whereGLOBAL: /* Subroutine or function. */ assert (!ffecom_transform_only_dummies_); - if (((g = ffesymbol_global (s)) != NULL) - && ((ffeglobal_type (g) == FFEGLOBAL_typeSUBR) - || (ffeglobal_type (g) == FFEGLOBAL_typeFUNC)) - && (ffeglobal_hook (g) != NULL_TREE)) - { - t = ffeglobal_hook (g); - break; - } - yes = suspend_momentary (); t = build_decl (FUNCTION_DECL, @@ -7710,11 +7127,6 @@ ffecom_sym_transform_ (ffesymbol s) t = start_decl (t, FALSE); finish_decl (t, NULL_TREE, FALSE); - if ((g != NULL) - && ((ffeglobal_type (g) == FFEGLOBAL_typeSUBR) - || (ffeglobal_type (g) == FFEGLOBAL_typeFUNC))) - ffeglobal_set_hook (g, t); - if (current_function_decl != NULL_TREE) resume_momentary (yes); @@ -7847,7 +7259,7 @@ ffecom_sym_transform_ (ffesymbol s) if (st != NULL) assert (ffestorag_size (st) * BITS_PER_UNIT - == (ffetargetOffset) + == (unsigned long int) TREE_INT_CST_LOW (DECL_SIZE (t))); resume_momentary (yes); @@ -8319,14 +7731,6 @@ ffecom_sym_transform_ (ffesymbol s) case FFEINFO_whereGLOBAL: assert (!ffecom_transform_only_dummies_); - if (((g = ffesymbol_global (s)) != NULL) - && (ffeglobal_type (g) == FFEGLOBAL_typeFUNC) - && (ffeglobal_hook (g) != NULL_TREE)) - { - t = ffeglobal_hook (g); - break; - } - yes = suspend_momentary (); if (ffesymbol_is_f2c (s) @@ -8344,10 +7748,6 @@ ffecom_sym_transform_ (ffesymbol s) t = start_decl (t, FALSE); finish_decl (t, NULL_TREE, FALSE); - if ((g != NULL) - && (ffeglobal_type (g) == FFEGLOBAL_typeFUNC)) - ffeglobal_set_hook (g, t); - if (current_function_decl != NULL_TREE) resume_momentary (yes); @@ -8402,14 +7802,6 @@ ffecom_sym_transform_ (ffesymbol s) case FFEINFO_whereGLOBAL: assert (!ffecom_transform_only_dummies_); - if (((g = ffesymbol_global (s)) != NULL) - && (ffeglobal_type (g) == FFEGLOBAL_typeSUBR) - && (ffeglobal_hook (g) != NULL_TREE)) - { - t = ffeglobal_hook (g); - break; - } - yes = suspend_momentary (); t = build_decl (FUNCTION_DECL, @@ -8421,10 +7813,6 @@ ffecom_sym_transform_ (ffesymbol s) t = start_decl (t, FALSE); finish_decl (t, NULL_TREE, FALSE); - if ((g != NULL) - && (ffeglobal_type (g) == FFEGLOBAL_typeSUBR)) - ffeglobal_set_hook (g, t); - if (current_function_decl != NULL_TREE) resume_momentary (yes); @@ -8781,7 +8169,7 @@ ffecom_transform_common_ (ffesymbol s) if ((cbt != NULL_TREE) && (!is_init - || !DECL_EXTERNAL (cbt))) + || !DECL_EXTERNAL (ffeglobal_hook (g)))) return; /* Process inits. */ @@ -8978,7 +8366,7 @@ ffecom_transform_equiv_ (ffestorag eqst) ffestorag_set_init (eqst, ffebld_new_any ()); assert (ffestorag_size (eqst) * BITS_PER_UNIT - == (ffetargetOffset) TREE_INT_CST_LOW (DECL_SIZE (eqt))); + == (unsigned long int) TREE_INT_CST_LOW (DECL_SIZE (eqt))); ffestorag_set_hook (eqst, eqt); @@ -9354,9 +8742,10 @@ ffecom_tree_divide_ (tree tree_type, tree left, tree right, if (TREE_TYPE (tree_type) == ffecom_tree_type [FFEINFO_basictypeREAL][FFEINFO_kindtypeREAL1]) - ix = FFECOM_gfrtDIV_CC; /* Overlapping result okay. */ + ix = FFECOM_gfrtDIV_CC; else - ix = FFECOM_gfrtDIV_ZZ; /* Overlapping result okay. */ + ix = FFECOM_gfrtDIV_ZZ; + dest_used = NULL; /* These don't work with overlapping result. */ left = ffecom_1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (left)), @@ -9376,37 +8765,6 @@ ffecom_tree_divide_ (tree tree_type, tree left, tree right, dest_tree, dest, dest_used, NULL_TREE, TRUE); } - break; - - case RECORD_TYPE: - { - ffecomGfrt ix; - - if (TREE_TYPE (TYPE_FIELDS (tree_type)) - == ffecom_tree_type [FFEINFO_basictypeREAL][FFEINFO_kindtypeREAL1]) - ix = FFECOM_gfrtDIV_CC; /* Overlapping result okay. */ - else - ix = FFECOM_gfrtDIV_ZZ; /* Overlapping result okay. */ - - left = ffecom_1 (ADDR_EXPR, - build_pointer_type (TREE_TYPE (left)), - left); - left = build_tree_list (NULL_TREE, left); - right = ffecom_1 (ADDR_EXPR, - build_pointer_type (TREE_TYPE (right)), - right); - right = build_tree_list (NULL_TREE, right); - TREE_CHAIN (left) = right; - - return ffecom_call_ (ffecom_gfrt_tree_ (ix), - ffecom_gfrt_kind_type_ (ix), - ffe_is_f2c_library (), - tree_type, - left, - dest_tree, dest, dest_used, - NULL_TREE, TRUE); - } - break; default: return ffecom_2 (RDIV_EXPR, tree_type, @@ -9878,43 +9236,7 @@ ffecom_1 (enum tree_code code, tree type, tree node) if (!mark_addressable (node)) assert ("can't mark_addressable this node!" == NULL); } - - switch (ffe_is_emulate_complex () ? code : NOP_EXPR) - { - tree realtype; - - case REALPART_EXPR: - item = build (COMPONENT_REF, type, node, TYPE_FIELDS (TREE_TYPE (node))); - break; - - case IMAGPART_EXPR: - item = build (COMPONENT_REF, type, node, TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (node)))); - break; - - - case NEGATE_EXPR: - if (TREE_CODE (type) != RECORD_TYPE) - { - item = build1 (code, type, node); - break; - } - node = ffecom_stabilize_aggregate_ (node); - realtype = TREE_TYPE (TYPE_FIELDS (type)); - item = - ffecom_2 (COMPLEX_EXPR, type, - ffecom_1 (NEGATE_EXPR, realtype, - ffecom_1 (REALPART_EXPR, realtype, - node)), - ffecom_1 (NEGATE_EXPR, realtype, - ffecom_1 (IMAGPART_EXPR, realtype, - node))); - break; - - default: - item = build1 (code, type, node); - break; - } - + item = build1 (code, type, node); if (TREE_SIDE_EFFECTS (node)) TREE_SIDE_EFFECTS (item) = 1; if ((code == ADDR_EXPR) && staticp (node)) @@ -9967,158 +9289,7 @@ ffecom_2 (enum tree_code code, tree type, tree node1, || (type == error_mark_node)) return error_mark_node; - switch (ffe_is_emulate_complex () ? code : NOP_EXPR) - { - tree a, b, c, d, realtype; - - case CONJ_EXPR: - assert ("no CONJ_EXPR support yet" == NULL); - return error_mark_node; - - case COMPLEX_EXPR: - item = build_tree_list (TYPE_FIELDS (type), node1); - TREE_CHAIN (item) = build_tree_list (TREE_CHAIN (TYPE_FIELDS (type)), node2); - item = build (CONSTRUCTOR, type, NULL_TREE, item); - break; - - case PLUS_EXPR: - if (TREE_CODE (type) != RECORD_TYPE) - { - item = build (code, type, node1, node2); - break; - } - node1 = ffecom_stabilize_aggregate_ (node1); - node2 = ffecom_stabilize_aggregate_ (node2); - realtype = TREE_TYPE (TYPE_FIELDS (type)); - item = - ffecom_2 (COMPLEX_EXPR, type, - ffecom_2 (PLUS_EXPR, realtype, - ffecom_1 (REALPART_EXPR, realtype, - node1), - ffecom_1 (REALPART_EXPR, realtype, - node2)), - ffecom_2 (PLUS_EXPR, realtype, - ffecom_1 (IMAGPART_EXPR, realtype, - node1), - ffecom_1 (IMAGPART_EXPR, realtype, - node2))); - break; - - case MINUS_EXPR: - if (TREE_CODE (type) != RECORD_TYPE) - { - item = build (code, type, node1, node2); - break; - } - node1 = ffecom_stabilize_aggregate_ (node1); - node2 = ffecom_stabilize_aggregate_ (node2); - realtype = TREE_TYPE (TYPE_FIELDS (type)); - item = - ffecom_2 (COMPLEX_EXPR, type, - ffecom_2 (MINUS_EXPR, realtype, - ffecom_1 (REALPART_EXPR, realtype, - node1), - ffecom_1 (REALPART_EXPR, realtype, - node2)), - ffecom_2 (MINUS_EXPR, realtype, - ffecom_1 (IMAGPART_EXPR, realtype, - node1), - ffecom_1 (IMAGPART_EXPR, realtype, - node2))); - break; - - case MULT_EXPR: - if (TREE_CODE (type) != RECORD_TYPE) - { - item = build (code, type, node1, node2); - break; - } - node1 = ffecom_stabilize_aggregate_ (node1); - node2 = ffecom_stabilize_aggregate_ (node2); - realtype = TREE_TYPE (TYPE_FIELDS (type)); - a = save_expr (ffecom_1 (REALPART_EXPR, realtype, - node1)); - b = save_expr (ffecom_1 (IMAGPART_EXPR, realtype, - node1)); - c = save_expr (ffecom_1 (REALPART_EXPR, realtype, - node2)); - d = save_expr (ffecom_1 (IMAGPART_EXPR, realtype, - node2)); - item = - ffecom_2 (COMPLEX_EXPR, type, - ffecom_2 (MINUS_EXPR, realtype, - ffecom_2 (MULT_EXPR, realtype, - a, - c), - ffecom_2 (MULT_EXPR, realtype, - b, - d)), - ffecom_2 (PLUS_EXPR, realtype, - ffecom_2 (MULT_EXPR, realtype, - a, - d), - ffecom_2 (MULT_EXPR, realtype, - c, - b))); - break; - - case EQ_EXPR: - if ((TREE_CODE (node1) != RECORD_TYPE) - && (TREE_CODE (node2) != RECORD_TYPE)) - { - item = build (code, type, node1, node2); - break; - } - assert (TREE_CODE (node1) == RECORD_TYPE); - assert (TREE_CODE (node2) == RECORD_TYPE); - node1 = ffecom_stabilize_aggregate_ (node1); - node2 = ffecom_stabilize_aggregate_ (node2); - realtype = TREE_TYPE (TYPE_FIELDS (type)); - item = - ffecom_2 (TRUTH_ANDIF_EXPR, type, - ffecom_2 (code, type, - ffecom_1 (REALPART_EXPR, realtype, - node1), - ffecom_1 (REALPART_EXPR, realtype, - node2)), - ffecom_2 (code, type, - ffecom_1 (IMAGPART_EXPR, realtype, - node1), - ffecom_1 (IMAGPART_EXPR, realtype, - node2))); - break; - - case NE_EXPR: - if ((TREE_CODE (node1) != RECORD_TYPE) - && (TREE_CODE (node2) != RECORD_TYPE)) - { - item = build (code, type, node1, node2); - break; - } - assert (TREE_CODE (node1) == RECORD_TYPE); - assert (TREE_CODE (node2) == RECORD_TYPE); - node1 = ffecom_stabilize_aggregate_ (node1); - node2 = ffecom_stabilize_aggregate_ (node2); - realtype = TREE_TYPE (TYPE_FIELDS (type)); - item = - ffecom_2 (TRUTH_ORIF_EXPR, type, - ffecom_2 (code, type, - ffecom_1 (REALPART_EXPR, realtype, - node1), - ffecom_1 (REALPART_EXPR, realtype, - node2)), - ffecom_2 (code, type, - ffecom_1 (IMAGPART_EXPR, realtype, - node1), - ffecom_1 (IMAGPART_EXPR, realtype, - node2))); - break; - - default: - item = build (code, type, node1, node2); - break; - } - + item = build (code, type, node1, node2); if (TREE_SIDE_EFFECTS (node1) || TREE_SIDE_EFFECTS (node2)) TREE_SIDE_EFFECTS (item) = 1; return fold (item); @@ -10835,9 +10006,9 @@ ffecom_constantunion (ffebldConstantUnion *cu, ffeinfoBasictype bt, case FFEINFO_kindtypeANY: return error_mark_node; } - item = ffecom_build_complex_constant_ (tree_type, - build_real (el_type, real), - build_real (el_type, imag)); + item = build_complex (build_real (el_type, real), + build_real (el_type, imag)); + TREE_TYPE (item) = tree_type; } break; @@ -11294,40 +10465,39 @@ ffecom_init_0 () whether the compiler environment is buggy in known ways, some of which would, if not explicitly checked here, result in subtle bugs in g77. */ - if (ffe_is_do_internal_checks ()) - { - static char names[][12] - = - {"bar", "bletch", "foo", "foobar"}; - char *name; - unsigned long ul; - double fl; - - name = bsearch ("foo", &names[0], ARRAY_SIZE (names), sizeof (names[0]), - (int (*)()) strcmp); - if (name != (char *) &names[2]) - { - assert ("bsearch doesn't work, #define FFEPROJ_BSEARCH 0 in proj.h" - == NULL); - abort (); - } + { + static char names[][12] + = + {"bar", "bletch", "foo", "foobar"}; + char *name; + unsigned long ul; + double fl; + + name = bsearch ("foo", &names[0], ARRAY_SIZE (names), sizeof (names[0]), + (int (*)()) strcmp); + if (name != (char *) &names[2]) + { + assert ("bsearch doesn't work, #define FFEPROJ_BSEARCH 0 in proj.h" + == NULL); + abort (); + } - ul = strtoul ("123456789", NULL, 10); - if (ul != 123456789L) - { - assert ("strtoul doesn't have enough range, #define FFEPROJ_STRTOUL 0\ + ul = strtoul ("123456789", NULL, 10); + if (ul != 123456789L) + { + assert ("strtoul doesn't have enough range, #define FFEPROJ_STRTOUL 0\ in proj.h" == NULL); - abort (); - } + abort (); + } - fl = atof ("56.789"); - if ((fl < 56.788) || (fl > 56.79)) - { - assert ("atof not type double, fix your #include " - == NULL); - abort (); - } - } + fl = atof ("56.789"); + if ((fl < 56.788) || (fl > 56.79)) + { + assert ("atof not type double, fix your #include " + == NULL); + abort (); + } + } #if FFECOM_GCC_INCLUDE ffecom_initialize_char_syntax_ (); @@ -11405,37 +10575,45 @@ ffecom_init_0 () float_type_node = make_node (REAL_TYPE); TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE; - layout_type (float_type_node); pushdecl (build_decl (TYPE_DECL, get_identifier ("float"), float_type_node)); + layout_type (float_type_node); double_type_node = make_node (REAL_TYPE); TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE; - layout_type (double_type_node); pushdecl (build_decl (TYPE_DECL, get_identifier ("double"), double_type_node)); + layout_type (double_type_node); long_double_type_node = make_node (REAL_TYPE); TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE; - layout_type (long_double_type_node); pushdecl (build_decl (TYPE_DECL, get_identifier ("long double"), long_double_type_node)); + layout_type (long_double_type_node); - complex_integer_type_node = ffecom_make_complex_type_ (integer_type_node); + complex_integer_type_node = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), complex_integer_type_node)); + TREE_TYPE (complex_integer_type_node) = integer_type_node; + layout_type (complex_integer_type_node); - complex_float_type_node = ffecom_make_complex_type_ (float_type_node); + complex_float_type_node = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), complex_float_type_node)); + TREE_TYPE (complex_float_type_node) = float_type_node; + layout_type (complex_float_type_node); - complex_double_type_node = ffecom_make_complex_type_ (double_type_node); + complex_double_type_node = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), complex_double_type_node)); + TREE_TYPE (complex_double_type_node) = double_type_node; + layout_type (complex_double_type_node); - complex_long_double_type_node = ffecom_make_complex_type_ (long_double_type_node); + complex_long_double_type_node = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), complex_long_double_type_node)); + TREE_TYPE (complex_long_double_type_node) = long_double_type_node; + layout_type (complex_long_double_type_node); integer_zero_node = build_int_2 (0, 0); TREE_TYPE (integer_zero_node) = integer_type_node; @@ -11532,7 +10710,7 @@ ffecom_init_0 () ffetype_set_star (base_type, TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, type); - ffetype_set_kind (base_type, 3, type); + ffetype_set_kind (base_type, 2, type); assert (ffetype_size (type) == sizeof (ffetargetInteger2)); ffecom_tree_type[FFEINFO_basictypeHOLLERITH][FFEINFO_kindtypeINTEGER2] @@ -11541,7 +10719,7 @@ ffecom_init_0 () t)); ffecom_tree_type[FFEINFO_basictypeINTEGER][FFEINFO_kindtypeINTEGER3] - = t = make_signed_type (CHAR_TYPE_SIZE * 2); + = t = make_signed_type (SHORT_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("word"), t)); type = ffetype_new (); @@ -11553,16 +10731,16 @@ ffecom_init_0 () ffetype_set_star (base_type, TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, type); - ffetype_set_kind (base_type, 6, type); + ffetype_set_kind (base_type, 3, type); assert (ffetype_size (type) == sizeof (ffetargetInteger3)); ffecom_tree_type[FFEINFO_basictypeHOLLERITH][FFEINFO_kindtypeINTEGER3] - = t = make_unsigned_type (CHAR_TYPE_SIZE * 2); + = t = make_unsigned_type (SHORT_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned word"), t)); ffecom_tree_type[FFEINFO_basictypeINTEGER][FFEINFO_kindtypeINTEGER4] - = t = make_signed_type (FLOAT_TYPE_SIZE * 2); + = t = make_signed_type (LONG_LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("integer4"), t)); type = ffetype_new (); @@ -11574,17 +10752,15 @@ ffecom_init_0 () ffetype_set_star (base_type, TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, type); - ffetype_set_kind (base_type, 2, type); + ffetype_set_kind (base_type, 4, type); assert (ffetype_size (type) == sizeof (ffetargetInteger4)); ffecom_tree_type[FFEINFO_basictypeHOLLERITH][FFEINFO_kindtypeINTEGER4] - = t = make_unsigned_type (FLOAT_TYPE_SIZE * 2); + = t = make_unsigned_type (LONG_LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned4"), t)); -#if 0 - if (ffe_is_do_internal_checks () - && LONG_TYPE_SIZE != FLOAT_TYPE_SIZE + if (LONG_TYPE_SIZE != FLOAT_TYPE_SIZE && LONG_TYPE_SIZE != CHAR_TYPE_SIZE && LONG_TYPE_SIZE != SHORT_TYPE_SIZE && LONG_TYPE_SIZE != LONG_LONG_TYPE_SIZE) @@ -11592,7 +10768,6 @@ ffecom_init_0 () fprintf (stderr, "Sorry, no g77 support for LONG_TYPE_SIZE (%d bits) yet.\n", LONG_TYPE_SIZE); } -#endif ffecom_tree_type[FFEINFO_basictypeLOGICAL][FFEINFO_kindtypeLOGICAL1] = t = make_signed_type (FLOAT_TYPE_SIZE); @@ -11624,11 +10799,11 @@ ffecom_init_0 () ffetype_set_star (base_type, TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, type); - ffetype_set_kind (base_type, 3, type); + ffetype_set_kind (base_type, 2, type); assert (ffetype_size (type) == sizeof (ffetargetLogical2)); ffecom_tree_type[FFEINFO_basictypeLOGICAL][FFEINFO_kindtypeLOGICAL3] - = t = make_signed_type (CHAR_TYPE_SIZE * 2); + = t = make_signed_type (SHORT_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("logical3"), t)); type = ffetype_new (); @@ -11640,11 +10815,11 @@ ffecom_init_0 () ffetype_set_star (base_type, TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, type); - ffetype_set_kind (base_type, 6, type); + ffetype_set_kind (base_type, 3, type); assert (ffetype_size (type) == sizeof (ffetargetLogical3)); ffecom_tree_type[FFEINFO_basictypeLOGICAL][FFEINFO_kindtypeLOGICAL4] - = t = make_signed_type (FLOAT_TYPE_SIZE * 2); + = t = make_signed_type (LONG_LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("logical4"), t)); type = ffetype_new (); @@ -11656,7 +10831,7 @@ ffecom_init_0 () ffetype_set_star (base_type, TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, type); - ffetype_set_kind (base_type, 2, type); + ffetype_set_kind (base_type, 4, type); assert (ffetype_size (type) == sizeof (ffetargetLogical4)); ffecom_tree_type[FFEINFO_basictypeREAL][FFEINFO_kindtypeREAL1] @@ -11671,9 +10846,9 @@ ffecom_init_0 () type); ffetype_set_ams (type, TYPE_ALIGN (t) / BITS_PER_UNIT, 0, - TREE_INT_CST_LOW (TYPE_SIZE (t)) / BITS_PER_UNIT); + TYPE_PRECISION (t) / BITS_PER_UNIT); ffetype_set_star (base_type, - TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, + TYPE_PRECISION (t) / CHAR_TYPE_SIZE, type); ffetype_set_kind (base_type, 1, type); ffecom_f2c_typecode_[FFEINFO_basictypeREAL][FFEINFO_kindtypeREAL1] @@ -11691,9 +10866,9 @@ ffecom_init_0 () type); ffetype_set_ams (type, TYPE_ALIGN (t) / BITS_PER_UNIT, 0, - TREE_INT_CST_LOW (TYPE_SIZE (t)) / BITS_PER_UNIT); + TYPE_PRECISION (t) / BITS_PER_UNIT); ffetype_set_star (base_type, - TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, + TYPE_PRECISION (t) / CHAR_TYPE_SIZE, type); ffetype_set_kind (base_type, 2, type); ffecom_f2c_typecode_[FFEINFO_basictypeREAL][FFEINFO_kindtypeREAL2] @@ -11701,18 +10876,21 @@ ffecom_init_0 () assert (ffetype_size (type) == sizeof (ffetargetReal2)); ffecom_tree_type[FFEINFO_basictypeCOMPLEX][FFEINFO_kindtypeREAL1] - = t = ffecom_make_complex_type_ (ffecom_tree_type[FFEINFO_basictypeREAL][FFEINFO_kindtypeREAL1]); + = t = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex"), t)); + TREE_TYPE (t) + = ffecom_tree_type[FFEINFO_basictypeREAL][FFEINFO_kindtypeREAL1]; + layout_type (t); type = ffetype_new (); base_type = type; ffeinfo_set_type (FFEINFO_basictypeCOMPLEX, FFEINFO_kindtypeREAL1, type); ffetype_set_ams (type, - TYPE_ALIGN (t) / BITS_PER_UNIT, 0, - TREE_INT_CST_LOW (TYPE_SIZE (t)) / BITS_PER_UNIT); + TYPE_ALIGN (TREE_TYPE (t)) / BITS_PER_UNIT, 0, + TYPE_PRECISION (TREE_TYPE (t)) * 2 / BITS_PER_UNIT); ffetype_set_star (base_type, - TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, + TYPE_PRECISION (TREE_TYPE (t)) * 2 / CHAR_TYPE_SIZE, type); ffetype_set_kind (base_type, 1, type); ffecom_f2c_typecode_[FFEINFO_basictypeCOMPLEX][FFEINFO_kindtypeREAL1] @@ -11720,17 +10898,20 @@ ffecom_init_0 () assert (ffetype_size (type) == sizeof (ffetargetComplex1)); ffecom_tree_type[FFEINFO_basictypeCOMPLEX][FFEINFO_kindtypeREALDOUBLE] - = t = ffecom_make_complex_type_ (ffecom_tree_type[FFEINFO_basictypeREAL][FFEINFO_kindtypeREAL2]); + = t = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("double complex"), t)); + TREE_TYPE (t) + = ffecom_tree_type[FFEINFO_basictypeREAL][FFEINFO_kindtypeREAL2]; + layout_type (t); type = ffetype_new (); ffeinfo_set_type (FFEINFO_basictypeCOMPLEX, FFEINFO_kindtypeREALDOUBLE, type); ffetype_set_ams (type, - TYPE_ALIGN (t) / BITS_PER_UNIT, 0, - TREE_INT_CST_LOW (TYPE_SIZE (t)) / BITS_PER_UNIT); + TYPE_ALIGN (TREE_TYPE (t)) / BITS_PER_UNIT, 0, + TYPE_PRECISION (TREE_TYPE (t)) * 2 / BITS_PER_UNIT); ffetype_set_star (base_type, - TREE_INT_CST_LOW (TYPE_SIZE (t)) / CHAR_TYPE_SIZE, + TYPE_PRECISION (TREE_TYPE (t)) * 2 / CHAR_TYPE_SIZE, type); ffetype_set_kind (base_type, 2, type); @@ -11745,20 +10926,7 @@ ffecom_init_0 () { if ((t = ffecom_tree_type[i][j]) != NULL_TREE) { - if (i == FFEINFO_basictypeINTEGER) - { - /* Figure out the smallest INTEGER type that can hold - a pointer on this machine. */ - if (GET_MODE_SIZE (TYPE_MODE (t)) - >= GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (null_pointer_node)))) - { - if ((ffecom_pointer_kind_ == FFEINFO_kindtypeNONE) - || (GET_MODE_SIZE (TYPE_MODE (ffecom_tree_type[i][ffecom_pointer_kind_])) - > GET_MODE_SIZE (TYPE_MODE (t)))) - ffecom_pointer_kind_ = j; - } - } - else if (i == FFEINFO_basictypeCOMPLEX) + if (i == FFEINFO_basictypeCOMPLEX) t = void_type_node; /* For f2c compatibility, REAL functions are really implemented as DOUBLE PRECISION. */ @@ -11773,26 +10941,6 @@ ffecom_init_0 () } } - /* Set up pointer types. */ - - if (ffecom_pointer_kind_ == FFEINFO_basictypeNONE) - fatal ("no INTEGER type can hold a pointer on this configuration"); - else if (0 && ffe_is_do_internal_checks ()) - fprintf (stderr, "Pointer type kt=%d\n", ffecom_pointer_kind_); -#if 0 - type = ffetype_new (); - ffetype_set_kind (ffeinfo_type (FFEINFO_basictypeINTEGER, - FFEINFO_kindtypeINTEGERDEFAULT), - 0, type); -#endif - - if (ffe_is_ugly_assign ()) - ffecom_label_kind_ = ffecom_pointer_kind_; /* Require ASSIGN etc to this. */ - else - ffecom_label_kind_ = FFEINFO_kindtypeINTEGERDEFAULT; - if (0 && ffe_is_do_internal_checks ()) - fprintf (stderr, "Label type kt=%d\n", ffecom_label_kind_); - ffecom_integer_type_node = ffecom_tree_type[FFEINFO_basictypeINTEGER][FFEINFO_kindtypeINTEGER1]; ffecom_integer_zero_node = convert (ffecom_integer_type_node, @@ -11967,12 +11115,6 @@ ffecom_init_0 () ffecom_f2c_ptr_to_ftnint_type_node = build_pointer_type (ffecom_f2c_ftnint_type_node); - ffecom_f2c_ptr_to_integer_type_node - = build_pointer_type (ffecom_f2c_integer_type_node); - - ffecom_f2c_ptr_to_real_type_node - = build_pointer_type (ffecom_f2c_real_type_node); - ffecom_float_zero_ = build_real (float_type_node, dconst0); ffecom_double_zero_ = build_real (double_type_node, dconst0); { @@ -11998,7 +11140,6 @@ ffecom_init_0 () ffecom_tree_xargc_ = start_decl (ffecom_tree_xargc_, FALSE); finish_decl (ffecom_tree_xargc_, NULL_TREE, FALSE); -#if 0 /* This is being fixed, and seems to be working now. */ if ((FLOAT_TYPE_SIZE != 32) || (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (null_pointer_node))) != 32)) { @@ -12010,7 +11151,6 @@ ffecom_init_0 () warning ("Please keep this in mind before you report bugs. g77 should"); warning ("support non-32-bit machines better as of version 0.6."); } -#endif #if 0 /* Code in ste.c that would crash has been commented out. */ if (TYPE_PRECISION (ffecom_f2c_ftnlen_type_node) @@ -12651,9 +11791,7 @@ ffecom_ptr_to_expr (ffebld expr) || (TREE_CODE (item) == INDIRECT_REF) || (TREE_CODE (item) == ARRAY_REF) || (TREE_CODE (item) == COMPONENT_REF) -#ifdef OFFSET_REF || (TREE_CODE (item) == OFFSET_REF) -#endif || (TREE_CODE (item) == BUFFER_REF) || (TREE_CODE (item) == REALPART_EXPR) || (TREE_CODE (item) == IMAGPART_EXPR)) @@ -14162,25 +13300,21 @@ convert (type, expr) register tree e = expr; register enum tree_code code = TREE_CODE (type); - if (type == TREE_TYPE (e) - || TREE_CODE (e) == ERROR_MARK) - return e; - if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (e))) - return fold (build1 (NOP_EXPR, type, e)); - if (TREE_CODE (TREE_TYPE (e)) == ERROR_MARK + if (type == TREE_TYPE (expr) + || TREE_CODE (expr) == ERROR_MARK) + return expr; + if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr))) + return fold (build1 (NOP_EXPR, type, expr)); + if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK || code == ERROR_MARK) return error_mark_node; - if (TREE_CODE (TREE_TYPE (e)) == VOID_TYPE) + if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE) { assert ("void value not ignored as it ought to be" == NULL); return error_mark_node; } if (code == VOID_TYPE) return build1 (CONVERT_EXPR, type, e); - if ((code != RECORD_TYPE) - && (TREE_CODE (TREE_TYPE (e)) == RECORD_TYPE)) - e = ffecom_1 (REALPART_EXPR, TREE_TYPE (TYPE_FIELDS (TREE_TYPE (e))), - e); if (code == INTEGER_TYPE || code == ENUMERAL_TYPE) return fold (convert_to_integer (type, e)); if (code == POINTER_TYPE) @@ -14189,8 +13323,6 @@ convert (type, expr) return fold (convert_to_real (type, e)); if (code == COMPLEX_TYPE) return fold (convert_to_complex (type, e)); - if (code == RECORD_TYPE) - return fold (ffecom_convert_to_complex_ (type, e)); assert ("conversion to non-scalar type requested" == NULL); return error_mark_node; diff --git a/gnu/usr.bin/gcc/f/com.h b/gnu/usr.bin/gcc/f/com.h index c01c74c2e72..542b9ba8d6e 100644 --- a/gnu/usr.bin/gcc/f/com.h +++ b/gnu/usr.bin/gcc/f/com.h @@ -1,5 +1,5 @@ /* com.h -- Public #include File (module.h template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -138,14 +138,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA # error Cannot find a suitable type for FFECOM_f2cINTEGER #endif -#if LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2) -# define FFECOM_f2cLONGINT FFECOM_f2ccodeLONG -#elif LONG_LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2) -# define FFECOM_f2cLONGINT FFECOM_f2ccodeLONGLONG -#else -# error Cannot find a suitable type for FFECOM_f2cLONGINT -#endif - #define FFECOM_f2cADDRESS FFECOM_f2ccodeCHARPTR #define FFECOM_f2cSHORTINT FFECOM_f2ccodeSHORT #define FFECOM_f2cREAL FFECOM_f2ccodeFLOAT @@ -155,6 +147,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define FFECOM_f2cSHORTLOGICAL FFECOM_f2ccodeSHORT #define FFECOM_f2cLOGICAL1 FFECOM_f2ccodeCHAR #define FFECOM_f2cINTEGER1 FFECOM_f2ccodeCHAR +#define FFECOM_f2cLONGINT FFECOM_f2ccodeLONGLONG /* These must be f2c's INTEGER type, to match runtime/f2c.h.in. */ @@ -194,14 +187,6 @@ typedef enum #endif #endif /* !defined (BUILT_FOR_270) */ -#ifndef BUILT_FOR_280 -#ifdef DECL_ONE_ONLY /* In gcc/tree.h. */ -#define BUILT_FOR_280 1 -#else -#define BUILT_FOR_280 0 -#endif -#endif /* !defined (BUILT_FOR_280) */ - typedef tree ffecomConstant; #define FFECOM_constantHOOK typedef tree ffecomLabel; @@ -245,8 +230,6 @@ extern tree ffecom_integer_zero_node; extern tree ffecom_integer_one_node; extern tree ffecom_tree_type[FFEINFO_basictype][FFEINFO_kindtype]; extern ffecomSymbol ffecom_symbol_null_; -extern ffeinfoKindtype ffecom_pointer_kind_; -extern ffeinfoKindtype ffecom_label_kind_; extern int ffecom_f2c_typecode_[FFEINFO_basictype][FFEINFO_kindtype]; extern tree ffecom_f2c_integer_type_node; @@ -390,8 +373,6 @@ void warning (char *s, ...); #define ffecom_expr(e) (e) #define ffecom_init_0() #define ffecom_init_2() -#define ffecom_label_kind() FFEINFO_kindtypeINTEGERDEFAULT -#define ffecom_pointer_kind() FFEINFO_kindtypeINTEGERDEFAULT #define ffecom_ptr_to_expr(e) (e) #define ffecom_sym_commit(s) #define ffecom_sym_retract(s) @@ -399,8 +380,6 @@ void warning (char *s, ...); #if FFECOM_targetCURRENT == FFECOM_targetGCC #define ffecom_f2c_typecode(bt,kt) ffecom_f2c_typecode_[(bt)][(kt)] -#define ffecom_label_kind() ffecom_label_kind_ -#define ffecom_pointer_kind() ffecom_pointer_kind_ #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */ #define ffecom_init_1() diff --git a/gnu/usr.bin/gcc/f/config-lang.in b/gnu/usr.bin/gcc/f/config-lang.in index 74626241d8c..fc0240aef59 100644 --- a/gnu/usr.bin/gcc/f/config-lang.in +++ b/gnu/usr.bin/gcc/f/config-lang.in @@ -1,5 +1,5 @@ # Top level configure fragment for GNU FORTRAN. -# Copyright (C) 1995-1997 Free Software Foundation, Inc. +# Copyright (C) 1995 Free Software Foundation, Inc. #This file is part of GNU Fortran. @@ -62,9 +62,8 @@ diff_excludes="-x \"f/g77.info*\"" # Create the runtime library directory tree if necessary. test -d f || mkdir f test -d f/runtime || mkdir f/runtime -test -d f/runtime/libF77 || mkdir f/runtime/libF77 test -d f/runtime/libI77 || mkdir f/runtime/libI77 -test -d f/runtime/libU77 || mkdir f/runtime/libU77 +test -d f/runtime/libF77 || mkdir f/runtime/libF77 # Need to make top-level stageN directory trees, else if needed # later by gcc/Makefile, it'll make only the first levels and @@ -76,19 +75,17 @@ do test -d $stageN/f/runtime || mkdir $stageN/f/runtime test -d $stageN/f/runtime/libF77 || mkdir $stageN/f/runtime/libF77 test -d $stageN/f/runtime/libI77 || mkdir $stageN/f/runtime/libI77 - test -d $stageN/f/runtime/libU77 || mkdir $stageN/f/runtime/libU77 done # Make links into top-level stageN from target trees. for stageN in stage1 stage2 stage3 stage4 include do $remove -f f/$stageN f/runtime/$stageN f/runtime/libF77/$stageN \ - f/runtime/libI77/$stageN f/runtime/libU77/$stageN + f/runtime/libI77/$stageN (cd f; $symbolic_link ../$stageN . 2>/dev/null) (cd f/runtime; $symbolic_link ../$stageN . 2>/dev/null) (cd f/runtime/libF77; $symbolic_link ../$stageN . 2>/dev/null) (cd f/runtime/libI77; $symbolic_link ../$stageN . 2>/dev/null) - (cd f/runtime/libU77; $symbolic_link ../$stageN . 2>/dev/null) done case "$srcdir" in diff --git a/gnu/usr.bin/gcc/f/data.c b/gnu/usr.bin/gcc/f/data.c index 15bf3b00cbb..16864e00c6f 100644 --- a/gnu/usr.bin/gcc/f/data.c +++ b/gnu/usr.bin/gcc/f/data.c @@ -1,5 +1,5 @@ /* data.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -287,7 +287,7 @@ ffedata_value (ffetargetIntegerDefault rpt, ffebld value, ffelexToken token) { ffesymbol_signal_change (ffedata_symbol_); ffesymbol_update_init (ffedata_symbol_); - if (1 || ffe_is_90 ()) + if (ffe_is_90 ()) ffesymbol_update_save (ffedata_symbol_); #if FFEGLOBAL_ENABLED if (ffesymbol_common (ffedata_symbol_) != NULL) @@ -1231,7 +1231,7 @@ ffedata_gather_ (ffestorag mst, ffestorag st) else { accter = ffestorag_accretion (mst); - assert (ffedata_storage_size_ == (ffetargetOffset) ffebld_accter_size (accter)); + assert (ffedata_storage_size_ == ffebld_accter_size (accter)); array = ffebld_accter (accter); } @@ -1251,7 +1251,7 @@ ffedata_gather_ (ffestorag mst, ffestorag st) operation. */ ffebit_count (ffebld_accter_bits (accter), offset, FALSE, units_expected, &actual); /* How many FALSE? */ - if (units_expected != (ffetargetOffset) actual) + if (actual != units_expected) { ffebad_start (FFEBAD_DATA_MULTIPLE); ffebad_here (0, ffewhere_line_unknown (), ffewhere_column_unknown ()); @@ -1291,7 +1291,7 @@ ffedata_gather_ (ffestorag mst, ffestorag st) operation. */ ffebit_count (ffebld_accter_bits (accter), offset, FALSE, units_expected, &actual); /* How many FALSE? */ - if (units_expected != (ffetargetOffset) actual) + if (actual != units_expected) { ffebad_start (FFEBAD_DATA_MULTIPLE); ffebad_here (0, ffewhere_line_unknown (), ffewhere_column_unknown ()); @@ -1345,7 +1345,7 @@ ffedata_gather_ (ffestorag mst, ffestorag st) (*fn) (ptr1, ptr2, siz); /* Does memcpy-like operation. */ ffebit_count (ffebld_accter_bits (accter), /* How many FALSE? */ offset, FALSE, unexp, &actual); - if (!whine && (unexp != (ffetargetOffset) actual)) + if (!whine && (actual != unexp)) { whine = TRUE; /* Don't whine more than once for one gather. */ ffebad_start (FFEBAD_DATA_MULTIPLE); @@ -1608,7 +1608,7 @@ ffedata_value_ (ffebld value, ffelexToken token) else { accter = ffestorag_accretion (ffedata_storage_); - assert (ffedata_storage_size_ == (ffetargetOffset) ffebld_accter_size (accter)); + assert (ffedata_storage_size_ == ffebld_accter_size (accter)); array = ffebld_accter (accter); } @@ -1627,7 +1627,7 @@ ffedata_value_ (ffebld value, ffelexToken token) ffebit_count (ffebld_accter_bits (accter), offset, FALSE, units_expected, &actual); /* How many FALSE? */ - if (units_expected != (ffetargetOffset) actual) + if (actual != units_expected) { ffebad_start (FFEBAD_DATA_MULTIPLE); ffebad_here (0, ffelex_token_where_line (token), @@ -1744,7 +1744,7 @@ ffedata_value_ (ffebld value, ffelexToken token) { accter = ffesymbol_accretion (ffedata_symbol_); assert (ffedata_symbolsize_ - == (ffetargetOffset) ffebld_accter_size (accter)); + == ffebld_accter_size (accter)); array = ffebld_accter (accter); } diff --git a/gnu/usr.bin/gcc/f/equiv.c b/gnu/usr.bin/gcc/f/equiv.c index d6ef0bab563..0dc60d85e01 100644 --- a/gnu/usr.bin/gcc/f/equiv.c +++ b/gnu/usr.bin/gcc/f/equiv.c @@ -1,5 +1,5 @@ /* equiv.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -69,7 +69,6 @@ static struct _ffeequiv_list_ ffeequiv_list_; /* Static functions (internal). */ -static void ffeequiv_destroy_ (ffeequiv eq); static void ffeequiv_layout_local_ (ffeequiv eq); static bool ffeequiv_offset_ (ffetargetOffset *offset, ffesymbol s, ffebld expr, bool subtract, @@ -78,30 +77,6 @@ static bool ffeequiv_offset_ (ffetargetOffset *offset, ffesymbol s, /* Internal macros. */ -static void -ffeequiv_destroy_ (ffeequiv victim) -{ - ffebld list; - ffebld item; - ffebld expr; - - for (list = victim->list; list != NULL; list = ffebld_trail (list)) - { - for (item = ffebld_head (list); item != NULL; item = ffebld_trail (item)) - { - ffesymbol sym; - - expr = ffebld_head (item); - sym = ffeequiv_symbol (expr); - if (sym == NULL) - continue; - if (ffesymbol_equiv (sym) != NULL) - ffesymbol_set_equiv (sym, NULL); - } - } - ffeequiv_kill (victim); -} - /* ffeequiv_layout_local_ -- Lay out storage for local equivalenced vars ffeequiv eq; @@ -141,7 +116,7 @@ ffeequiv_layout_local_ (ffeequiv eq) if (ffeequiv_common (eq) != NULL) { /* Put in common due to programmer error. */ - ffeequiv_destroy_ (eq); + ffeequiv_kill (eq); return; } @@ -176,13 +151,10 @@ ffeequiv_layout_local_ (ffeequiv eq) if (!ffeequiv_offset_ (&ign, root_sym, root_exp, FALSE, 0, FALSE)) { - /* We can't just eliminate this one symbol from the list - of candidates, because it might be the only one that - ties all these equivs together. So just destroy the - whole list. */ - - ffeequiv_destroy_ (eq); - return; + ffesymbol_set_equiv (root_sym, NULL); /* Equiv area slated for + death. */ + root_sym = NULL; + continue; /* Something's wrong with eqv expr, try another. */ } break; /* Use first valid eqv expr for root exp/sym. */ @@ -193,7 +165,7 @@ ffeequiv_layout_local_ (ffeequiv eq) if (root_sym == NULL) { - ffeequiv_destroy_ (eq); + ffeequiv_kill (eq); return; } @@ -297,7 +269,7 @@ ffeequiv_layout_local_ (ffeequiv eq) rooted_exp = ffebld_head (item); rooted_sym = ffeequiv_symbol (rooted_exp); if ((rooted_sym == NULL) - || ((rooted_st = ffesymbol_storage (rooted_sym)) == NULL)) + || (ffesymbol_equiv (rooted_sym) == NULL)) { rooted_sym = NULL; continue; /* Ignore me. */ @@ -305,6 +277,11 @@ ffeequiv_layout_local_ (ffeequiv eq) need_storage = TRUE; /* Somebody is likely to need storage. */ + if ((rooted_st = ffesymbol_storage (rooted_sym)) == NULL) + { + rooted_sym = NULL; + continue; /* No storage for this guy, try another. */ + } #if FFEEQUIV_DEBUG fprintf (stderr, " Rooted: `%s' at %" ffetargetOffset_f "d\n", @@ -407,7 +384,6 @@ ffeequiv_layout_local_ (ffeequiv eq) ffebad_start (FFEBAD_EQUIV_ALIGN); ffebad_string (ffesymbol_text (item_sym)); ffebad_finish (); - ffesymbol_set_equiv (item_sym, NULL); /* Don't bother with me anymore. */ continue; } @@ -519,15 +495,12 @@ ffeequiv_layout_local_ (ffeequiv eq) ffebad_finish (); } } - ffesymbol_set_equiv (item_sym, NULL); /* Don't bother with me anymore. */ } /* (For every equivalence item in the list) */ ffebld_set_head (list, NULL); /* Don't do this list again. */ } /* (For every equivalence list in the list of equivs) */ } while (new_storage && need_storage); - ffesymbol_set_equiv (root_sym, NULL); /* This one has storage now. */ - ffeequiv_kill (eq); /* Fully processed, no longer needed. */ if (init) @@ -900,31 +873,6 @@ ffeequiv_kill (ffeequiv victim) { victim->next->previous = victim->previous; victim->previous->next = victim->next; - if (ffe_is_do_internal_checks ()) - { - ffebld list; - ffebld item; - ffebld expr; - - /* Assert that nobody our victim points to still points to it. */ - - assert ((victim->common == NULL) - || (ffesymbol_equiv (victim->common) == NULL)); - - for (list = victim->list; list != NULL; list = ffebld_trail (list)) - { - for (item = ffebld_head (list); item != NULL; item = ffebld_trail (item)) - { - ffesymbol sym; - - expr = ffebld_head (item); - sym = ffeequiv_symbol (expr); - if (sym == NULL) - continue; - assert (ffesymbol_equiv (sym) != victim); - } - } - } malloc_kill_ks (ffe_pool_program_unit (), victim, sizeof (*victim)); } diff --git a/gnu/usr.bin/gcc/f/equiv.h b/gnu/usr.bin/gcc/f/equiv.h index 225cafded1b..e0993a34560 100644 --- a/gnu/usr.bin/gcc/f/equiv.h +++ b/gnu/usr.bin/gcc/f/equiv.h @@ -1,5 +1,5 @@ /* equiv.h -- Public #include File (module.h template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/expr.c b/gnu/usr.bin/gcc/f/expr.c index 47ab53fa008..b1ec1d46be2 100644 --- a/gnu/usr.bin/gcc/f/expr.c +++ b/gnu/usr.bin/gcc/f/expr.c @@ -1,5 +1,5 @@ /* expr.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -37,7 +37,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "bld.h" #include "com.h" #include "implic.h" -#include "intrin.h" #include "info.h" #include "lex.h" #include "malloc.h" @@ -403,7 +402,6 @@ static ffelexHandler ffeexpr_token_substring_ (ffelexToken ft, ffebld expr, static ffelexHandler ffeexpr_token_substring_1_ (ffelexToken ft, ffebld expr, ffelexToken t); static ffelexHandler ffeexpr_token_substrp_ (ffelexToken t); -static ffelexHandler ffeexpr_token_intrincheck_ (ffelexToken t); static ffelexHandler ffeexpr_token_funsubstr_ (ffelexToken ft, ffebld expr, ffelexToken t); static ffelexHandler ffeexpr_token_anything_ (ffelexToken ft, ffebld expr, @@ -8097,7 +8095,7 @@ ffeexpr_cb_end_loc_ (ffelexToken ft UNUSED, ffebld expr, ffelexToken t) e->u.operand = ffebld_new_percent_loc (expr); ffebld_set_info (e->u.operand, ffeinfo_new (FFEINFO_basictypeINTEGER, - ffecom_pointer_kind (), + FFEINFO_kindtypeINTEGERDEFAULT, 0, FFEINFO_kindENTITY, FFEINFO_whereFLEETING, @@ -11442,7 +11440,7 @@ ffeexpr_nil_rhs_ (ffelexToken t) switch (ffelex_token_type (t)) { case FFELEX_typeQUOTE: - if (ffe_is_vxt ()) + if (ffe_is_vxt_not_90 ()) return (ffelexHandler) ffeexpr_nil_quote_; ffelex_set_expecting_hollerith (-1, '\"', ffelex_token_where_line (t), @@ -12274,12 +12272,12 @@ again: /* :::::::::::::::::::: */ : ffeinfo_basictype (info)) { case FFEINFO_basictypeINTEGER: - error = (ffeinfo_kindtype (info) != ffecom_label_kind ()); + error = (ffeinfo_kindtype (info) != FFEINFO_kindtypeINTEGERDEFAULT); break; case FFEINFO_basictypeLOGICAL: error = !ffe_is_ugly_logint () - || (ffeinfo_kindtype (info) != ffecom_label_kind ()); + || (ffeinfo_kindtype (info) != FFEINFO_kindtypeLOGICALDEFAULT); break; default: @@ -13009,9 +13007,8 @@ again: /* :::::::::::::::::::: */ { case FFEINFO_basictypeINTEGER: error = (expr == NULL) - || ((ffeinfo_rank (info) != 0) ? - ffe_is_pedantic () /* F77 C5. */ - : (ffeinfo_kindtype (info) != ffecom_label_kind ())) + || ((ffeinfo_rank (info) != 0) + && ffe_is_pedantic ()) /* F77 C5. */ || (ffebld_op (expr) != FFEBLD_opSYMTER); break; @@ -13263,7 +13260,7 @@ ffeexpr_token_rhs_ (ffelexToken t) switch (ffelex_token_type (t)) { case FFELEX_typeQUOTE: - if (ffe_is_vxt ()) + if (ffe_is_vxt_not_90 ()) { ffeexpr_tokens_[0] = ffelex_token_use (t); return (ffelexHandler) ffeexpr_token_quote_; @@ -15039,7 +15036,7 @@ just_name: /* :::::::::::::::::::: */ if (ffesymbol_generic (s) != FFEINTRIN_genNONE) ffeintrin_fulfill_generic (&expr, &info, e->token); else if (ffesymbol_specific (s) != FFEINTRIN_specNONE) - ffeintrin_fulfill_specific (&expr, &info, NULL, e->token); + ffeintrin_fulfill_specific (&expr, &info, e->token); ffebld_set_info (expr, ffeinfo_new (ffeinfo_basictype (info), ffeinfo_kindtype (info), @@ -15838,9 +15835,7 @@ ffeexpr_declare_unadorned_ (ffelexToken t, bool maybe_intrin) switch (ffeexpr_context_outer_ (ffeexpr_stack_)) { case FFEEXPR_contextSUBROUTINEREF: - bad = ((k != FFEINFO_kindSUBROUTINE) - && ((ffesymbol_where (s) != FFEINFO_whereINTRINSIC) - || (k != FFEINFO_kindNONE))); + bad = (k != FFEINFO_kindSUBROUTINE); break; case FFEEXPR_contextFILEEXTFUNC: @@ -15866,11 +15861,6 @@ ffeexpr_declare_unadorned_ (ffelexToken t, bool maybe_intrin) break; case FFEINFO_kindNONE: - if (ffesymbol_where (s) == FFEINFO_whereINTRINSIC) - { - bad = !(ffeintrin_is_actualarg (ffesymbol_specific (s))); - break; - } /* If state is UNDERSTOOD here, it's CHAR*(*) or attrsANY, and in the former case, attrsTYPE is set, so we @@ -16442,7 +16432,7 @@ ffeexpr_sym_lhs_call_ (ffesymbol s, ffelexToken t) assert (ffesymbol_state (s) == FFESYMBOL_stateNONE); if (ffeintrin_is_intrinsic (ffesymbol_text (s), t, FALSE, - &gen, &spec, &imp)) + &gen, &spec, &imp, &kind)) { ffesymbol_signal_change (s); /* May need to back up to previous version. */ @@ -16453,7 +16443,7 @@ ffeexpr_sym_lhs_call_ (ffesymbol s, ffelexToken t) ffeinfo_new (FFEINFO_basictypeNONE, FFEINFO_kindtypeNONE, 0, - FFEINFO_kindNONE, + kind, FFEINFO_whereINTRINSIC, FFETARGET_charactersizeNONE)); ffesymbol_set_state (s, FFESYMBOL_stateUNDERSTOOD); @@ -16490,8 +16480,6 @@ ffeexpr_sym_lhs_call_ (ffesymbol s, ffelexToken t) ffesymbol_set_state (s, FFESYMBOL_stateUNDERSTOOD); ffesymbol_resolve_intrin (s); s = ffecom_sym_learned (s); - if (where == FFEINFO_whereGLOBAL) - ffesymbol_globalize (s); ffesymbol_signal_unreported (s); /* For debugging purposes. */ } @@ -16850,8 +16838,6 @@ ffeexpr_sym_lhs_extfunc_ (ffesymbol s, ffelexToken t) ffesymbol_set_state (s, FFESYMBOL_stateUNDERSTOOD); ffesymbol_resolve_intrin (s); s = ffecom_sym_learned (s); - if (where == FFEINFO_whereGLOBAL) - ffesymbol_globalize (s); ffesymbol_signal_unreported (s); /* For debugging purposes. */ } @@ -17132,8 +17118,6 @@ ffeexpr_sym_rhs_actualarg_ (ffesymbol s, ffelexToken t) ffesymbol_set_attrs (s, na); ffesymbol_set_state (s, ns); s = ffecom_sym_learned (s); - if (where == FFEINFO_whereGLOBAL) - ffesymbol_globalize (s); ffesymbol_signal_unreported (s); /* For debugging purposes. */ } @@ -17578,9 +17562,7 @@ ffeexpr_declare_parenthesized_ (ffelexToken t, bool maybe_intrin, switch (ffeexpr_context_outer_ (ffeexpr_stack_)) { case FFEEXPR_contextSUBROUTINEREF: - bad = ((k != FFEINFO_kindSUBROUTINE) - && ((ffesymbol_where (s) != FFEINFO_whereINTRINSIC) - || (k != FFEINFO_kindNONE))); + bad = (k != FFEINFO_kindSUBROUTINE); break; case FFEEXPR_contextDATA: @@ -17672,15 +17654,6 @@ ffeexpr_declare_parenthesized_ (ffelexToken t, bool maybe_intrin, switch (bad ? FFEINFO_kindANY : k) { case FFEINFO_kindNONE: /* Case "CHARACTER X,Y; Y=X(?". */ - if (ffesymbol_where (s) == FFEINFO_whereINTRINSIC) - { - if (ffeexpr_context_outer_ (ffeexpr_stack_) - == FFEEXPR_contextSUBROUTINEREF) - *paren_type = FFEEXPR_parentypeSUBROUTINE_; - else - *paren_type = FFEEXPR_parentypeFUNCTION_; - break; - } if (st == FFESYMBOL_stateUNDERSTOOD) { bad = TRUE; @@ -17987,7 +17960,7 @@ ffeexpr_paren_rhs_let_ (ffesymbol s, ffelexToken t) | FFESYMBOL_attrsSFARG))); if (ffeintrin_is_intrinsic (ffesymbol_text (s), t, FALSE, - &gen, &spec, &imp)) + &gen, &spec, &imp, &kind)) { if (!(sa & FFESYMBOL_attrsANYLEN) && (ffeimplic_peek_symbol_type (s, NULL) @@ -18003,7 +17976,7 @@ ffeexpr_paren_rhs_let_ (ffesymbol s, ffelexToken t) ffeinfo_new (FFEINFO_basictypeNONE, FFEINFO_kindtypeNONE, 0, - FFEINFO_kindNONE, + kind, FFEINFO_whereINTRINSIC, FFETARGET_charactersizeNONE)); ffesymbol_set_state (s, FFESYMBOL_stateUNDERSTOOD); @@ -18037,7 +18010,7 @@ ffeexpr_paren_rhs_let_ (ffesymbol s, ffelexToken t) assert (ffesymbol_state (s) == FFESYMBOL_stateNONE); if (ffeintrin_is_intrinsic (ffesymbol_text (s), t, FALSE, - &gen, &spec, &imp)) + &gen, &spec, &imp, &kind)) { if (ffeimplic_peek_symbol_type (s, NULL) == FFEINFO_basictypeCHARACTER) @@ -18052,7 +18025,7 @@ ffeexpr_paren_rhs_let_ (ffesymbol s, ffelexToken t) ffeinfo_new (FFEINFO_basictypeNONE, FFEINFO_kindtypeNONE, 0, - FFEINFO_kindNONE, + kind, FFEINFO_whereINTRINSIC, FFETARGET_charactersizeNONE)); ffesymbol_set_state (s, FFESYMBOL_stateUNDERSTOOD); @@ -18100,8 +18073,6 @@ ffeexpr_paren_rhs_let_ (ffesymbol s, ffelexToken t) ffesymbol_set_state (s, FFESYMBOL_stateUNDERSTOOD); ffesymbol_resolve_intrin (s); s = ffecom_sym_learned (s); - if (where == FFEINFO_whereGLOBAL) - ffesymbol_globalize (s); ffesymbol_signal_unreported (s); /* For debugging purposes. */ } @@ -18121,8 +18092,8 @@ ffeexpr_token_arguments_ (ffelexToken ft, ffebld expr, ffelexToken t) ffeexprExpr_ procedure; ffebld reduced; ffeinfo info; + bool is_function; ffeexprContext ctx; - bool check_intrin = FALSE; /* Set TRUE if intrinsic is REAL(Z) or AIMAG(Z). */ procedure = ffeexpr_stack_->exprstack; info = ffebld_info (procedure->u.operand); @@ -18231,6 +18202,7 @@ ffeexpr_token_arguments_ (ffelexToken ft, ffebld expr, ffelexToken t) break; } + is_function = (ffeinfo_kind (info) != FFEINFO_kindSUBROUTINE); if ((ffeinfo_where (info) == FFEINFO_whereCONSTANT) && (ffeexpr_stack_->next_dummy != NULL)) { /* Too few arguments. */ @@ -18287,7 +18259,7 @@ ffeexpr_token_arguments_ (ffelexToken ft, ffebld expr, ffelexToken t) } else { - if (ffeexpr_stack_->context != FFEEXPR_contextSUBROUTINEREF) + if (is_function) reduced = ffebld_new_funcref (procedure->u.operand, ffeexpr_stack_->expr); else @@ -18297,7 +18269,7 @@ ffeexpr_token_arguments_ (ffelexToken ft, ffebld expr, ffelexToken t) ffeintrin_fulfill_generic (&reduced, &info, ffeexpr_stack_->tokens[0]); else if (ffebld_symter_specific (procedure->u.operand) != FFEINTRIN_specNONE) - ffeintrin_fulfill_specific (&reduced, &info, &check_intrin, + ffeintrin_fulfill_specific (&reduced, &info, ffeexpr_stack_->tokens[0]); ffebld_set_info (reduced, ffeinfo_new (ffeinfo_basictype (info), @@ -18319,37 +18291,6 @@ ffeexpr_token_arguments_ (ffelexToken ft, ffebld expr, ffelexToken t) { ffelex_token_kill (ffeexpr_stack_->tokens[0]); ffeexpr_is_substr_ok_ = FALSE; /* Nobody likes "FUNC(3)(1:1)".... */ - - /* If the intrinsic needs checking (is REAL(Z) or AIMAG(Z), where - Z is DOUBLE COMPLEX), and a command-line option doesn't already - establish interpretation, probably complain. */ - - if (check_intrin - && !ffe_is_90 () - && !ffe_is_ugly_complex ()) - { - /* If the outer expression is REAL(me...), issue diagnostic - only if next token isn't the close-paren for REAL(me). */ - - if ((ffeexpr_stack_->previous != NULL) - && ((reduced = ffeexpr_stack_->previous->exprstack->u.operand) != NULL) - && (ffebld_op (reduced) == FFEBLD_opSYMTER) - && (ffebld_symter_implementation (reduced) == FFEINTRIN_impREAL)) - return (ffelexHandler) ffeexpr_token_intrincheck_; - - /* Diagnose the ambiguity now. */ - - if (ffebad_start (FFEBAD_INTRINSIC_CMPAMBIG)) - { - ffebad_string (ffeintrin_name_implementation - (ffebld_symter_implementation - (ffebld_left - (ffeexpr_stack_->exprstack->u.operand)))); - ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_->exprstack->token), - ffelex_token_where_column (ffeexpr_stack_->exprstack->token)); - ffebad_finish (); - } - } return (ffelexHandler) ffeexpr_token_substrp_; } @@ -19040,24 +18981,6 @@ ffeexpr_token_substrp_ (ffelexToken t) ffeexpr_token_substring_); } -static ffelexHandler -ffeexpr_token_intrincheck_ (ffelexToken t) -{ - if ((ffelex_token_type (t) != FFELEX_typeCLOSE_PAREN) - && ffebad_start (FFEBAD_INTRINSIC_CMPAMBIG)) - { - ffebad_string (ffeintrin_name_implementation - (ffebld_symter_implementation - (ffebld_left - (ffeexpr_stack_->exprstack->u.operand)))); - ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_->exprstack->token), - ffelex_token_where_column (ffeexpr_stack_->exprstack->token)); - ffebad_finish (); - } - - return (ffelexHandler) ffeexpr_token_substrp_ (t); -} - /* ffeexpr_token_funsubstr_ -- NAME OPEN_PAREN expr Return a pointer to this function to the lexer (ffelex), which will @@ -19070,6 +18993,7 @@ ffeexpr_token_intrincheck_ (ffelexToken t) static ffelexHandler ffeexpr_token_funsubstr_ (ffelexToken ft, ffebld expr, ffelexToken t) { + ffeinfoKind kind; ffeinfoWhere where; ffesymbol s; ffesymbolAttrs sa; @@ -19132,7 +19056,7 @@ ffeexpr_token_funsubstr_ (ffelexToken ft, ffebld expr, ffelexToken t) reference is to a function. */ if (ffeintrin_is_intrinsic (ffesymbol_text (s), ffeexpr_stack_->tokens[0], - FALSE, &gen, &spec, &imp)) + FALSE, &gen, &spec, &imp, &kind)) { ffebld_symter_set_generic (symter, gen); ffebld_symter_set_specific (symter, spec); @@ -19144,7 +19068,7 @@ ffeexpr_token_funsubstr_ (ffelexToken ft, ffebld expr, ffelexToken t) ffeinfo_new (FFEINFO_basictypeNONE, FFEINFO_kindtypeNONE, 0, - FFEINFO_kindNONE, + kind, FFEINFO_whereINTRINSIC, FFETARGET_charactersizeNONE)); } @@ -19171,8 +19095,6 @@ ffeexpr_token_funsubstr_ (ffelexToken ft, ffebld expr, ffelexToken t) ffesymbol_set_state (s, FFESYMBOL_stateUNDERSTOOD); ffesymbol_resolve_intrin (s); s = ffecom_sym_learned (s); - if (ffesymbol_where (s) == FFEINFO_whereGLOBAL) - ffesymbol_globalize (s); ffesymbol_signal_unreported (s); /* For debugging purposes. */ ffebld_init_list (&ffeexpr_stack_->expr, &ffeexpr_stack_->bottom); diff --git a/gnu/usr.bin/gcc/f/expr.h b/gnu/usr.bin/gcc/f/expr.h index db7d9fa78e7..7ddca4ca774 100644 --- a/gnu/usr.bin/gcc/f/expr.h +++ b/gnu/usr.bin/gcc/f/expr.h @@ -1,5 +1,5 @@ /* expr.h -- Public #include File (module.h template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/g77.1 b/gnu/usr.bin/gcc/f/g77.1 index 8164564f4b7..b9709f3cd71 100644 --- a/gnu/usr.bin/gcc/f/g77.1 +++ b/gnu/usr.bin/gcc/f/g77.1 @@ -1,7 +1,7 @@ .\" Copyright (c) 1995, 1996 Free Software Foundation -*-Text-*- .\" See section COPYING for conditions for redistribution .\" FIXME: no info here on predefines. Should there be? extra for F77... -.TH G77 1 "1997-02-24" "GNU Tools" "GNU Tools" +.TH G77 1 "1996-03-01" "GNU Tools" "GNU Tools" .de BP .sp .ti \-.2i @@ -14,18 +14,14 @@ g77 \- GNU project F77 Compiler (v0.5.18) .IR option " | " "filename " ].\|.\|. .SH WARNING The information in this man page is an extract from the full -documentation of the GNU Fortran compiler (version 0.5.18), -and is limited to the meaning of the options. +documentation of the GNU Fortran compiler, and is limited to the meaning of +the options. .PP -This man page is not up to date, since no volunteers want to +This man page is not kept up to date except when volunteers want to maintain it. If you find a discrepancy between the man page and the software, please check the Info file, which is the authoritative documentation. .PP -The version of GNU Fortran documented by the Info file is 0.5.20, -which includes substantial improvements and changes since 0.5.18, -the version documented in this man page. -.PP If we find that the things in this man page that are out of date cause significant confusion or complaints, we will stop distributing the man page. The alternative, updating the man page when we update the Info diff --git a/gnu/usr.bin/gcc/f/g77.c b/gnu/usr.bin/gcc/f/g77.c index f7b982199d7..bc924176ead 100644 --- a/gnu/usr.bin/gcc/f/g77.c +++ b/gnu/usr.bin/gcc/f/g77.c @@ -1,5 +1,5 @@ /* G77 preliminary semantic processing for the compiler driver. - Copyright (C) 1993-1997 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. Contributed by Brendan Kehoe (brendan@cygnus.com), with significant modifications for GNU Fortran by James Craig Burley (burley@gnu.ai.mit.edu). @@ -88,28 +88,12 @@ g77: `f77' language not included in list of languages\n\ #endif #include -/* Include multi-lib information. */ -#include "multilib.h" - #ifndef R_OK #define R_OK 4 #define W_OK 2 #define X_OK 1 #endif -#ifndef WIFSIGNALED -#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f) -#endif -#ifndef WTERMSIG -#define WTERMSIG(S) ((S) & 0x7f) -#endif -#ifndef WIFEXITED -#define WIFEXITED(S) (((S) & 0xff) == 0) -#endif -#ifndef WEXITSTATUS -#define WEXITSTATUS(S) (((S) & 0xff00) >> 8) -#endif - /* Defined to the name of the compiler; if using a cross compiler, the Makefile should compile this file with the proper name (e.g., "i386-aout-gcc"). */ @@ -240,16 +224,12 @@ typedef enum OPTION_c, /* Aka --compile. */ OPTION_driver, /* Wrapper-specific option. */ OPTION_E, /* Aka --preprocess. */ - OPTION_for_linker, /* Aka `-Xlinker' and `-Wl,'. */ OPTION_help, /* --help. */ OPTION_i, /* -imacros, -include, -include-*. */ - OPTION_l, - OPTION_L, /* Aka --library-directory. */ OPTION_M, /* Aka --dependencies. */ OPTION_MM, /* Aka --user-dependencies. */ OPTION_nostdlib, /* Aka --no-standard-libraries, or -nodefaultlibs. */ - OPTION_o, /* Aka --output. */ OPTION_P, /* Aka --print-*-name. */ OPTION_S, /* Aka --assemble. */ OPTION_v, /* Aka --verbose. */ @@ -298,20 +278,11 @@ typedef enum otherwise, in /usr/tmp or /tmp. */ static char *temp_filename; -static char *temp_filename_f; /* Same with ".f" appended. */ /* Length of the prefix. */ static int temp_filename_length; -/* The number of errors that have occurred; the link phase will not be - run if this is non-zero. */ -static int error_count = 0; - -/* Number of commands that exited with a signal. */ - -static int signal_count = 0; - /* END OF STUFF FROM gcc-2.7.0/gcc.c. */ char * @@ -472,26 +443,12 @@ pfatal_with_name (name) char *s; if (errno < sys_nerr) - s = concat ("%s: ", my_strerror (errno)); + s = concat3 ("%s: ", sys_errlist[errno], ""); else - s = "cannot open `%s'"; + s = "cannot open %s"; fatal (s, name); } -static void -perror_exec (name) - char *name; -{ - char *s; - - if (errno < sys_nerr) - s = concat ("installation problem, cannot exec `%s': ", - my_strerror (errno)); - else - s = "installation problem, cannot exec `%s'"; - error (s, name); -} - /* Compute a string to use as the base of all temporary file names. It is substituted for %g. */ @@ -548,14 +505,65 @@ choose_temp_base () temp_filename_length = strlen (temp_filename); if (temp_filename_length == 0) abort (); +} - temp_filename_f = xmalloc (temp_filename_length + 2); - strcpy (temp_filename_f, temp_filename); - temp_filename_f[temp_filename_length] = '.'; - temp_filename_f[temp_filename_length + 1] = 'f'; - temp_filename_f[temp_filename_length + 2] = '\0'; +#ifdef __MSDOS__ +static void +perror_exec (name) + char *name; +{ + char *s; + + if (errno < sys_nerr) + s = concat3 ("installation problem, cannot exec %s: ", + my_strerror( errno ), ""); + else + s = "installation problem, cannot exec %s"; + error (s, name); } +/* This is almost exactly what's in gcc.c:pexecute for MSDOS. */ +void +run_dos (program, argv) + char *program; + char *argv[]; +{ + char *scmd, *rf; + FILE *argfile; + int i; + + choose_temp_base (); /* not in gcc.c */ + + scmd = (char *) malloc (strlen (program) + strlen (temp_filename) + 10); + rf = scmd + strlen (program) + 6; + sprintf (scmd, "%s.exe @%s.gp", program, temp_filename); + + argfile = fopen (rf, "w"); + if (argfile == 0) + pfatal_with_name (rf); + + for (i=1; argv[i]; i++) + { + char *cp; + for (cp = argv[i]; *cp; cp++) + { + if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp)) + fputc ('\\', argfile); + fputc (*cp, argfile); + } + fputc ('\n', argfile); + } + fclose (argfile); + + i = system (scmd); + + remove (rf); + + if (i == -1) + perror_exec (program); +} +#endif /* __MSDOS__ */ + /* This structure describes one mapping. */ struct option_map { @@ -739,13 +747,12 @@ lookup_option (xopt, xskip, xarg, text) char *text; { Option opt = OPTION_; - int skip; + int skip = -1; char *arg = NULL; if ((skip = SWITCH_TAKES_ARG (text[1])) > (text[2] != '\0')) skip -= (text[2] != '\0'); /* Usually one of "DUoeTuImLA". */ - - if (text[1] == 'B') + else if (text[1] == 'B') opt = OPTION_B, skip = (text[2] == '\0'), arg = text + 2; else if (text[1] == 'b') opt = OPTION_b, skip = (text[2] == '\0'), arg = text + 2; @@ -755,20 +762,12 @@ lookup_option (xopt, xskip, xarg, text) opt = OPTION_E, skip = 0; else if (text[1] == 'i') opt = OPTION_i, skip = 0; - else if (text[1] == 'l') - opt = OPTION_l; - else if (text[1] == 'L') - opt = OPTION_L, skip = (text[2] == '\0'), arg = text + 2; - else if (text[1] == 'o') - opt = OPTION_o; else if ((text[1] == 'S') && (text[2] == '\0')) opt = OPTION_S, skip = 0; else if (text[1] == 'V') opt = OPTION_V, skip = (text[2] == '\0'); else if ((text[1] == 'v') && (text[2] == '\0')) opt = OPTION_v, skip = 0; - else if ((text[1] == 'W') && (text[2] == 'l') && (text[3] == ',')) - opt = OPTION_for_linker, skip = 0; else if (text[1] == 'x') opt = OPTION_x, skip = (text[2] == '\0'), arg = text + 2; else @@ -778,8 +777,7 @@ lookup_option (xopt, xskip, xarg, text) "imacros", "aux-info", "idirafter", "iprefix", "iwithprefix", "iwithprefixbefore", "isystem". */ ; - - if (text[1] != '-') + else if (text[1] != '-') skip = 0; else if (strcmp (text, "--assemble") == 0) opt = OPTION_S; @@ -799,16 +797,12 @@ lookup_option (xopt, xskip, xarg, text) opt = OPTION_i; else if (opteq (&skip, &arg, text, "--language") == 0) opt = OPTION_x; - else if (opteq (&skip, &arg, text, "--library-directory") == 0) - opt = OPTION_L; else if ((strcmp (text, "-M") == 0) || (strcmp (text, "--dependencies") == 0)) opt = OPTION_M; else if ((strcmp (text, "-MM") == 0) || (strcmp (text, "--user-dependencies") == 0)) opt = OPTION_MM; - else if (strcmp (text, "--output") == 0) - opt = OPTION_o; else if (opteq (&skip, &arg, text, "--prefix") == 0) opt = OPTION_B; else if (strcmp (text, "--preprocess") == 0) @@ -838,7 +832,9 @@ lookup_option (xopt, xskip, xarg, text) || (opteq (&skip, &arg, text, "--for-assembler") == 0) || (opteq (&skip, &arg, text, "--for-linker") == 0) || (opteq (&skip, &arg, text, "--force-link") == 0) + || (opteq (&skip, &arg, text, "--library-directory") == 0) || (opteq (&skip, &arg, text, "--machine") == 0) + || (opteq (&skip, &arg, text, "--output") == 0) || (opteq (&skip, &arg, text, "--target") == 0) || (opteq (&skip, &arg, text, "--undefine-macro") == 0)) ; @@ -851,13 +847,7 @@ lookup_option (xopt, xskip, xarg, text) if (xskip != NULL) *xskip = skip; if (xarg != NULL) - { - if ((arg != NULL) - && (arg[0] == '\0')) - *xarg = NULL; - else - *xarg = arg; - } + *xarg = arg; } static void @@ -894,245 +884,6 @@ append_arg (arg) newargv[newargc++] = arg; } -extern int execv (), execvp (); - -/* If a stage of compilation returns an exit status >= 1, - compilation of that file ceases. */ - -#define MIN_FATAL_STATUS 1 - -/* stdin file number. */ -#define STDIN_FILE_NO 0 - -/* stdout file number. */ -#define STDOUT_FILE_NO 1 - -/* value of `pipe': port index for reading. */ -#define READ_PORT 0 - -/* value of `pipe': port index for writing. */ -#define WRITE_PORT 1 - -/* Pipe waiting from last process, to be used as input for the next one. - Value is STDIN_FILE_NO if no pipe is waiting - (i.e. the next command is the first of a group). */ - -static int last_pipe_input; - -/* Fork one piped subcommand. FUNC is the system call to use - (either execv or execvp). ARGV is the arg vector to use. - NOT_LAST is nonzero if this is not the last subcommand - (i.e. its output should be piped to the next one.) */ - -#ifdef __MSDOS__ - -#include -static int -pexecute (search_flag, program, argv, not_last) - int search_flag; - char *program; - char *argv[]; - int not_last; -{ -#ifdef __GO32__ - int i = (search_flag ? spawnv : spawnvp) (1, program, argv); -#else - char *scmd, *rf; - FILE *argfile; - int i, el = search_flag ? 0 : 4; - - scmd = (char *)malloc (strlen (program) + strlen (temp_filename) + 6 + el); - rf = scmd + strlen(program) + 2 + el; - sprintf (scmd, "%s%s @%s.gp", program, - (search_flag ? "" : ".exe"), temp_filename); - argfile = fopen (rf, "w"); - if (argfile == 0) - pfatal_with_name (rf); - - for (i=1; argv[i]; i++) - { - char *cp; - for (cp = argv[i]; *cp; cp++) - { - if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp)) - fputc ('\\', argfile); - fputc (*cp, argfile); - } - fputc ('\n', argfile); - } - fclose (argfile); - - i = system (scmd); - - remove (rf); -#endif - - if (i == -1) - { - perror_exec (program); - return MIN_FATAL_STATUS << 8; - } - return i << 8; -} - -#endif - -#if !defined(__MSDOS__) && !defined(OS2) && !defined(_WIN32) - -static int -pexecute (search_flag, program, argv, not_last) - int search_flag; - char *program; - char *argv[]; - int not_last; -{ - int (*func)() = (search_flag ? execv : execvp); - int pid; - int pdes[2]; - int input_desc = last_pipe_input; - int output_desc = STDOUT_FILE_NO; - int retries, sleep_interval; - - /* If this isn't the last process, make a pipe for its output, - and record it as waiting to be the input to the next process. */ - - if (not_last) - { - if (pipe (pdes) < 0) - pfatal_with_name ("pipe"); - output_desc = pdes[WRITE_PORT]; - last_pipe_input = pdes[READ_PORT]; - } - else - last_pipe_input = STDIN_FILE_NO; - - /* Fork a subprocess; wait and retry if it fails. */ - sleep_interval = 1; - for (retries = 0; retries < 4; retries++) - { - pid = vfork (); - if (pid >= 0) - break; - sleep (sleep_interval); - sleep_interval *= 2; - } - - switch (pid) - { - case -1: -#ifdef vfork - pfatal_with_name ("fork"); -#else - pfatal_with_name ("vfork"); -#endif - /* NOTREACHED */ - return 0; - - case 0: /* child */ - /* Move the input and output pipes into place, if nec. */ - if (input_desc != STDIN_FILE_NO) - { - close (STDIN_FILE_NO); - dup (input_desc); - close (input_desc); - } - if (output_desc != STDOUT_FILE_NO) - { - close (STDOUT_FILE_NO); - dup (output_desc); - close (output_desc); - } - - /* Close the parent's descs that aren't wanted here. */ - if (last_pipe_input != STDIN_FILE_NO) - close (last_pipe_input); - - /* Exec the program. */ - (*func) (program, argv); - perror_exec (program); - exit (-1); - /* NOTREACHED */ - return 0; - - default: - /* In the parent, after forking. - Close the descriptors that we made for this child. */ - if (input_desc != STDIN_FILE_NO) - close (input_desc); - if (output_desc != STDOUT_FILE_NO) - close (output_desc); - - /* Return child's process number. */ - return pid; - } -} - -#endif /* not __MSDOS__ and not OS2 and not _WIN32 */ - -#if defined(OS2) - -static int -pexecute (search_flag, program, argv, not_last) - int search_flag; - char *program; - char *argv[]; - int not_last; -{ - return (search_flag ? spawnv : spawnvp) (1, program, argv); -} -#endif /* OS2 */ - -#if defined(_WIN32) - -static int -pexecute (search_flag, program, argv, not_last) - int search_flag; - char *program; - char *argv[]; - int not_last; -{ - return (search_flag ? __spawnv : __spawnvp) (1, program, argv); -} -#endif /* _WIN32 */ - -static int -doit (char *program, char **argv) -{ - int pid; - int status; - int ret_code = 0; - - pid = pexecute (0, program, argv, 0); - -#ifdef __MSDOS__ - status = pid; -#else -#ifdef _WIN32 - pid = cwait (&status, pid, WAIT_CHILD); -#else - pid = wait (&status); -#endif -#endif - if (pid < 0) - abort (); - - if (status != 0) - { - if (WIFSIGNALED (status)) - { - fatal ("Internal compiler error: program %s got fatal signal %d", - program, WTERMSIG (status)); - signal_count++; - ret_code = -1; - } - else if (WIFEXITED (status) - && WEXITSTATUS (status) >= MIN_FATAL_STATUS) - ret_code = -1; - } - - return ret_code; -} - int main (argc, argv) int argc; @@ -1144,8 +895,6 @@ main (argc, argv) Option opt; int skip; char *arg; - int n_infiles = 0; - int n_outfiles = 0; /* This will be NULL if we encounter a situation where we should not link in libf2c. */ @@ -1153,7 +902,7 @@ main (argc, argv) /* This will become 0 if anything other than -v and kin (like -V) is seen, meaning the user is trying to accomplish something. - If it remains nonzero, and the user wants version info, add stuff to + If it remains nonzero, the user wants version info, so add stuff to the command line to make gcc invoke all the appropriate phases to get all the version info. */ int add_version_magic = 1; @@ -1219,17 +968,11 @@ main (argc, argv) for (i = 1; i < argc; ++i) { - if ((argv[i][0] == '+') && (argv[i][1] == 'e')) + if (argv[i][0] != '-') { add_version_magic = 0; continue; } - else if ((argv[i][0] != '-') || (argv[i][1] == 0)) - { - ++n_infiles; - add_version_magic = 0; - continue; - } lookup_option (&opt, &skip, NULL, argv[i]); @@ -1247,26 +990,13 @@ main (argc, argv) add_version_magic = 0; break; - case OPTION_for_linker: - case OPTION_l: - ++n_infiles; - add_version_magic = 0; - break; - - case OPTION_o: - ++n_outfiles; - add_version_magic = 0; - break; - case OPTION_v: - if (!verbose) - printf ("g77 version %s\n", ffezzz_version_string); verbose = 1; + printf ("g77 version %s\n", ffezzz_version_string); break; case OPTION_b: case OPTION_B: - case OPTION_L: case OPTION_driver: case OPTION_i: case OPTION_V: @@ -1337,8 +1067,11 @@ Report bugs to fortran@gnu.ai.mit.edu.\n"); fatal ("argument to `%s' missing\n", argv[i]); } - if ((n_outfiles != 0) && (n_infiles == 0)) - fatal ("No input files; unwilling to write output files"); + /* If only -v and related options (like -V), don't link the standard + libraries. */ + + if (add_version_magic) + library = NULL; /* Second pass through arglist, transforming arguments as appropriate. */ @@ -1365,6 +1098,8 @@ Report bugs to fortran@gnu.ai.mit.edu.\n"); /* Track input language. */ char *lang; + append_arg (argv[i]); + if (arg == NULL) lang = argv[i+1]; else @@ -1450,7 +1185,7 @@ Report bugs to fortran@gnu.ai.mit.edu.\n"); /* Add -lf2c -lm as necessary. */ - if (!add_version_magic && library) + if (library) { /* Doing a link and no -nostdlib. */ if (saw_speclang) append_arg ("-xnone"); @@ -1464,29 +1199,21 @@ Report bugs to fortran@gnu.ai.mit.edu.\n"); break; } } - else if (add_version_magic && verbose) + else if (verbose && add_version_magic) { - FILE *fsrc; - choose_temp_base (); append_arg ("-fnull-version"); append_arg ("-o"); append_arg (temp_filename); append_arg ("-xf77-cpp-input"); - append_arg (temp_filename_f); + append_arg ("/dev/null"); append_arg ("-xnone"); if (library) { append_arg (library); append_arg ("-lm"); } - - fsrc = fopen (temp_filename_f, "w"); - if (fsrc == 0) - pfatal_with_name (fsrc); - fputs (" call g77__fvers;call g77__ivers;call g77__uvers;end\n", fsrc); - fclose (fsrc); } append_arg (NULL); @@ -1505,26 +1232,18 @@ Report bugs to fortran@gnu.ai.mit.edu.\n"); fprintf (stderr, " %s", newargv[i]); fprintf (stderr, "\n"); } +#if !defined(OS2) && !defined (_WIN32) +#ifdef __MSDOS__ + run_dos (gcc, newargv); +#else /* !__MSDOS__ */ + if (execvp (gcc, newargv) < 0) + pfatal_with_name (gcc); +#endif /* __MSDOS__ */ +#else /* OS2 or _WIN32 */ + if (spawnvp (1, gcc, newargv) < 0) + pfatal_with_name (gcc); +#endif - if (doit (gcc, newargv) < 0) - ++error_count; - else if (add_version_magic && verbose) - { - char *outargv[2]; - - outargv[0] = temp_filename; - outargv[1] = 0; - - if (doit (temp_filename, outargv) < 0) - ++error_count; - - remove (temp_filename); - remove (temp_filename_f); - } - - exit (error_count > 0 ? (signal_count ? 2 : 1) : 0); - /* NOTREACHED */ return 0; } - #endif /* LANGUAGE_F77 == 1 */ diff --git a/gnu/usr.bin/gcc/f/g77.texi b/gnu/usr.bin/gcc/f/g77.texi index ebe7e559098..4b7970ec637 100644 --- a/gnu/usr.bin/gcc/f/g77.texi +++ b/gnu/usr.bin/gcc/f/g77.texi @@ -61,7 +61,7 @@ Published by the Free Software Foundation 59 Temple Place - Suite 330 Boston, MA 02111-1307 USA -Copyright (C) 1995-1997 Free Software Foundation, Inc. +Copyright (C) 1995, 1996 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -91,9 +91,9 @@ translations approved by the Free Software Foundation instead of in the original English. @end ifinfo -Contributed by James Craig Burley (@email{burley@@gnu.ai.mit.edu}). -Inspired by a first pass at translating @file{g77-0.5.16/f/DOC} that -was contributed to Craig by David Ronis (@email{ronis@@onsager.chem.mcgill.ca}). +Contributed by James Craig Burley (@code{burley@@gnu.ai.mit.edu}). +Inspired by a first pass at translating @code{g77-0.5.16/f/DOC} that +was contributed to Craig by David Ronis (@code{ronis@@onsager.chem.mcgill.ca}). @finalout @titlepage @@ -102,16 +102,16 @@ was contributed to Craig by David Ronis (@email{ronis@@onsager.chem.mcgill.ca}). @sp 2 @center James Craig Burley @sp 3 -@center Last updated 1997-02-28 +@center Last updated 1996-12-03 @sp 1 @c The version number appears some more times in this file. -@center for version 0.5.20 +@center for version 0.5.19 @page @vskip 0pt plus 1filll -Copyright @copyright{} 1995-1997 Free Software Foundation, Inc. +Copyright @copyright{} 1995, 1996 Free Software Foundation, Inc. @sp 2 -For GNU Fortran Version 0.5.20* +For GNU Fortran Version 0.5.19* @sp 1 Published by the Free Software Foundation @* 59 Temple Place - Suite 330@* @@ -144,10 +144,6 @@ original English. @ifinfo -@dircategory Fortran Programming -@direntry -* g77: (g77). The GNU Fortran compilation system. -@end direntry @node Top, Copying,, (DIR) @top Introduction @cindex Introduction @@ -156,19 +152,19 @@ original English. @ifset USING This manual documents how to run, install and port the GNU Fortran compiler, as well as its new features and incompatibilities, and how to -report bugs. It corresponds to GNU Fortran version 0.5.20. +report bugs. It corresponds to GNU Fortran version 0.5.19. @end ifset @end ifset @ifclear INTERNALS This manual documents how to run and install the GNU Fortran compiler, as well as its new features and incompatibilities, and how to report -bugs. It corresponds to GNU Fortran version 0.5.20. +bugs. It corresponds to GNU Fortran version 0.5.19. @end ifclear @ifclear USING This manual documents how to port the GNU Fortran compiler, as well as its new features and incompatibilities, and how to report -bugs. It corresponds to GNU Fortran version 0.5.20. +bugs. It corresponds to GNU Fortran version 0.5.19. @end ifclear @end ifinfo @@ -187,10 +183,6 @@ bugs. It corresponds to GNU Fortran version 0.5.20. * News:: News about recent releases of @code{g77}. * Changes:: User-visible changes to recent releases of @code{g77}. * Language:: The GNU Fortran language. -* Compiler:: The GNU Fortran compiler. -* Other Dialects:: Dialects of Fortran supported by @code{g77}. -* Other Compilers:: Fortran compilers other than @code{g77}. -* Other Languages:: Languages other than Fortran. * Installation:: How to configure, compile and install GNU Fortran. * Debugging and Interfacing:: How @code{g77} generates code. * Collected Fortran Wisdom:: How to avoid Trouble. @@ -204,11 +196,8 @@ bugs. It corresponds to GNU Fortran version 0.5.20. * Projects:: Projects for @code{g77} internals hackers. @end ifset -* M: Diagnostics. Diagnostics produced by @code{g77}. - -* Index:: Index of concepts and symbol names. +* Index:: Index of concepts and symbol names. @end menu -@c yes, the "M: " @emph{is} intentional -- bad.def references it (CMPAMBIG)! @node Copying @unnumbered GNU GENERAL PUBLIC LICENSE @@ -639,11 +628,11 @@ Jonathan Corbet @item Dr.@: Mark Fernyhough @item -Takafumi Hayashi (The University of AIzu)---@email{takafumi@@u-aizu.ac.jp} +Takafumi Hayashi (The University of AIzu)---@code{takafumi@@u-aizu.ac.jp} @item Kate Hedstrom @item -Michel Kern (INRIA and Rice University)---@email{Michel.Kern@@inria.fr} +Michel Kern (INRIA and Rice University)---@code{Michel.Kern@@inria.fr} @item Dr.@: A. O. V. Le Blanc @item @@ -667,23 +656,23 @@ Ian Watson @end itemize @item -Scott Snyder (@email{snyder@@d0sgif.fnal.gov}) +Scott Snyder (@code{snyder@@d0sgif.fnal.gov}) provided the patch to add rudimentary support -for @code{INTEGER*1}, @code{INTEGER*2}, and -@code{LOGICAL*1}. +for @samp{INTEGER*1}, @samp{INTEGER*2}, and +@samp{LOGICAL*1}. This inspired Craig to add further support, even though the resulting support would still be incomplete, because version 0.6 is still a ways off. @item -David Ronis (@email{ronis@@onsager.chem.mcgill.ca}) inspired +David Ronis (@code{ronis@@onsager.chem.mcgill.ca}) inspired and encouraged Craig to rewrite the documentation in texinfo format by contributing a first pass at a translation of the -old @file{g77-0.5.16/f/DOC} file. +old @code{g77-0.5.16/f/DOC} file. @item -Toon Moene (@email{toon@@moene.indiv.nluug.nl}) performed +Toon Moene (@code{toon@@moene.indiv.nluug.nl}) performed some analysis of generated code as part of an overall project to improve @code{g77} code generation to at least be as good as @code{f2c} used in conjunction with @code{gcc}. @@ -691,13 +680,6 @@ So far, this has resulted in the three, somewhat experimental, options added by @code{g77} to the @code{gcc} compiler and its back end. -@item -John Carr (@email{jfc@@mit.edu}) wrote the alias analysis improvements. - -@item -Thanks to Mary Cortani and the staff at Craftwork Solutions -(@email{support@@craftwork.com}) for all of their support. - @item Many other individuals have helped debug, test, and improve @code{g77} over the past several years, and undoubtedly more people @@ -762,7 +744,7 @@ without royalty; alteration is not permitted. @cindex improvements, funding Work on GNU Fortran is still being done mostly by its author, -James Craig Burley (@email{burley@@gnu.ai.mit.edu}), who is a volunteer +James Craig Burley (@code{burley@@gnu.ai.mit.edu}), who is a volunteer for, not an employee of, the Free Software Foundation (FSF). As with other GNU software, funding is important because it can pay for needed equipment, personnel, and so on. @@ -772,7 +754,7 @@ needed equipment, personnel, and so on. The FSF provides information on the best way to fund ongoing development of GNU software (such as GNU Fortran) in documents such as the ``GNUS Bulletin''. -Email @email{gnu@@prep.ai.mit.edu} for information on funding the FSF. +Email @code{gnu@@prep.ai.mit.edu} for information on funding the FSF. To fund specific GNU Fortran work in particular, the FSF might provide a means for that, but the FSF does not provide direct funding @@ -799,10 +781,12 @@ contract work on a few occasions. If more people did this, he would be able to plan on not doing contract work for many months and could thus devote that time to work on projects (such as the planned -changes for 0.6) that require longer timeframes to complete. +changes for @code{g77-0.6}) that require longer timeframes to complete. For the latest information on the status of the author, do -@kbd{finger -l burley@@gate.gnu.ai.mit.edu} on a UNIX system -(or any system with a command like UNIX @code{finger}). +@samp{finger -l burley@@gnu.ai.mit.edu}, i.e. access @code{burley}'s +@code{.plan} file just as you would @code{fortran}'s to get @code{g77} +status (except there's no public @code{ftp} access to @code{burley}'s +@code{.plan} file---you can email him asking for it). Another important way to support work on GNU Fortran is to volunteer to help out. @@ -810,7 +794,7 @@ Work is needed on documentation, testing, porting to various machines, and in some cases, coding (although major changes planned for version 0.6 make it difficult to add manpower to this area). -Email @email{fortran@@gnu.ai.mit.edu} to volunteer for this work. +Email @code{fortran@@gnu.ai.mit.edu} to volunteer for this work. @xref{Funding,,Funding Free Software}, for more information. @@ -943,7 +927,7 @@ When writing Fortran or C, it is easy to make big mistakes. @cindex debugger -@cindex bugs, finding +@cindex bugs @cindex gdb command @cindex commands, gdb @item @@ -1078,7 +1062,7 @@ and linking. @cindex cpp program @cindex programs, cpp For example, the command @samp{gcc foo.c} @dfn{drives} the file -@file{foo.c} through the preprocessor @code{cpp}, then +@samp{foo.c} through the preprocessor @samp{cpp}, then the C compiler (internally named @code{cc1}), then the assembler (usually @code{as}), then the linker (@code{ld}), producing an executable program named @file{a.out} (on @@ -1124,10 +1108,10 @@ The command @samp{g77 -v} is a quick way to display lots of version information for the various programs used to compile a typical preprocessed Fortran source file---this produces much more output than @samp{gcc -v} currently does. -(If it produces an error message near the end of the output---diagnostics -from the linker, usually @code{ld}---you might -have an out-of-date @code{libf2c} that improperly handles -complex arithmetic.)@ +(It also produces an error message near the end of the output, +a diagnostic from the linker, usually @code{ld}---you can safely +ignore this error, but do include the entire output with any +bug report you submit.) In the output of this command, the line beginning @samp{GNU Fortran Front End} identifies the version number of GNU Fortran; immediately preceding that line is a line identifying the version of @code{gcc} @@ -1266,14 +1250,14 @@ the @code{gcc} command: @table @code @cindex -@w{}-driver option -@cindex g77 options, -@w{}-driver +@cindex g77 options, driver @cindex options, -@w{}-driver @item --driver=@var{command} Specifies that @var{command}, rather than @code{gcc}, is to be invoked by @code{g77} to do its job. -For example, within the @code{gcc} build directory after +For example, within the @samp{gcc} build directory after building GNU Fortran (but without having to install it), -@kbd{./g77 --driver=./xgcc foo.f -B./}. +@samp{./g77 --driver=./xgcc foo.f -B./}. @end table @cindex options, negative forms @@ -1286,7 +1270,7 @@ This manual documents only one of these two forms, whichever one is not the default. @menu -* Option Summary:: Brief list of all @code{g77} options, +* Option Summary:: Brief list of all @code{g77} options, without explanations. * Overall Options:: Controlling the kind of output: an executable, object files, assembler files, @@ -1316,23 +1300,26 @@ by type. Explanations are in the following sections. @item Overall Options @xref{Overall Options,,Options Controlling the Kind of Output}. @smallexample ---driver -fversion -fset-g77-defaults -fno-silent +--driver -fversion -fset-g77-defaults +-fno-silent @end smallexample @item Shorthand Options @xref{Shorthand Options}. @smallexample --ff66 -fno-f66 -ff77 -fno-f77 -fugly -fno-ugly +-ff66 -fno-f66 +-ff77 -fno-f77 +-fugly -fno-ugly @end smallexample @item Fortran Language Options @xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}. @smallexample --ffree-form -fno-fixed-form -ff90 --fvxt -fdollar-ok -fno-backslash --fno-ugly-args -fno-ugly-assign -fno-ugly-assumed --fugly-comma -fugly-complex -fugly-init -fugly-logint --fonetrip -ftypeless-boz +-ffree-form -fno-fixed-form -ff90 -fvxt-not-f90 +-ff90-not-vxt -fdollar-ok -fno-backslash +-fno-ugly-args -fno-ugly-assumed -fugly-comma +-fugly-init -fugly-logint +-fonetrip -fno-typeless-boz -fintrin-case-initcap -fintrin-case-upper -fintrin-case-lower -fintrin-case-any -fmatch-case-initcap -fmatch-case-upper @@ -1342,12 +1329,12 @@ by type. Explanations are in the following sections. -fsymbol-case-lower -fsymbol-case-any -fcase-strict-upper -fcase-strict-lower -fcase-initcap -fcase-upper -fcase-lower -fcase-preserve +-fdcp-intrinsics-delete -fdcp-intrinsics-hide +-fdcp-intrinsics-disable -fdcp-intrinsics-enable -ff2c-intrinsics-delete -ff2c-intrinsics-hide -ff2c-intrinsics-disable -ff2c-intrinsics-enable -ff90-intrinsics-delete -ff90-intrinsics-hide -ff90-intrinsics-disable -ff90-intrinsics-enable --fgnu-intrinsics-delete -fgnu-intrinsics-hide --fgnu-intrinsics-disable -fgnu-intrinsics-enable -fmil-intrinsics-delete -fmil-intrinsics-hide -fmil-intrinsics-disable -fmil-intrinsics-enable -funix-intrinsics-delete -funix-intrinsics-hide @@ -1374,7 +1361,6 @@ by type. Explanations are in the following sections. @item Optimization Options @xref{Optimize Options,,Options that Control Optimization}. @smallexample --malign-double -ffloat-store -fforce-mem -fforce-addr -fno-inline -ffast-math -fstrength-reduce -frerun-cse-after-loop -fexpensive-optimizations -fdelayed-branch @@ -1398,9 +1384,7 @@ by type. Explanations are in the following sections. -fpcc-struct-return -freg-struct-return -fshort-double -fno-common -fpack-struct -fzeros -fno-second-underscore --fdebug-kludge -fno-emulate-complex --falias-check -fargument-alias --fargument-noalias -fno-argument-noalias-global +-fdebug-kludge @end smallexample @end table @@ -1427,9 +1411,8 @@ by type. Explanations are in the following sections. @cindex overall options @cindex options, overall -Compilation can involve as many as four stages: preprocessing, code -generation (often what is really meant by the term ``compilation''), -assembly, and linking, always in that order. The first three +Compilation can involve as many as four stages: preprocessing, compilation +proper, assembly, and linking, always in that order. The first three stages apply to an individual source file, and end by producing an object file; linking combines all the object files (those newly compiled, and those specified as input) into an executable file. @@ -1441,9 +1424,9 @@ compiled, and those specified as input) into an executable file. @cindex file type @cindex types, file For any given input file, the file name suffix determines what kind of -program is contained in the file---that is, the language in which the -program is written is generally indicated by the suffix. -Suffixes specific to GNU Fortran are listed below. +compilation is done. +Suffixes specific to GNU Fortran are listed +below. @xref{Overall Options,,gcc,Using and Porting GNU CC}, for information on suffixes recognized by GNU CC. @@ -1458,8 +1441,8 @@ Fortran source code that should not be preprocessed. @cindex Fortran preprocessor @cindex cpp program @cindex programs, cpp -@cindex .F filename suffix -@cindex .fpp filename suffix +@cindex .F +@cindex .fpp @item @var{file}.F @item @var{file}.fpp Fortran source code that must be preprocessed (by the C preprocessor @@ -1477,42 +1460,26 @@ the @file{@var{file}.for} and @file{@var{file}.fpp} nomenclature. @cindex #include @cindex #if Use of the preprocessor @code{cpp} allows use of C-like -constructs such as @code{#define} and @code{#include}, but can +constructs such as @samp{#define} and @samp{#include}, but can lead to unexpected, even mistaken, results due to Fortran's source file format. It is recommended that use of the C preprocessor -be limited to @code{#include} and, in -conjunction with @code{#define}, only @code{#if} and related directives, +be limited to @samp{#include} and, in +conjunction with @samp{#define}, only @samp{#if} and related directives, thus avoiding in-line macro expansion entirely. This recommendation applies especially when using the traditional fixed source form. With free source form, fewer unexpected transformations are likely to happen, but use of -constructs such as Hollerith and character constants can nevertheless -present problems, especially when these are continued across multiple -source lines. -These problems result, primarily, from differences between the way -such constants are interpreted by the C preprocessor and by a Fortran -compiler. - -@emph{Note:} The @samp{-traditional} and @samp{-undef} flags are supplied -to @code{cpp} by default, to avoid unpleasant surprises. -@xref{Preprocessor Options,,Options Controlling the Preprocessor, -gcc,Using and Porting GNU CC}. -This means that ANSI C preprocessor features (such as the @samp{#} -operator) aren't available, and only variables in the C reserved -namespace (generally, names with a leading underscore) are liable to -substitution by C predefines. -Thus, if you want to do system-specific -tests, use, for example, @samp{#ifdef __linux__} rather than @samp{#ifdef linux}. -Use the @samp{-v} option to see exactly how the preprocessor is invoked. +Hollerith and things like continued character constants can nevertheless +present problems. The following options that affect overall processing are recognized by the @code{g77} and @code{gcc} commands in a GNU Fortran installation: @table @code @item --driver=@var{command} -This works when invoking only the @code{g77} command, not +This works only when invoking the @code{g77} command, not when invoking the @code{gcc} command. @xref{Invoking G77,,GNU Fortran Command Options}, for information on this option. @@ -1532,30 +1499,16 @@ and when the resulting commands compile Fortran source files.) @cindex options, -fset-g77-defaults @item -fset-g77-defaults Set up whatever @code{gcc} options are to apply to Fortran -compilations, and avoid running internal consistency checks -that might take some time. - -As of version 0.5.20, this is equivalent to @samp{-fmove-all-movables --freduce-all-givs -frerun-loop-opt -fargument-noalias-global}. - -This option is supplied automatically when compiling Fortran code -via the @code{g77} or @code{gcc} command. -The description of this option is provided so that users seeing +compilations. +As of version 0.5.18, this is equivalent to @samp{-fmove-all-movables +-freduce-all-givs -frerun-loop-opt}. +(This is supplied automatically when compiling Fortran code. +The description of this option is here so that users seeing it in the output of, say, @samp{g77 -v} understand why it is there. - -@cindex modifying g77 -@cindex code, modifying Also, developers who run @code{f771} directly might want to specify it by hand to get the same defaults as they would running @code{f771} -via @code{g77} or @code{gcc}. -However, such developers should, after linking a new @code{f771} -executable, invoke it without this option once, -e.g. via @kbd{./f771 -quiet < /dev/null}, -to ensure that they have not introduced any -internal inconsistencies (such as in the table of -intrinsics) before proceeding---@code{g77} will crash -with a diagnostic if it detects an inconsistency. +via @code{g77} or @code{gcc}.) @cindex -fno-silent option @cindex options, -fno-silent @@ -1596,9 +1549,7 @@ Specify that certain ``ugly'' constructs are to be quietly accepted. Same as: @smallexample --fugly-args -fugly-assign -fugly-assumed --fugly-comma -fugly-complex -fugly-init --fugly-logint +-fugly-args -fugly-assumed -fugly-comma -fugly-init -fugly-logint @end smallexample These constructs are considered inappropriate to use in new @@ -1606,14 +1557,6 @@ or well-maintained portable Fortran code, but widely used in old code. @xref{Distensions}, for more information. -@emph{Note:} The @samp{-fugly} option is likely to -be removed in a future version. -Implicitly enabling all the @samp{-fugly-*} options -is unlikely to be feasible, or sensible, in the future, -so users should learn to specify only those -@samp{-fugly-*} options they really need for a -particular source file. - @cindex -fno-ugly option @cindex options, -fno-ugly @item -fno-ugly @@ -1623,13 +1566,10 @@ Specify that all ``ugly'' constructs are to be noisily rejected. Same as: @smallexample --fno-ugly-args -fno-ugly-assign -fno-ugly-assumed --fno-ugly-comma -fno-ugly-complex -fno-ugly-init +-fno-ugly-args -fno-ugly-assumed -fno-ugly-comma -fno-ugly-init -fno-ugly-logint @end smallexample -@xref{Distensions}, for more information. - @cindex -ff66 option @cindex options, -ff66 @item -ff66 @@ -1709,26 +1649,32 @@ This option controls whether certain Fortran 90 constructs are recognized. (Other Fortran 90 constructs might or might not be recognized depending on other options such as -@samp{-fvxt}, @samp{-ff90-intrinsics-enable}, and the +@samp{-fvxt-not-f90}, @samp{-ff90-intrinsics-enable}, and the current level of support for Fortran 90.) -@xref{Fortran 90}, for more information. +@xref{Extensions,,GNU Fortran Extensions}, for more information. -@cindex -fvxt option -@cindex options, -fvxt -@item -fvxt +@cindex -fvxt-not-f90 option +@cindex options, -fvxt-not-f90 +@item -fvxt-not-f90 +@cindex -ff90-not-vxt option +@cindex options, -ff90-not-vxt +@item -ff90-not-vxt @cindex Fortran 90 features @cindex VXT features -Specify the treatment of certain constructs that have different -meanings depending on whether the code is written in -GNU Fortran (based on FORTRAN 77 and akin to Fortran 90) -or VXT Fortran (more like VAX FORTRAN). +Specify whether Fortran 90 or other popular extensions +are to be assumed for ambiguous constructs. +The default is -fvxt-not-f90. -The default is @samp{-fno-vxt}. -@samp{-fvxt} specifies that the VXT Fortran interpretations -for those constructs are to be chosen. +For example, with @samp{-ff90-not-vxt}, +@samp{PRINT *,"double-quoted string"} is valid, +while with @samp{-fvxt-not-f90}, @samp{PRINT *,"2000} is valid. + +(There is no way to allow +both constructs in the general case, since statements like +@samp{PRINT *,"2000 !comment?"} would be ambiguous.) -@xref{VXT Fortran}, for more information. +@xref{Dialects,,GNU Fortran Dialects}, for more information. @cindex -fdollar-ok option @cindex options, -fdollar-ok @@ -1772,22 +1718,12 @@ arguments (for example, @samp{CALL FOO(4HABCD)}). @xref{Ugly Implicit Argument Conversion}, for more information. -@cindex -fugly-assign option -@cindex options, -fugly-assign -@item -fugly-assign -Use the same storage for a given variable regardless of -whether it is used to hold an assigned-statement label -(as in @samp{ASSIGN 10 TO I}) or used to hold numeric data -(as in @samp{I = 3}). - -@xref{Ugly Assigned Labels}, for more information. - @cindex -fugly-assumed option @cindex options, -fugly-assumed @item -fugly-assumed -Assume any dummy array with a final dimension specified as @samp{1} +Assume any array with a final dimension specified as @samp{1} is really an assumed-size array, as if @samp{*} had been specified -for the final dimension instead of @samp{1}. +instead. For example, @samp{DIMENSION X(1)} is treated as if it had read @samp{DIMENSION X(*)}. @@ -1812,20 +1748,6 @@ a single trailing comma in an argument list. @xref{Ugly Null Arguments}, for more information. -@cindex -fugly-complex option -@cindex options, -fugly-complex -@item -fugly-complex -Do not complain about @samp{REAL(@var{expr})} or -@samp{AIMAG(@var{expr})} when @var{expr} is a @code{COMPLEX} -type other than @code{COMPLEX(KIND=1)}---usually -this is used to permit @code{COMPLEX(KIND=2)} -(@code{DOUBLE COMPLEX}) operands. - -The @samp{-ff90} option controls the interpretation -of this construct. - -@xref{Ugly Complex Part Extraction}, for more information. - @cindex -fno-ugly-init option @cindex options, -fno-ugly-init @item -fno-ugly-init @@ -1842,11 +1764,11 @@ For example, @samp{DATA I/'F'/, CHRVAR/65/, J/4HABCD/} is disallowed by @cindex -fugly-logint option @cindex options, -fugly-logint @item -fugly-logint -Treat @code{INTEGER} and @code{LOGICAL} variables and +Treat @samp{INTEGER} and @samp{LOGICAL} variables and expressions as potential stand-ins for each other. -For example, automatic conversion between @code{INTEGER} and -@code{LOGICAL} is enabled, for many contexts, via this option. +For example, automatic conversion between @samp{INTEGER} and +@samp{LOGICAL} is enabled, for many contexts, via this option. @xref{Ugly Integer Conversions}, for more information. @@ -1857,45 +1779,48 @@ For example, automatic conversion between @code{INTEGER} and @cindex DO loops, one-trip @cindex one-trip DO loops @cindex compatibility, FORTRAN 66 -Imperative executable @code{DO} loops are to be executed at +Imperative executable @samp{DO} loops are to be executed at least once each time they are reached. ANSI FORTRAN 77 and more recent versions of the Fortran standard -specify that the body of an imperative @code{DO} loop is not executed +specify that the body of an imperative @samp{DO} loop is not executed if the number of iterations calculated from the parameters of the loop is less than 1. -(For example, @samp{DO 10 I = 1, 0}.)@ +(For example, @samp{DO 10 I = 1, 0}.) Such a loop is called a @dfn{zero-trip loop}. -Prior to ANSI FORTRAN 77, many compilers implemented @code{DO} loops +Prior to ANSI FORTRAN 77, many compilers implemented @samp{DO} loops such that the body of a loop would be executed at least once, even if the iteration count was zero. Fortran code written assuming this behavior is said to require @dfn{one-trip loops}. For example, some code written to the FORTRAN 66 standard -expects this behavior from its @code{DO} loops, although that +expects this behavior from its @samp{DO} loops, although that standard did not specify this behavior. The @samp{-fonetrip} option specifies that the source file(s) being compiled require one-trip loops. -This option affects only those loops specified by the (imperative) @code{DO} -statement and by implied-@code{DO} lists in I/O statements. -Loops specified by implied-@code{DO} lists in @code{DATA} and +This option affects only those loops specified by the (imperative) @samp{DO} +statement and by implied-@samp{DO} lists in I/O statements. +Loops specified by implied-@samp{DO} lists in @samp{DATA} and specification (non-executable) statements are not affected. -@cindex -ftypeless-boz option -@cindex options, -ftypeless-boz +@cindex -fno-typeless-boz option +@cindex options, -fno-typeless-boz @cindex prefix-radix constants @cindex constants, prefix-radix @cindex constants, types @cindex types, constants -@item -ftypeless-boz +@item -fno-typeless-boz Specifies that prefix-radix non-decimal constants, such as -@samp{Z'ABCD'}, are typeless instead of @code{INTEGER(KIND=1)}. +@samp{Z'ABCD'}, as @samp{INTEGER} instead of typeless. + +Currently plans call for this option being the default as of +version 0.5.20. You can test for yourself whether a particular compiler treats -the prefix form as @code{INTEGER(KIND=1)} or typeless by running the +the prefix form as @samp{INTEGER} or typeless by running the following program: @smallexample @@ -1908,7 +1833,7 @@ END @end smallexample Reports indicate that many compilers process this form as -@code{INTEGER(KIND=1)}, though a few as typeless, and at least one +@samp{INTEGER}, though a few as typeless, and at least one based on a command-line option specifying some kind of compatibility. @@ -2016,6 +1941,24 @@ while allowing any-case matching of intrinsics and keywords. For example, @samp{call Foo(i,I)} would pass two @emph{different} variables named @samp{i} and @samp{I} to a procedure named @samp{Foo}.) +@cindex -fdcp-intrinsics-delete option +@cindex options, -fdcp-intrinsics-delete +@item -fdcp-intrinsics-delete +@cindex -fdcp-intrinsics-hide option +@cindex options, -fdcp-intrinsics-hide +@item -fdcp-intrinsics-hide +@cindex -fdcp-intrinsics-disable option +@cindex options, -fdcp-intrinsics-disable +@item -fdcp-intrinsics-disable +@cindex -fdcp-intrinsics-enable option +@cindex options, -fdcp-intrinsics-enable +@item -fdcp-intrinsics-enable +@cindex Digital Fortran features +@cindex COMPLEX intrinsics +@cindex intrinsics, COMPLEX +Specify status of Digital's COMPLEX-related intrinsics. +@samp{-fdcp-intrinsics-enable} is the default. + @cindex -ff2c-intrinsics-delete option @cindex options, -ff2c-intrinsics-delete @item -ff2c-intrinsics-delete @@ -2048,25 +1991,7 @@ Specify status of f2c-specific intrinsics. @cindex Fortran 90 intrinsics @cindex intrinsics, Fortran 90 Specify status of F90-specific intrinsics. -@samp{-ff90-intrinsics-enable} is the default. - -@cindex -fgnu-intrinsics-delete option -@cindex options, -fgnu-intrinsics-delete -@item -fgnu-intrinsics-delete -@cindex -fgnu-intrinsics-hide option -@cindex options, -fgnu-intrinsics-hide -@item -fgnu-intrinsics-hide -@cindex -fgnu-intrinsics-disable option -@cindex options, -fgnu-intrinsics-disable -@item -fgnu-intrinsics-disable -@cindex -fgnu-intrinsics-enable option -@cindex options, -fgnu-intrinsics-enable -@item -fgnu-intrinsics-enable -@cindex Digital Fortran features -@cindex COMPLEX intrinsics -@cindex intrinsics, COMPLEX -Specify status of Digital's COMPLEX-related intrinsics. -@samp{-fgnu-intrinsics-enable} is the default. +@samp{-ff90-intrinsics-delete} is the default. @cindex -fmil-intrinsics-delete option @cindex options, -fmil-intrinsics-delete @@ -2102,6 +2027,57 @@ Specify status of MIL-STD-1753-specific intrinsics. Specify status of UNIX intrinsics. @samp{-funix-intrinsics-enable} is the default. +@cindex FLUSH() intrinsic +@cindex intrinsics, FLUSH() +For example, if your code invokes @code{FLUSH} as +a library function and thus works with other UNIX Fortran +compilers or earlier version of @code{g77}, either add the +@samp{EXTERNAL FLUSH} statement or, perhaps +more convenient for you, compile with the +@samp{-funix-intrinsics-hide} or +@samp{-funix-intrinsics-delete} option. + +@cindex ABORT() intrinsic +@cindex intrinsics, ABORT() +@cindex EXIT() intrinsic +@cindex intrinsics, EXIT() +@cindex FSEEK() intrinsic +@cindex intrinsics, FSEEK() +@cindex SIGNAL() intrinsic +@cindex intrinsics, SIGNAL() +@cindex SYSTEM() intrinsic +@cindex intrinsics, SYSTEM() +@cindex intrinsic subroutines +@cindex subroutines, intrinsic +@cindex intrinsic functions +@cindex functions, intrinsic +@cindex side effects +@cindex intrinsics, side effects of +Note that @code{ABORT}, @code{EXIT}, @code{FLUSH}, @code{FSEEK}, +@code{SIGNAL}, and +@code{SYSTEM} are intrinsic subroutines, not functions (since they have +side effects), so to get the return values from @code{FSEEK}, +@code{SIGNAL}, and @code{SYSTEM}, append a final argument specifying +an @samp{INTEGER} +variable or array element to receive the returned status. +(For example, @samp{CALL SYSTEM('rm foo',ISTAT)}.) + +@code{FLUSH()} accepts an optional single @samp{INTEGER} argument, +since many Fortran implementations allow or require a unit number. +Currently, since @code{libf2c} +does not flush a given unit number, this argument is not used---all +units are flushed by @code{libf2c}'s implementation of @code{FLUSH()}. +Do not depend on this behavior---if you want to flush all units, +use @samp{CALL FLUSH} (that is, specify no arguments to @code{FLUSH}). + +@code{EXIT()} accepts an optional single @samp{INTEGER} argument. +If omitted, zero is the default (as in @samp{CALL EXIT(0)}). +The default might change on +configurations where the ``normal return status'' is not zero, however. +If you want to return a ``success'' status, it is best to call @code{EXIT} +with no arguments in your code, and let @code{g77} choose the appropriate +default. + @cindex -fvxt-intrinsics-delete option @cindex options, -fvxt-intrinsics-delete @item -fvxt-intrinsics-delete @@ -2117,7 +2093,7 @@ Specify status of UNIX intrinsics. @cindex VXT intrinsics @cindex intrinsics, VXT Specify status of VXT intrinsics. -@samp{-fvxt-intrinsics-enable} is the default. +@samp{-fvxt-intrinsics-delete} is the default. @cindex -ffixed-line-length-@var{n} option @cindex options, -ffixed-line-length-@var{n} @@ -2184,10 +2160,9 @@ Fortran features are supported as well. With this option, many of them are rejected. Some users try to use @samp{-pedantic} to check programs for strict ANSI -conformance. -They soon find that it does not do quite what they want---it finds some -non-ANSI practices, but not all. -However, improvements to @code{g77} in this area are welcome. +conformance. They soon find that it does not do quite what they want: +it finds some non-ANSI practices, but not all---however, improvements +to @code{g77} in this area are welcome. @cindex -pedantic-errors option @cindex options, -pedantic-errors @@ -2216,7 +2191,7 @@ Inhibit all warning messages. @cindex effecting IMPLICIT NONE Warn whenever a variable, array, or function is implicitly declared. -Has an effect similar to using the @code{IMPLICIT NONE} statement +Has an effect similar to using the @samp{IMPLICIT NONE} statement in every program unit. (Some Fortran compilers provide this feature by an option named @samp{-u} or @samp{/WARNINGS=DECLARATIONS}.) @@ -2236,7 +2211,7 @@ Warn whenever a variable is unused aside from its declaration. Warn whenever an automatic variable is used without first being initialized. These warnings are possible only in optimizing compilation, -because they require data-flow information that is computed only +because they require data flow information that is computed only when optimizing. If you don't specify @samp{-O}, you simply won't get these warnings. @@ -2249,7 +2224,7 @@ arrays, even when they are in registers. Note that there might be no warning about a variable that is used only to compute a value that itself is never used, because such -computations may be deleted by data-flow analysis before the warnings +computations may be deleted by data flow analysis before the warnings are printed. These warnings are made optional because GNU Fortran is not smart @@ -2337,8 +2312,8 @@ be interpreted as @samp{X**(-(Y*Z))}. A revealing example is the constant expression @samp{2**-2*1.}, which @code{g77} evaluates to .25, while others might evaluate -it to 0., the difference resulting from the way precedence affects -type promotion. +it to 0., the difference being the way precedence affects type +promotion. (The @samp{-fpedantic} option also warns about expressions having two arithmetic operators in a row.) @@ -2356,7 +2331,7 @@ in a surprising way is @samp{-I*S}, where @var{I} holds the value @samp{-2147483648} and @var{S} holds @samp{0.5}. On many systems, negating @var{I} results in the same value, not a positive number, because it is already the -lower bound of what an @code{INTEGER(KIND=1)} variable can hold. +lower bound of what an @samp{INTEGER} variable can hold. So, the expression evaluates to a positive number, while the ``expected'' interpretation, @samp{(-I)*S}, would evaluate to a negative number. @@ -2373,14 +2348,15 @@ code. @cindex DO statement @cindex statements, DO @item -@code{DO} loops with @code{DO} variables that are not -of integral type---that is, using @code{REAL} -variables as loop control variables. +@samp{DO} loops with @samp{DO} variables that are not +of integral type---that is, using @samp{REAL} or +@samp{DOUBLE PRECISION} variables as loop control +variables. Although such loops can be written to work in the ``obvious'' way, the way @code{g77} is required by the Fortran standard to interpret such code is likely to be quite different from the way many programmers expect. -(This is true of all @code{DO} loops, but the differences +(This is true of all @samp{DO} loops, but the differences are pronounced for non-integral loop control variables.) @xref{Loops}, for more information. @@ -2396,8 +2372,7 @@ Make all warnings into errors. @item -W @cindex extra warnings @cindex warnings, extra -Turns on ``extra warnings'' and, if optimization is specified -via @samp{-O}, the @samp{-Wuninitialized} option. +Turns on ``extra warnings'' and the @samp{uninitialized} option. (This might change in future versions of @code{g77}.) ``Extra warnings'' are issued for: @@ -2416,7 +2391,7 @@ specified). @item @cindex overflow Overflows involving floating-point constants (not available -for certain configurations). +for certain configurations?). @end itemize @end table @@ -2482,12 +2457,12 @@ Produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging information. -@cindex common blocks -@cindex equivalence areas +@cindex COMMON blocks +@cindex EQUIVALENCE areas @cindex missing debug features Support for this option in Fortran programs is incomplete. In particular, names of variables and arrays in common blocks -or that are storage-associated via @code{EQUIVALENCE} are +or that are storage-associated via @samp{EQUIVALENCE} are unavailable to the debugger. However, version 0.5.19 of @code{g77} does provide this information @@ -2514,37 +2489,6 @@ The following flags have particular applicability when compiling Fortran programs: @table @code -@cindex -malign-double option -@cindex options, -malign-double -@item -malign-double -(Intel 386 architecture only.) - -Noticeably improves performance of @code{g77} programs making -heavy use of @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data -on some systems. -In particular, systems using Pentium, Pentium Pro, 585, and -686 implementations -of the i386 architecture execute programs faster when -@code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data are -aligned on 64-bit boundaries -in memory. - -This option can, at least, make benchmark results more consistent -across various system configurations, versions of the program, -and data sets. - -@emph{Note:} The warning in the @code{gcc} documentation about -this option does not apply, generally speaking, to Fortran -code compiled by @code{g77}. - -@emph{Also note:} Apparently due to a @code{gcc} backend bug, -@samp{-malign-double} does not align stack-allocated data (such as -local variables neither @code{SAVE}d nor reckoned to take up too -much space to put on the stack). - -@emph{Also also note:} The negative form of @samp{-malign-double} -is @samp{-mno-align-double}, not @samp{-benign-double}. - @cindex -ffloat-store option @cindex options, -ffloat-store @item -ffloat-store @@ -2621,24 +2565,14 @@ Definitely improves performance on some code. Definitely improves performance on some code. @item -fno-move-all-movables -@cindex -fno-move-all-movables option -@cindex options, -fno-move-all-movables @item -fno-reduce-all-givs -@cindex -fno-reduce-all-givs option -@cindex options, -fno-reduce-all-givs @item -fno-rerun-loop-opt -@cindex -fno-rerun-loop-opt option -@cindex options, -fno-rerun-loop-opt Each of these might improve performance on some code. Analysis of Fortran code optimization and the resulting optimizations triggered by the above options were contributed by Toon Moene (@code{toon@@moene.indiv.nluug.nl}). -These three options are intended to be removed someday, once -they have helped determine the efficacy of various -approaches to improving the performance of Fortran code. - Please let us know how use of these options affects the performance of your production code. We're particularly interested in code that runs faster @@ -2664,14 +2598,14 @@ file before actual compilation. @xref{Preprocessor Options,,Options Controlling the Preprocessor, gcc,Using and Porting GNU CC}, for information on C preprocessor options. -@cindex INCLUDE directive -@cindex directive, INCLUDE +@cindex INCLUDE statement +@cindex statements, INCLUDE Some of these options also affect how @code{g77} processes the -@code{INCLUDE} directive. -Since this directive is processed even when preprocessing +@samp{INCLUDE} statement. +Since this statement is processed even when preprocessing is not requested, it is not described in this section. @xref{Directory Options,,Options for Directory Search}, for -information on how @code{g77} processes the @code{INCLUDE} directive. +information on how @code{g77} processes the @samp{INCLUDE} statement. @node Directory Options @section Options for Directory Search @@ -2680,14 +2614,14 @@ information on how @code{g77} processes the @code{INCLUDE} directive. @cindex search path These options affect how the @code{cpp} preprocessor searches -for files specified via the @code{#include} directive. +for files specified via the @samp{#include} directive. Therefore, when compiling Fortran programs, they are meaningful when the preproecssor is used. -@cindex INCLUDE directive -@cindex directive, INCLUDE +@cindex INCLUDE statement +@cindex statements, INCLUDE Some of these options also affect how @code{g77} searches -for files specified via the @code{INCLUDE} directive. +for files specified via the @samp{INCLUDE} statement. These options are: @table @code @@ -2700,8 +2634,8 @@ These options are: @cindex directory search paths for inclusion @cindex inclusion, directory search paths for @cindex searching for included files -These affect interpretation of the @code{INCLUDE} directive -(as well as of the @code{#include} directive of the @code{cpp} +These affect interpretation of the @samp{INCLUDE} statement +(as well as of the @samp{#include} directive of the @code{cpp} preprocessor). Note that @samp{-I@var{dir}} must be specified @emph{without} any @@ -2711,8 +2645,8 @@ is rejected by the @code{g77} compiler (though the preprocessor supports the latter form). @c this is due to toplev.c's inflexible option processing Also note that the general behavior of @samp{-I} and -@code{INCLUDE} is pretty much the same as of @samp{-I} with -@code{#include} in the @code{cpp} preprocessor, with regard to +@samp{INCLUDE} is pretty much the same as of @samp{-I} with +@samp{#include} in the @code{cpp} preprocessor, with regard to looking for @file{header.gcc} files and other such things. @xref{Directory Options,,Options for Directory Search, @@ -2766,8 +2700,8 @@ good idea to also use @samp{-fno-automatic} with @samp{-finit-local-zero}. @cindex -fno-f2c option @cindex options, -fno-f2c @item -fno-f2c -@cindex @code{f2c} compatibility -@cindex compatibility, @code{f2c} +@cindex f2c compatibility +@cindex compatibility, f2c Do not generate code designed to be compatible with code generated by @code{f2c}. @@ -2896,7 +2830,7 @@ Ignore the @samp{#ident} directive. @item -fzeros Treat initial values of zero as if they were any other value. -As of version 0.5.18, @code{g77} normally treats @code{DATA} and +As of version 0.5.18, @code{g77} normally treats @samp{DATA} and other statements that are used specify initial values of zero for variables and arrays as if no values were actually specified, in the sense that no diagnostics regarding multiple initializations @@ -2918,7 +2852,7 @@ programs; standard-conforming programs should not be affected. @cindex -fdebug-kludge option @cindex options, -fdebug-kludge @item -fdebug-kludge -Emit information on @code{COMMON} and @code{EQUIVALENCE} members +Emit information on @samp{COMMON} and @samp{EQUIVALENCE} members that might help users of debuggers work around lack of proper debugging information on such members. @@ -2928,8 +2862,8 @@ This information consists of establishing the type and contents of each such member so that, when a debugger is asked to print the contents, the printed information provides rudimentary debugging information. This information identifies the name of the aggregate area (either the -@code{COMMON} block name, or the @code{g77}-assigned name for the -@code{EQUIVALENCE} name) and the offset, in bytes, of the member from +@samp{COMMON} block name, or the @code{g77}-assigned name for the +@samp{EQUIVALENCE} name) and the offset, in bytes, of the member from the beginning of the area. Using @code{gdb}, this information is not coherently displayed in the Fortran @@ -2939,7 +2873,7 @@ Use @samp{set language c} and @samp{set language fortran} to accomplish this. For example: -@smallexample +@example COMMON /X/A,B EQUIVALENCE (C,D) CHARACTER XX*50 @@ -2973,86 +2907,16 @@ $6 = "At (EQUIVALENCE) `__g77_equiv_xx' plus 20 bytes" $7 = "At (EQUIVALENCE) `__g77_equiv_xx' plus 1 bytes" (gdb) set language fortran (gdb) -@end smallexample +@end example -@noindent Use @samp{-fdebug-kludge} to generate this information, -which might make some programs noticeably larger. +which might make some programs noticably larger. @emph{Caution:} Future versions of @code{g77} might disregard this option (and its negative form). Current plans call for this to happen when published versions of @code{g77} and @code{gdb} exist that provide proper access to debugging information on -@code{COMMON} and @code{EQUIVALENCE} members. - -@cindex -fno-emulate-complex option -@cindex options, -fno-emulate-complex -@item -fno-emulate-complex -Implement @code{COMPLEX} arithmetic using the facilities in -the @code{gcc} back end that provide direct support of -@code{complex} arithmetic, instead of emulating the arithmetic. - -@code{gcc} has some known problems in its back-end support -for @code{complex} arithmetic, due primarily to the support not being -completed as of version 2.7.2.2. -Other front ends for the @code{gcc} back end avoid this problem -by emulating @code{complex} arithmetic at a higher level, so the -back end sees arithmetic on the real and imaginary components. -To make @code{g77} more portable to systems where @code{complex} -support in the @code{gcc} back end is particularly troublesome, -@code{g77} now defaults to performing the same kinds of emulations -done by these other front ends. - -Use @samp{-fno-emulate-complex} to try the @code{complex} support -in the @code{gcc} back end, in case it works and produces faster -programs. -So far, all the known bugs seem to involve compile-time crashes, -rather than the generation of incorrect code. - -Use of this option should not affect how Fortran code compiled -by @code{g77} works in terms of its interfaces to other code, -e.g. that compiled by @code{f2c}. - -@emph{Caution:} Future versions of @code{g77} are likely to change -the default for this option to -@samp{-fno-emulate-complex}, and perhaps someday ignore both forms -of this option. - -Also, it is possible that use of the @samp{-fno-emulate-complex} option -could result in incorrect code being silently produced by @code{g77}. -But, this is generally true of compilers anyway, so, as usual, test -the programs you compile before assuming they are working. - -@cindex -falias-check option -@cindex options, -falias-check -@cindex -fargument-alias option -@cindex options, -fargument-alias -@cindex -fargument-noalias option -@cindex options, -fargument-noalias -@cindex -fno-argument-noalias-global option -@cindex options, -fno-argument-noalias-global -@item -falias-check -@item -fargument-alias -@item -fargument-noalias -@item -fno-argument-noalias-global -These options specify to what degree aliasing -(overlap) -is permitted between -arguments (passed as pointers) and @code{COMMON} (external, or -public) storage. - -The default for Fortran code, as mandated by the FORTRAN 77 and -Fortran 90 standards, is @samp{-fargument-noalias-global}. -The default for code written in the C language family is -@samp{-fargument-alias}. - -Note that, on some systems, compiling with @samp{-fforce-addr} in -effect can produce more optimal code when the default aliasing -options are in effect (and when optimization is enabled). - -@xref{Aliasing Assumed To Work}, for detailed information on the implications -of compiling Fortran code that depends on the ability to alias dummy -arguments. +@samp{COMMON} and @samp{EQUIVALENCE} members. @end table @xref{Code Gen Options,,Options for Code Generation Conventions, @@ -3114,212 +2978,37 @@ variables. @cindex changes, user-visible @cindex user-visible changes -This section describes changes to @code{g77} that are visible -to the programmers who actually write and maintain Fortran -code they compile with @code{g77}. -Information on changes to installation procedures, -changes to the documentation, and bug fixes is -not provided here, unless it is likely to affect how -users use @code{g77}. -@xref{News,,News About GNU Fortran}, for information on -such changes to @code{g77}. - To find out about existing bugs and ongoing plans for GNU -Fortran, retrieve @url{ftp://alpha.gnu.ai.mit.edu/g77.plan} -or, if you cannot do that, email -@email{fortran@@gnu.ai.mit.edu} asking for a recent copy of the +Fortran, on Internet do @samp{finger -l fortran@@gnu.ai.mit.edu} +or whatever is the equivalent on your system. +(You might need to use the address @samp{fortran@@gate-1.gnu.ai.mit.edu} +instead, or use @samp{gate-2}, @samp{gate-3}, @samp{gate-4}, and so on, +instead of @samp{gate-1}.) + +Alternatively, retrieve @url{ftp://gnu.ai.mit.edu/g77.plan} via +anonymous ftp, or if you cannot do that, email +@samp{fortran@@gnu.ai.mit.edu} asking for a recent copy of the GNU Fortran @file{.plan} file. - -@heading In 0.5.20: -@itemize @bullet -@item -The @samp{-fno-typeless-boz} option is now the default. - -This option specifies that non-decimal-radix -constants using the prefixed-radix form (such as @samp{Z'1234'}) -are to be interpreted as @code{INTEGER(KIND=1)} constants. -Specify @samp{-ftypeless-boz} to cause such -constants to be interpreted as typeless. - -(Version 0.5.19 introduced @samp{-fno-typeless-boz} and -its inverse.) - -@xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}, -for information on the @samp{-ftypeless-boz} option. - -@item -Options @samp{-ff90-intrinsics-enable} and -@samp{-fvxt-intrinsics-enable} now are the -defaults. - -Some programs might use names that clash with -intrinsic names defined (and now enabled) by these -options or by the new @code{libU77} intrinsics. -Users of such programs might need to compile them -differently (using, for example, @samp{-ff90-intrinsics-disable}) -or, better yet, insert appropriate @code{EXTERNAL} -statements specifying that these names are not intended -to be names of intrinsics. - -@item -The @samp{ALWAYS_FLUSH} macro is no longer defined when -building @code{libf2c}, which should result in improved -I/O performance, especially over NFS. - -@emph{Note:} If you have code that depends on the behavior -of @code{libf2c} when built with @samp{ALWAYS_FLUSH} defined, -you will have to modify @code{libf2c} accordingly before -building it from this and future versions of @code{g77}. - -@xref{Output Assumed To Flush}, for more information. - -@item -Dave Love's implementation of @code{libU77} has been -added to the version of @code{libf2c} distributed with -and built by @code{g77}. -@code{g77} now knows about the routines in this library -as intrinsics. - -@item -New option @samp{-fvxt} specifies that the -source file is written in VXT Fortran, instead of GNU Fortran. - -@xref{VXT Fortran}, for more information on the constructs -recognized when the @samp{-fvxt} option is specified. - -@item -The @samp{-fvxt-not-f90} option has been deleted, -along with its inverse, @samp{-ff90-not-vxt}. - -If you used one of these deleted options, you should -re-read the pertinent documentation to determine which -options, if any, are appropriate for compiling your -code with this version of @code{g77}. - -@xref{Other Dialects}, for more information. - -@item -The @samp{-fugly} option now issues a warning, as it -likely will be removed in a future version. - -(Enabling all the @samp{-fugly-*} options is unlikely -to be feasible, or sensible, in the future, -so users should learn to specify only those -@samp{-fugly-*} options they really need for a -particular source file.) - -@item -The @samp{-fugly-assumed} option, introduced in -version 0.5.19, has been changed to -better accommodate old and new code. -@xref{Ugly Assumed-Size Arrays}, for more information. - -@item -Related to supporting Alpha (AXP) machines, the @code{LOC()} -intrinsic and @code{%LOC()} construct now return -values of @code{INTEGER(KIND=0)} type, -as defined by the GNU Fortran language. - -This type is wide enough -(holds the same number of bits) -as the character-pointer type on the machine. - -On most systems, this won't make a noticable difference, -whereas on Alphas and other systems with 64-bit pointers, -the @code{INTEGER(KIND=0)} type is equivalent to @code{INTEGER(KIND=2)} -(often referred to as @code{INTEGER*8}) -instead of the more common @code{INTEGER(KIND=1)} -(often referred to as @code{INTEGER*4}). - -@item -Emulate @code{COMPLEX} arithmetic in the @code{g77} front -end, to avoid bugs in @code{complex} support in the -@code{gcc} back end. -New option @samp{-fno-emulate-complex} -causes @code{g77} to revert the 0.5.19 behavior. - -@item -Dummy arguments are no longer assumed to potentially alias -(overlap) -other dummy arguments or @code{COMMON} areas when any of -these are defined (assigned to) by Fortran code. - -This can result in faster and/or smaller programs when -compiling with optimization enabled, though on some -systems this effect is observed only when @samp{-fforce-addr} -also is specified. - -New options @samp{-falias-check}, @samp{-fargument-alias}, -@samp{-fargument-noalias}, -and @samp{-fno-argument-noalias-global} control the -way @code{g77} handles potential aliasing. - -@xref{Aliasing Assumed To Work}, for detailed information on why the -new defaults might result in some programs no longer working the way they -did when compiled by previous versions of @code{g77}. - -@item -New option @samp{-fugly-assign} specifies that the -same memory locations are to be used to hold the -values assigned by both statements @samp{I = 3} and -@samp{ASSIGN 10 TO I}, for example. -(Normally, @code{g77} uses a separate memory location -to hold assigned statement labels.) - -@xref{Ugly Assigned Labels}, for more information. - -@item -@code{FORMAT} and @code{ENTRY} statements now are allowed to -precede @code{IMPLICIT NONE} statements. - -@item -Enable full support of @code{INTEGER(KIND=2)} -(often referred to as @code{INTEGER*8}) -available in -@code{libf2c} and @file{f2c.h} so that @code{f2c} users -may make full use of its features via the @code{g77} -version of @file{f2c.h} and the @code{INTEGER(KIND=2)} -support routines in the @code{g77} version of @code{libf2c}. - -@item -Improve @code{g77} driver and @code{libf2c} so that @samp{g77 -v} -yields version information on the library. - -@item -The @code{SNGL} and @code{FLOAT} intrinsics now are -specific intrinsics, instead of synonyms for the -generic intrinsic @code{REAL}. - -@item -New intrinsics have been added. -These are @code{REALPART}, @code{IMAGPART}, -@code{COMPLEX}, -@code{LONG}, and @code{SHORT}. - -@item -A new group of intrinsics, @samp{gnu}, has been added -to contain the new @code{REALPART}, @code{IMAGPART}, -and @code{COMPLEX} intrinsics. -An old group, @samp{dcp}, has been removed. -@end itemize +(The @code{finger} command shown above obtains the most recent +copy of all these methods.) @heading In 0.5.19: @itemize @bullet @item A temporary kludge option provides bare-bones information on -@code{COMMON} and @code{EQUIVALENCE} members at debug time. +@samp{COMMON} and @samp{EQUIVALENCE} members at debug time. @xref{Code Gen Options,,Options for Code Generation Conventions}, for information on the @samp{-fdebug-kludge} option. @item New @samp{-fonetrip} option specifies FORTRAN-66-style -one-trip @code{DO} loops. +one-trip @samp{DO} loops. @item New @samp{-fno-silent} option causes names of program units to be printed as they are compiled, in a fashion similar to -UNIX @code{f77} and @code{f2c}. +UNIX @samp{f77} and @samp{f2c}. @item New @samp{-fugly-assumed} option specifies that arrays @@ -3329,7 +3018,7 @@ treated as assumed-size. @item New @samp{-fno-typeless-boz} option specifies that non-decimal-radix constants using the prefixed-radix form (such as @samp{Z'1234'}) -are to be interpreted as @code{INTEGER(KIND=1)} constants. +are to be interpreted as @samp{INTEGER} constants. @item New @samp{-ff66} option is a ``shorthand'' option that specifies @@ -3337,7 +3026,7 @@ behaviors considered appropriate for FORTRAN 66 programs. @item New @samp{-ff77} option is a ``shorthand'' option that specifies -behaviors considered appropriate for UNIX @code{f77} programs. +behaviors considered appropriate for UNIX @samp{f77} programs. @item New @samp{-fugly-comma} and @samp{-fugly-logint} options provided @@ -3348,18 +3037,18 @@ in that they do nothing more than enable (or disable) other @item Change code generation for list-directed I/O so it allows -for new versions of @code{libf2c} that might return non-zero +for new versions of @samp{libf2c} that might return non-zero status codes for some operations previously assumed to always return zero. -This change not only affects how @code{IOSTAT=} variables +This change not only affects how @samp{IOSTAT=} variables are set by list-directed I/O, it also affects whether -@code{END=} and @code{ERR=} labels are reached by these +@samp{END=} and @samp{ERR=} labels are reached by these operations. @item -Add intrinsic support for new @code{FTELL} and @code{FSEEK} -procedures in @code{libf2c}. +Add intrinsic support for new @samp{FTELL} and @samp{FSEEK} +procedures in @samp{libf2c}. @item Add options @samp{--help} and @samp{--version} to the @@ -3376,8 +3065,8 @@ The @code{BYTE} and @code{WORD} statements now are supported, to a limited extent. @item -@code{INTEGER*1}, @code{INTEGER*2}, @code{INTEGER*8}, -and their @code{LOGICAL} +@samp{INTEGER*1}, @samp{INTEGER*2}, @samp{INTEGER*8}, +and their @samp{LOGICAL} equivalents, now are supported to a limited extent. Among the missing elements are complete intrinsic and constant support. @@ -3416,9 +3105,9 @@ New option @samp{-fno-second-underscore}. @itemize @bullet @item -The @code{ERF()} and @code{ERFC()} intrinsics now are generic -intrinsics, mapping to @code{ERF}/@code{DERF} and -@code{ERFC}/@code{DERFC}, respectively. +The @samp{ERF()} and @samp{ERFC()} intrinsics now are generic +intrinsics, mapping to @samp{ERF}/@samp{DERF} and +@samp{ERFC}/@samp{DERFC}, respectively. @emph{Note:} Use @samp{INTRINSIC ERF,ERFC} in any code that might reference these as generic intrinsics, to improve the likelihood of diagnostics (instead of subtle run-time @@ -3428,7 +3117,7 @@ bugs) when using compilers that don't support these as intrinsics. New option @samp{-Wsurprising}. @item -DO loops with non-@code{INTEGER} variables now diagnosed only when +DO loops with non-@samp{INTEGER} variables now diagnosed only when @samp{-Wsurprising} specified. Previously, this was diagnosed @emph{unless} @samp{-fpedantic} or @samp{-fugly} was specified. @@ -3440,7 +3129,7 @@ Previously, this was diagnosed @emph{unless} @samp{-fpedantic} or @item @code{libf2c} changed to output a leading zero (0) digit for floating-point values output via list-directed and formatted output (to bring @code{g77} -more into line with many existing Fortran implementations---the +more in line with many existing Fortran implementations---the ANSI FORTRAN 77 standard leaves this choice to the implementation). @item @@ -3456,10 +3145,10 @@ including messages like @samp{In function `foo':} and @samp{In file included from...:}. @item -New group of intrinsics called @samp{unix}, including @code{ABORT}, -@code{DERF}, @code{DERFC}, @code{ERF}, @code{ERFC}, @code{EXIT}, -@code{FLUSH}, @code{GETARG}, @code{GETENV}, @code{SIGNAL}, and -@code{SYSTEM}. +New group of intrinsics called @samp{unix}, including @samp{ABORT}, +@samp{DERF}, @samp{DERFC}, @samp{ERF}, @samp{ERFC}, @samp{EXIT}, +@samp{FLUSH}, @samp{GETARG}, @samp{GETENV}, @samp{SIGNAL}, and +@samp{SYSTEM}. @item @samp{-funix-intrinsics-@{delete,hide,disable,enable@}} @@ -3492,6 +3181,98 @@ source-location info now is passed all the way through the compilation process instead of being lost. @end itemize +@heading In 0.5.15: + +@itemize @bullet +@item +@samp{-ffixed-line-length-@var{n}} option introduced. +@end itemize + +@heading In 0.5.14: + +@itemize @bullet +@item +Support for gcc's @samp{-I} option added. + +@item +@samp{-fbackslash} option added. + +@item +@samp{-fugly-args} option enabled by default (allows @samp{CALL FOO(4HABCD)}). + +@item +@samp{-fugly-init} option added. + +@item +@samp{-finit-local-zero} option added. + +@item +Support for the @code{gcc} option @samp{-Wimplicit} added. + +@item +@samp{-Wall} now implies @samp{-Wunused} and, when @samp{-O} is +specified, @samp{-Wuninitialized}. + +@cindex Hollerith constants +@cindex constants, Hollerith +@item +Hollerith constants as actual arguments now are passed by reference +instead of by value---so @samp{CALL FOO(4HABCD)} now is compiled exactly +the same as @samp{CALL FOO(%REF('ABCD'))}, instead of as +@samp{CALL FOO(%VAL('ABCD'))}. + +@item +Hollerith constants converted to larger types now are padded on the +right with spaces. +When converted to smaller types, warnings are issued +if non-spaces are truncated on the right. + +@item +Format specifications of arrays of types other than @samp{CHARACTER} are +allowed in I/O statements, such as when they contain Hollerith +data. + +@cindex typeless constants +@cindex constants, typeless +@item +Typeless constants as actual arguments now are passed by reference +to an @samp{INTEGER} version of the constant instead of by value. + +@item +Typeless constants converted to larger types are padded on the left +with zeros. +When converted to smaller types, warnings are issued if non-zero +bits are truncated on the left. + +@cindex %DESCR() intrinsic +@cindex intrinsics, %DESCR() +@item +@samp{%DESCR()} of a non-@samp{CHARACTER} expression treats the expression +as if it were @samp{CHARACTER}, passing both a pointer to the expression +and the length of the type of the expression in bytes, by value, in the +``hidden'' list of lengths used for @samp{CHARACTER} arguments. + +@item +The @samp{ICHAR()}, @samp{IACHAR()}, and @samp{LEN()} intrinsics now +accept character expressions involving concatenation of assumed-length +dummy arguments. + +@item +Block data program units now may contain @samp{NAMELIST}, @samp{EXTERNAL}, +@c @samp{INTRINSIC}, and @samp{VOLATILE} statements. +and @samp{INTRINSIC} statements. + +@item +Zero-length character expressions now supported. + +@item +Support for the @code{f2c} intrinsic @samp{IMAG()} added. + +@item +@samp{INCLUDE} statement restrictions, such as no continuation +lines allowed, now lifted. +@end itemize + @node Language @chapter The GNU Fortran Language @@ -3515,206 +3296,32 @@ of how it supports types, constants, and so on. Much of this is left up to the implementation by the various Fortran standards and accepted practice in the industry. -The GNU Fortran @emph{language} is described below. -Much of the material is organized along the same lines -as the ANSI FORTRAN 77 standard itself. - -@xref{Other Dialects}, for information on features @code{g77} supports -that are not part of the GNU Fortran language. - -@emph{Note}: This portion of the documentation definitely needs a lot -of work! - @menu -Relationship to the ANSI FORTRAN 77 standard: -* Direction of Language Development:: Where GNU Fortran is headed. -* Standard Support:: Degree of support for the standard. - -Extensions to the ANSI FORTRAN 77 standard: -* Conformance:: -* Notation Used:: -* Terms and Concepts:: -* Characters Lines Sequence:: -* Data Types and Constants:: -* Expressions:: -* Specification Statements:: -* Control Statements:: -* Functions and Subroutines:: -* Scope and Classes of Names:: +* Standard Support:: Degree of support for the ANSI FORTRAN 77 standard. +* Extensions:: Extensions to GNU Fortran. +* Types:: Data types. +* Constants:: Constants and their types. +* Source Form:: Form of source files (fixed, free, and so on). +* Pedantic Compilation:: Warnings about non-standard constructs. +* Case Sensitivity:: Uppercase and lowercase in source files. +* Intrinsics:: How intrinsics are grouped for easy management. +* Dialects:: Dialects supported by GNU Fortran. +* Object Compatibility:: Compatibility issues for code generated by @code{g77}. +* Distensions:: Misfeatures supported by GNU Fortran. @end menu -@node Direction of Language Development -@section Direction of Language Development -@cindex direction of language development -@cindex features, language -@cindex language features - -The purpose of the following description of the GNU Fortran -language is to promote wide portability of GNU Fortran programs. - -GNU Fortran is an evolving language, due to the -fact that @code{g77} itself is in beta test. -Some current features of the language might later -be redefined as dialects of Fortran supported by @code{g77} -when better ways to express these features are added to @code{g77}, -for example. -Such features would still be supported by -@code{g77}, but would be available only when -one or more command-line options were used. - -The GNU Fortran @emph{language} is distinct from the -GNU Fortran @emph{compilation system} (@code{g77}). - -For example, @code{g77} supports various dialects of -Fortran---in a sense, these are languages other than -GNU Fortran---though its primary -purpose is to support the GNU Fortran language, which also is -described in its documentation and by its implementation. - -On the other hand, non-GNU compilers might offer -support for the GNU Fortran language, and are encouraged -to do so. - -Currently, the GNU Fortran language is a fairly fuzzy object. -It represents something of a cross between what @code{g77} accepts -when compiling using the prevailing defaults and what this -document describes as being part of the language. - -Future versions of @code{g77} are expected to clarify the -definition of the language in the documentation. -Often, this will mean adding new features to the language, in the form -of both new documentation and new support in @code{g77}. -However, it might occasionally mean removing a feature -from the language itself to ``dialect'' status. -In such a case, the documentation be adjusted -to reflect the change, and @code{g77} itself would likely be changed -to require one or more command-line options to continue supporting -the feature. - -The development of the GNU Fortran language is intended to strike -a balance between: - -@itemize @bullet -@item -Serving as a mostly-upwards-compatible language from the -de facto UNIX Fortran dialect as supported by @code{f77}. - -@item -Offering new, well-designed language features. -Attributes of such features include -not making existing code any harder to read -(for those who might be unaware that the new -features are not in use) and -not making state-of-the-art -compilers take longer to issue diagnostics, -among others. - -@item -Supporting existing, well-written code without gratuitously -rejecting non-standard constructs, regardless of the origin -of the code (its dialect). - -@item -Offering default behavior and command-line options to reduce -and, where reasonable, eliminate the need for programmers to make -any modifications to code that already works in existing -production environments. - -@item -Diagnosing constructs that have different meanings in different -systems, languages, and dialects, while offering clear, -less ambiguous ways to express each of the different meanings -so programmers can change their code appropriately. -@end itemize - -One of the biggest practical challenges for the developers of the -GNU Fortran language is meeting the sometimes contradictory demands -of the above items. - -For example, a feature might be widely used in one popular environment, -but the exact same code that utilizes that feature might not work -as expected---perhaps it might mean something entirely different---in -another popular environment. - -Traditionally, Fortran compilers---even portable ones---have solved this -problem by simply offering the appropriate feature to users of -the respective systems. -This approach treats users of various Fortran systems and dialects -as remote ``islands'', or camps, of programmers, and assume that these -camps rarely come into contact with each other (or, -especially, with each other's code). - -Project GNU takes a radically different approach to software and language -design, in that it assumes that users of GNU software do not necessarily -care what kind of underlying system they are using, regardless -of whether they are using software (at the user-interface -level) or writing it (for example, writing Fortran or C code). - -As such, GNU users rarely need consider just what kind of underlying -hardware (or, in many cases, operating system) they are using at any -particular time. -They can use and write software designed for a general-purpose, -widely portable, heteregenous environment---the GNU environment. - -In line with this philosophy, GNU Fortran must evolve into a product -that is widely ported and portable not only in the sense that it can -be successfully built, installed, and run by users, but in the larger -sense that its users can use it in the same way, and expect largely the -same behaviors from it, regardless of the kind of system they are using -at any particular time. - -This approach constrains the solutions @code{g77} can use to resolve -conflicts between various camps of Fortran users. -If these two camps disagree about what a particular construct should -mean, @code{g77} cannot simply be changed to treat that particular construct as -having one meaning without comment (such as a warning), lest the users -expecting it to have the other meaning are unpleasantly surprised that -their code misbehaves when executed. - -The use of the ASCII backslash character in character constants is -an excellent (and still somewhat unresolved) example of this kind of -controversy. -@xref{Backslash in Constants}. -Other examples are likely to arise in the future, as @code{g77} developers -strive to improve its ability to accept an ever-wider variety of existing -Fortran code without requiring significant modifications to said code. - -Development of GNU Fortran is further constrained by the desire -to avoid requiring programmers to change their code. -This is important because it allows programmers, administrators, -and others to more faithfully evaluate and validate @code{g77} -(as an overall product and as new versions are distributed) -without having to support multiple versions of their programs -so that they continue to work the same way on their existing -systems (non-GNU perhaps, but possibly also earlier versions -of @code{g77}). - @node Standard Support @section ANSI FORTRAN 77 Standard Support @cindex ANSI FORTRAN 77 support @cindex standard support @cindex support for ANSI FORTRAN 77 -@cindex compatibility, FORTRAN 77 -@cindex FORTRAN 77 compatibility -GNU Fortran supports ANSI FORTRAN 77 with the following caveats. -In summary, the only ANSI FORTRAN 77 features @code{g77} doesn't -support are those that are probably rarely used in actual code, -some of which are explicitly disallowed by the Fortran 90 standard. - -@menu -* No Passing External Assumed-length:: CHAR*(*) CFUNC restriction. -* No Passing Dummy Assumed-length:: CHAR*(*) CFUNC restriction. -* No Pathological Implied-DO:: No @samp{((@dots{}, I=@dots{}), I=@dots{})}. -* No Useless Implied-DO:: No @samp{(A, I=1, 1)}. -@end menu +GNU Fortran supports ANSI FORTRAN 77 with the following caveats: -@node No Passing External Assumed-length -@subsection No Passing External Assumed-length - -@code{g77} disallows passing of an external procedure -as an actual argument if the procedure's -type is declared @code{CHARACTER*(*)}. For example: +@itemize @bullet +@item +No passing of an external procedure as an actual argument if the procedure's +type is declared @samp{CHARACTER*(*)}. For example: @example CHARACTER*(*) CFUNC @@ -3726,12 +3333,12 @@ END @noindent It isn't clear whether the standard considers this conforming. -@node No Passing Dummy Assumed-length -@subsection No Passing Dummy Assumed-length +Note that it is unlikely that any production Fortran code +tries to use this unsupported construct. -@code{g77} disallows passing of a dummy procedure -as an actual argument if the procedure's -type is declared @code{CHARACTER*(*)}. +@item +No passing of a dummy procedure as an actual argument if the procedure's +type is declared @samp{CHARACTER*(*)}. @example SUBROUTINE BAR(CFUNC) @@ -3744,16 +3351,17 @@ END @noindent It isn't clear whether the standard considers this conforming. -@node No Pathological Implied-DO -@subsection No Pathological Implied-DO +Note that it is unlikely that any production Fortran code +tries to use this unsupported construct. -The @code{DO} variable for an implied-@code{DO} construct in a -@code{DATA} statement may not be used as the @code{DO} variable -for an outer implied-@code{DO} construct. For example, this +@item +The @samp{DO} variable for an implied-@samp{DO} construct in a +@samp{DATA} statement may not be used as the @samp{DO} variable +for an outer implied-@samp{DO} construct. For example, this fragment is disallowed by @code{g77}: @smallexample -DATA ((A(I, I), I= 1, 10), I= 1, 10) /@dots{}/ +DATA ((A(I, I), I= 1, 10), I= 1, 10)/@dots{}/ @end smallexample @noindent @@ -3763,16 +3371,14 @@ capabilities and would have a variety of possible meanings. Note that it is @emph{very} unlikely that any production Fortran code tries to use this unsupported construct. -@node No Useless Implied-DO -@subsection No Useless Implied-DO - -An array element initializer in an implied-@code{DO} construct in a -@code{DATA} statement must contain at least one reference to the @code{DO} -variables of each outer implied-@code{DO} construct. For example, +@item +An array element initializer in an implied-@samp{DO} construct in a +@samp{DATA} statement must contain at least one reference to the @samp{DO} +variables of each outer implied-@samp{DO} construct. For example, this fragment is disallowed by @code{g77}: @example -DATA (A, I= 1, 1) /1./ +DATA (A, I= 1, 1)/1./ @end example @noindent @@ -3783,363 +3389,286 @@ where this requirement is not met. Note that it is @emph{very} unlikely that any production Fortran code tries to use this unsupported construct. +@end itemize -@node Conformance -@section Conformance - -(The following information augments or overrides the information in -Section 1.4 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 1 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -The definition of the GNU Fortran language is akin to that of -the ANSI FORTRAN 77 language in that it does not generally require -conforming implementations to diagnose cases where programs do -not conform to the language. +In summary, the only ANSI FORTRAN 77 features @code{g77} doesn't +support are those that are probably rarely used in actual code, +some of which are explicitly disallowed by the Fortran 90 standard. -However, @code{g77} as a compiler is being developed in a way that -is intended to enable it to diagnose such cases in an easy-to-understand -manner. +@node Extensions +@section GNU Fortran Extensions +@cindex extensions +@cindex language extensions -A program that conforms to the GNU Fortran language should, when -compiled, linked, and executed using a properly installed @code{g77} -system, perform as described by the GNU Fortran language definition. -Reasons for different behavior include, among others: +GNU Fortran supports ANSI FORTRAN 77 plus: @itemize @bullet +@cindex LOC() intrinsic +@cindex intrinsics, LOC() @item -Use of resources (memory---heap, stack, and so on; disk space; CPU -time; etc.) exceeds those of the system. +@samp{LOC()}, if @samp{-funix-intrinsics-enable} is in force. @item -Range and/or precision of calculations required by the program -exceeds that of the system. +@cindex %LOC() intrinsic +@cindex intrinsics, %LOC() +@cindex %VAL() intrinsic +@cindex intrinsics, %VAL() +@cindex %REF() intrinsic +@cindex intrinsics, %REF() +@cindex %DESCR() intrinsic +@cindex intrinsics, %DESCR() +@samp{%LOC}, @samp{%VAL}, @samp{%REF}, and @samp{%DESCR}---where +@samp{%DESCR} currently means the same thing as passing the argument +as if it were a @samp{CHARACTER} variable (with the phantom +length argument appended to the argument list). @item -Excessive reliance on behaviors that are system-dependent -(non-portable Fortran code). +MIL-STD 1753 features (@samp{IAND}, @samp{IOR}, @samp{MVBITS}, +@samp{DO WHILE}, @samp{END DO}, and so on). +@cindex NAMELIST statement +@cindex statements, NAMELIST @item -Bugs in the program. +@samp{NAMELIST}. @item -Bug in @code{g77}. +Most @code{f2c} intrinsics (@samp{AND}, @samp{OR}, @samp{LSHIFT}, +@samp{RSHIFT}, and so on). @item -Bugs in the system. -@end itemize +@samp{DOUBLE COMPLEX} and related intrinsics (standard and @code{f2c} +varieties). -Despite these ``loopholes'', the availability of a clear specification -of the language of programs submitted to @code{g77}, as this document -is intended to provide, is considered an important aspect of providing -a robust, clean, predictable Fortran implementation. - -The definition of the GNU Fortran language, while having no special -legal status, can therefore be viewed as a sort of contract, or agreement. -This agreement says, in essence, ``if you write a program in this language, -and run it in an environment (such as a @code{g77} system) that supports -this language, the program should behave in a largely predictable way''. - -@node Notation Used -@section Notation Used in This Chapter - -(The following information augments or overrides the information in -Section 1.5 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 1 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -In this chapter, ``must'' denotes a requirement, ``may'' denotes permission, -and ``must not'' and ``may not'' denote prohibition. -Terms such as ``might'', ``should'', and ``can'' generally add little or -nothing in the way of weight to the GNU Fortran language itself, -but are used to explain or illustrate the language. - -For example: - -@display -``The @code{FROBNITZ} statement must precede all executable -statements in a program unit, and may not specify any dummy -arguments. It may specify local or common variables and arrays. -Its use should be limited to portions of the program designed to -be non-portable and system-specific, because it might cause the -containing program unit to behave quite differently on different -systems.'' -@end display - -Insofar as the GNU Fortran language is specified, -the requirements and permissions denoted by the above sample statement -are limited to the placement of the statement and the kinds of -things it may specify. -The rest of the statement---the content regarding non-portable portions -of the program and the differing behavior of program units containing -the @code{FROBNITZ} statement---does not pertain the GNU Fortran -language itself. -That content offers advice and warnings about the @code{FROBNITZ} -statement. - -@emph{Remember:} The GNU Fortran language definition specifies -both what constitutes a valid GNU Fortran program and how, -given such a program, a valid GNU Fortran implementation is -to interpret that program. - -It is @emph{not} incumbent upon a valid GNU Fortran implementation -to behave in any particular way, any consistent way, or any -predictable way when it is asked to interpret input that is -@emph{not} a valid GNU Fortran program. - -Such input is said to have @dfn{undefined} behavior when -interpreted by a valid GNU Fortran implementation, though -an implementation may choose to specify behaviors for some -cases of inputs that are not valid GNU Fortran programs. - -Other notation used herein is that of the GNU texinfo format, -which is used to generate printed hardcopy, on-line hypertext -(Info), and on-line HTML versions, all from a single source -document. -This notation is used as follows: - -@itemize @bullet @item -Keywords defined by the GNU Fortran language are shown -in uppercase, as in: @code{COMMON}, @code{INTEGER}, and -@code{BLOCK DATA}. - -Note that, in practice, many Fortran programs are written -in lowercase---uppercase is used in this manual as a -means to readily distinguish keywords and sample Fortran-related -text from the prose in this document. +Various Fortran 90 features, such as @samp{CYCLE}, @samp{EXIT}, +@samp{SELECT CASE} (except for @samp{CHARACTER} types). @item -Portions of actual sample program, input, or output text -look like this: @samp{Actual program text}. - -Generally, uppercase is used for all Fortran-specific and -Fortran-related text, though this does not always include -literal text within Fortran code. - -For example: @samp{PRINT *, 'My name is Bob'}. +Various DEC VAX/VMS FORTRAN v4.0 features (loosely called VXT extensions). @item -A metasyntactic variable---that is, a name used in this document -to serve as a placeholder for whatever text is used by the -user or programmer--appears as shown in the following example: - -``The @code{INTEGER @var{ivar}} statement specifies that -@var{ivar} is a variable or array of type @code{INTEGER}.'' +Various @code{f2c} features. -In the above example, any valid text may be substituted for -the metasyntactic variable @var{ivar} to make the statement -apply to a specific instance, as long as the same text is -substituted for @emph{both} occurrences of @var{ivar}. +@item +Source files that are uppercase-only (enforced), lowercase-only +(enforced), caseless, and various other combinations as chosen via +command-line options. @item -Ellipses (``@dots{}'') are used to indicate further text that -is either unimportant or expanded upon further, elsewhere. +Arbitrary (limited only by available memory) number of continuation lines. @item -Names of data types are in the style of Fortran 90, in most -cases. +Use of @samp{&} in column 1 to indicate a continuation line +(as supported by @code{f2c}). -@xref{Kind Notation}, for information on the relationship -between Fortran 90 nomenclature (such as @code{INTEGER(KIND=1)}) -and the more traditional, less portably concise nomenclature -(such as @code{INTEGER*4}). +@item +Dollar signs (@samp{$}) in identifiers (other than as the first character) +when the @samp{-fdollar-ok} option is specified. @end itemize -@node Terms and Concepts -@section Fortran Terms and Concepts - -(The following information augments or overrides the information in -Chapter 2 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 2 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -@menu -* Syntactic Items:: -* Statements Comments Lines:: -* Scope of Names and Labels:: -@end menu - -@node Syntactic Items -@subsection Syntactic Items - -(Corresponds to Section 2.2 of ANSI X3.9-1978 FORTRAN 77.) - -In GNU Fortran, a symbolic name is at least one character long, -and has no arbitrary upper limit on length. -However, names of entities requiring external linkage (such as -external functions, external subroutines, and @code{COMMON} areas) -might be restricted to some arbitrary length by the system. -Such a restriction is no more constrained than that of one -through six characters. - -Underscores (@samp{_}) are accepted in symbol names after the first -character (which must be a letter). - -@node Statements Comments Lines -@subsection Statements, Comments, and Lines - -(Corresponds to Section 2.3 of ANSI X3.9-1978 FORTRAN 77.) - -@cindex comments, trailing -@cindex trailing comments -Use of an exclamation point (@samp{!}) to begin a -trailing comment (a comment that extends to the end of the same -source line) is permitted under the following conditions: +When @samp{-ff90} is specified, the language dialect changes as follows: @itemize @bullet @item -The exclamation point does not appear in column 6. -Otherwise, it is treated as an indicator of a continuation -line. +The type of @samp{REAL(Z)}, where @samp{Z} is type +@samp{DOUBLE COMPLEX}, is @samp{DOUBLE PRECISION} +instead of @samp{REAL}. @item -The exclamation point appears outside a character or hollerith -constant. -Otherwise, the exclamation point is considered part of the -constant. +Zero-length @samp{CHARACTER} entities are accepted, +even when @samp{-fpedantic} is specified. @item -The exclamation point appears to the left of any other possible -trailing comment. -That is, a trailing comment may contain exclamation points -in their commentary text. -@end itemize - -@cindex semicolons -@cindex statements, separated by semicolon -Use of a semicolon (@samp{;}) as a statement separator -is permitted under the following conditions: +Zero-size array dimensions (as in @samp{INTEGER I(10,20,4:2)}) +are accepted, +although these are not supported by @samp{libf2c}, so diagnostics +are nevertheless produced for @code{g77}. -@itemize @bullet @item -The semicolon appears outside a character or hollerith -constant. -Otherwise, the semicolon is considered part of the -constant. +@samp{DOUBLE COMPLEX} (explicit or implicit) is accepted, +even when @samp{-fpedantic} is specified. @item -The semicolon appears to the left of a trailing comment. -Otherwise, the semicolon is considered part of that -comment. +Substrings of constants (as in @samp{'hello'(3:5)}) are +accepted, even when @samp{-fpedantic} is specified. @item -Neither a logical @code{IF} statement nor a non-construct -@code{WHERE} statement (a Fortran 90 feature) may be -followed (in the same, possibly continued, line) by -a semicolon used as a statement separator. +@samp{DATA} statements are allowed to precede executable statements, +even when @samp{-fpedantic} specified. -This restriction avoids the confusion -that can result when reading a line such as: - -@example -IF (VALIDP) CALL FOO; CALL BAR -@end example +Note that this does not allow all possible means of specifying +further attributes via specification statements for a variable +after it has been given an initial value via @samp{DATA} or a +type-declaration statement. +For example, +after @samp{DATA I/1/}, @samp{INTEGER I} is not permitted, but +@samp{INTEGER J} is permitted. -@noindent -Some readers might think the @samp{CALL BAR} is executed -only if @samp{VALIDP} is @code{.TRUE.}, while others might -assume its execution is unconditional. +@item +@cindex semicolons +@cindex statements, separated by semicolon +Use of a semicolon (@samp{;}) as a statement separator +is accepted, even when @samp{-fpedantic} specified +(so @samp{CALL FOO; CALL BAR} works). -(At present, @code{g77} does not diagnose code that -violates this restriction.) +@item +Underscores (@samp{_}) are accepted in symbol names (except as the +first character, since Fortran 90 provides a different interpretation +for certain cases where that would occur---though @code{g77} does +not yet support that interpretation). @end itemize -@node Scope of Names and Labels -@subsection Scope of Symbolic Names and Statement Labels -@cindex scope - -(Corresponds to Section 2.9 of ANSI X3.9-1978 FORTRAN 77.) - -Included in the list of entities that have a scope of a -program unit are construct names (a Fortran 90 feature). -@xref{Construct Names}, for more information. - -@node Characters Lines Sequence -@section Characters, Lines, and Execution Sequence - -(The following information augments or overrides the information in -Chapter 3 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 3 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -@menu -* Character Set:: -* Lines:: -* Continuation Line:: -* Statements:: -* Statement Labels:: -* Order:: -* INCLUDE:: -@end menu - -@node Character Set -@subsection GNU Fortran Character Set -@cindex characters +@node Types +@section Types +@cindex types, of data +@cindex data types -(Corresponds to Section 3.1 of ANSI X3.9-1978 FORTRAN 77.) +Fortran implementations have a fair amount of freedom given them by the +standard as far as how much storage space is used and how much precision +is offered by the various types such as @samp{LOGICAL}, @samp{INTEGER}, +@samp{REAL}, @samp{DOUBLE PRECISION}, @samp{COMPLEX}, and @samp{CHARACTER}. +Further, many compilers offer so-called @samp{*@var{n}} notation, but +the interpretation of @var{n} varies across compilers and target architectures. -Letters include uppercase letters (the twenty-six characters -of the English alphabet) and lowercase letters (their lowercase -equivalent). -Generally, lowercase letters may be used in place of uppercase -letters, though in character and hollerith constants, they -are distinct. +The standard requires that @samp{LOGICAL}, @samp{INTEGER}, and @samp{REAL} +occupy the same amount of storage space, and that @samp{COMPLEX} and +@samp{DOUBLE PRECISION} take twice as much storage space as @samp{REAL}. +Further, it requires that @samp{COMPLEX} +entities be ordered such that when a @samp{COMPLEX} variable is +storage-associated (such as via @samp{EQUIVALENCE}) +with a two-element @samp{REAL} array named @samp{R}, @samp{R(1)} +corresponds to the real element and @samp{R(2)} to the imaginary +element of the @samp{COMPLEX} variable. +No particular requirements as to precision of any of these are placed on +the implementation, nor is the relationship of storage sizes of these +types to the @samp{CHARACTER} type specified by the standard. -Special characters include: - -@itemize @bullet -@item -Semicolon (@samp{;}) +@code{g77} follows the above requirements, warning when compiling +a program requires placement of items in memory that contradict the +requirements of the target architecture. +(For example, a program can require placement of a @samp{DOUBLE PRECISION} +on a boundary that is not an even multiple of its size, but still an +even multiple of the size of a @samp{REAL} variable. +On some target architectures, using the canonical +mapping of Fortran types to underlying architectural types, such +placement is prohibited by the machine definition or +the Application Binary Interface (ABI) in force for +the configuration defined for building @code{gcc} and @code{g77}. +@code{g77} warns about such +situations when it encounters them.) -@item -Exclamation point (@samp{!}) +@code{g77} follows consistent rules for configuring the mapping between Fortran +types, including the @samp{*@var{n}} notation, and the underlying architectural +types as accessed by a similarly-configured applicable version of the +@code{gcc} compiler. +These rules offer a widely portable, consistent Fortran/C +environment, although they might well conflict with the expectations of +users of Fortran compilers designed and written for particular +architectures. -@item -Double quote (@samp{"}) +These rules are based on the configuration that is in force for the +version of @code{gcc} built in the same release as @code{g77} (and +which was therefore used to build both the @code{g77} compiler +components and the @code{libf2c} run-time library): -@item -Backslash (@samp{\}) +@table @code +@cindex REAL type +@cindex types, REAL +@item REAL +Same as @samp{float} type. -@item -Question mark (@samp{?}) +@cindex DOUBLE PRECISION type +@cindex types, DOUBLE PRECISION +@item DOUBLE PRECISION +Same as whatever floating-point type that is twice the size +of a @samp{float}---usually, this is a @samp{double}. -@item -Hash mark (@samp{#}) +@cindex INTEGER type +@cindex types, INTEGER +@item INTEGER +Same as an integral type that is occupies the same amount +of memory storage @samp{float}---usually, this is either +an @samp{int} or a @samp{long int}. + +@cindex LOGICAL type +@cindex types, LOGICAL +@item LOGICAL +Same @code{gcc} type as @samp{INTEGER}. + +@cindex COMPLEX type +@cindex types, COMPLEX +@item COMPLEX +Two @samp{REAL} scalars (one for the real part followed by +one for the imaginary part). -@item -Ampersand (@samp{&}) +@cindex DOUBLE COMPLEX type +@cindex types, DOUBLE COMPLEX +@item DOUBLE COMPLEX +Two @samp{DOUBLE PRECISION} scalars. -@item -Percent sign (@samp{%}) +@cindex *@var{n} notation +@item @var{numeric-type}*@var{n} +(Where @var{numeric-type} is any type other than @samp{CHARACTER}.) +Same as whatever @code{gcc} type occupies @var{n} times the storage +space of a @code{gcc} @samp{char} item. -@item -Underscore (@samp{_}) +@cindex KIND= notation +@item @var{numeric-type}(KIND=@var{n}) +@var{n}=1 corresponds to @samp{REAL}, @samp{INTEGER}, @samp{LOGICAL}, +@samp{COMPLEX}. +@var{n}=2 corresponds to @samp{DOUBLE PRECISION}, @samp{DOUBLE COMPLEX}, +and, for integral types, @samp{char} (usually @samp{INTEGER*1} +and @samp{LOGICAL*1}). +@var{n}=3 corresponds to @samp{short} for integral types +(usually @samp{INTEGER*2} and @samp{LOGICAL*2}). +@var{n}=4 corresponds to @samp{long long} for integral types +(this usually means @samp{INTEGER*8} and @samp{LOGICAL*8}). + +Note that these are proposed correspondences and might change +in future versions of @code{g77}---avoid writing code depending +on them. +@end table -@item -Open angle (@samp{<}) +Other types supported by @code{g77} +are derived from gcc types such as @samp{char}, @samp{short}, +@samp{int}, @samp{long int}, @samp{long long int}, @samp{long double}, +and so on. +That is, whatever types @samp{gcc} already supports, @code{g77} supports +now or probably will support in a future version. +The rules for the @samp{@var{numeric-type}*@var{n}} notation +apply to these types, +and new values for @samp{@var{numeric-type}(KIND=@var{n})} will be +assigned in a way that encourages clarity, consistency, and portability. -@item -Close angle (@samp{>}) +@node Constants +@section Constants +@cindex constants +@cindex types, constants -@item -The FORTRAN 77 special characters (@key{SPC}, @samp{=}, -@samp{+}, @samp{-}, @samp{*}, @samp{/}, @samp{(}, -@samp{)}, @samp{,}, @samp{.}, @samp{$}, @samp{'}, -and @samp{:}) -@end itemize +@code{g77} strictly assigns types to all constants not +documented as ``typeless'' (typeless constants including @samp{'1'Z}, +for example). +Context is never a determining factor for the type, and hence +the interpretation, of a typed constant. +Examples: @samp{1} is always type @samp{INTEGER}, +@samp{9.435784839284958} is always type @samp{REAL} (even if the +additional precision specified is lost, and even when used in a @samp{DOUBLE +PRECISION} context), @samp{1E0} is always type @samp{REAL}, and @samp{1D0} +is always type @samp{DOUBLE PRECISION}. -@cindex blanks (spaces) -Note that this document refers to @key{SPC} as @dfn{space}, -while X3.9-1978 FORTRAN 77 refers to it as @dfn{blank}. +Many other Fortran compilers attempt to assign types to typed constants +based on their context. +This results in hard-to-find bugs, nonportable +code, and is not in the spirit (though it strictly follows the letter) +of the 77 and 90 standards. +@code{g77} will not support these dangerous +semantics, but might offer, in a future release, explicit constructs by +which a wider variety of typeless constants may be specified, and/or +user-requested warnings indicating places where @code{g77} might differ +from how other compilers assign types to constants. -@node Lines -@subsection Lines -@cindex lines +@node Source Form +@section Source Form @cindex source file format @cindex source form @cindex files, source @@ -4148,3075 +3677,485 @@ while X3.9-1978 FORTRAN 77 refers to it as @dfn{blank}. @cindex fixed form @cindex free form -(Corresponds to Section 3.2 of ANSI X3.9-1978 FORTRAN 77.) +The @samp{-ffree-form} (aka @samp{-fno-fixed-form}) and @samp{-ffixed-form} +(aka @samp{-fno-free-form}) command-line options govern how the +source file is interpreted. +Fixed form +corresponds to classic ANSI FORTRAN 77 (plus popular extensions, such as +allowing tabs) and Fortran 90's fixed form. +Free form corresponds to +Fortran 90's free form (though possibly not entirely up-to-date, and +without complaining about some things that for which Fortran 90 requires +diagnostics, such as @samp{R = 3 . 1}). The way a Fortran compiler views source files depends entirely on the -implementation choices made for the compiler, since those choices -are explicitly left to the implementation by the published Fortran -standards. - -The GNU Fortran language mandates a view applicable to UNIX-like -text files---files that are made up of an arbitrary number of lines, -each with an arbitrary number of characters (sometimes called stream-based -files). - -This view does not apply to types of files that are specified as -having a particular number of characters on every single line (sometimes -referred to as record-based files). +implementation choices made for the compiler. +GNU Fortran currently tries to be somewhat like a few popular compilers +(@code{f2c}, DEC Fortran, and so on), though a cleaner default +definition along with more +flexibility offered by command-line options is likely to be offered +in version 0.6. -Because a ``line in a program unit is a sequence of 72 characters'', -to quote X3.9-1978, the GNU Fortran language specifies that a -stream-based text file is translated to GNU Fortran lines as follows: +Here are some facts regarding the way @code{g77} interprets source lines: @itemize @bullet +@cindex carriage returns @item -A newline in the file is the character that represents the end of -a line of text to the underlying system. -For example, on ASCII-based systems, a newline is the @key{NL} -character, which has ASCII value 12 (decimal). +Carriage returns (@samp{\r}) in source lines are ignored. +This is somewhat different from @code{f2c}, which seems to treat them as +spaces outside character/Hollerith constants, and encodes them as @samp{\r} +inside such constants. +@cindex tab characters @item -Each newline in the file serves to end the line of text that precedes -it (and that does not contain a newline). +A source line with a @key{TAB} character anywhere in it is treated as +entirely significant---however long it is---instead of ending in +column 72 (for fixed-form source) or 132 (for free-form source). +This also is different from @code{f2c}, which encodes tabs as +@samp{\t} (the ASCII @key{TAB} character) inside character +and Hollerith constants, but nevertheless seems to treat the column +position as if it had been affected by the canonical tab positioning. -@item -The end-of-file marker (@code{EOF}) also serves to end the line -of text that precedes it (and that does not contain a newline). +@code{g77} effectively +translates tabs to the appropriate number of spaces (a la the default +for the UNIX @code{expand} command) before doing any other processing, other +than (currently) noting whether a tab was found on a line and using this +info to decide how to interpret the length of the line and continued +constants. -@item -@cindex blanks (spaces) -Any line of text that is shorter than 72 characters is padded to that length -with spaces (called ``blanks'' in the standard). +Note that this default behavior probably will change for version 0.6, +when it will presumably be available via a command-line option. +The default as of version 0.6 is planned to be a ``pure visual'' +model, where tabs are immediately +converted to spaces and otherwise have no effect, so the way a typical +user sees source lines produces a consistent result no matter how the +spacing in those source lines is actually implemented via tabs, spaces, +and trailing tabs/spaces before newline. +Command-line options are likely to be added to specify whether all or +just-tabbed lines are to be extended to 132 or full input-line length, +and perhaps even an option will be added to specify the truncated-line +behavior to which some Digital compilers default (and which affects +the way continued character/Hollerith constants are interpreted). @item -Any line of text that is longer than 72 characters is truncated to that -length, but the truncated remainder must consist entirely of spaces. +Source lines shorter than the applicable fixed length are treated as +if they were padded with spaces to that length. -@item -Characters other than newline and the GNU Fortran character set -are invalid. -@end itemize +This affects only +continued character and Hollerith constants, and is a different +interpretation than provided by some other popular compilers +(although a bit more consistent with the traditional punched-card +basis of Fortran and the way the Fortran standard expressed fixed +source form). -For the purposes of the remainder of this description of the GNU -Fortran language, the translation described above has already -taken place, unless otherwise specified. +@code{g77} might someday offer an option to warn about cases where differences +might be seen as a result of this treatment, and perhaps an option to +specify the alternate behavior as well. -The result of the above translation is that the source file appears, -in terms of the remainder of this description of the GNU Fortran language, -as if it had an arbitrary -number of 72-character lines, each character being among the GNU Fortran -character set. +Note that this padding cannot apply to lines that are effectively of +infinite length---such lines are specified using command-line options +like @samp{-ffixed-line-length-none}, for example. +@end itemize -For example, if the source file itself has two newlines in a row, -the second newline becomes, after the above translation, a single -line containing 72 spaces. +@node Pedantic Compilation +@section Pedantic Compilation +@cindex pedantic compilation +@cindex compilation, pedantic -@node Continuation Line -@subsection Continuation Line -@cindex continuation lines, number of -@cindex lines, continuation -@cindex number of continuation lines -@cindex limits on continuation lines +The @samp{-fpedantic} command-line option specifies that @code{g77} +is to warn about certain non-standard constructs. +This is useful for finding +some extensions @code{g77} accepts that other compilers might not accept. +(Note that the @samp{-pedantic} and @samp{-pedantic-errors} options +always imply @samp{-fpedantic}.) -(Corresponds to Section 3.2.3 of ANSI X3.9-1978 FORTRAN 77.) +With @samp{-ff90} in force along with @samp{-fpedantic}, some constructs are +accepted that result in diagnostics when @samp{-fno-f90} and +@samp{-fpedantic} are both in force. +@xref{Extensions,,GNU Fortran Extensions}, for information on those constructs. -A continuation line is any line that both +The constructs for which @code{g77} issues diagnostics when @samp{-fpedantic} +and @samp{-fno-f90} are in force are: @itemize @bullet @item -Contains a continuation character, and +Automatic arrays, as in @samp{REAL A(N)}, where @samp{A} +is not a dummy argument. @item -Contains only spaces in columns 1 through 5 -@end itemize - -A continuation character is any character of the GNU Fortran character set -other than space (@key{SPC}) or zero (@samp{0}) -in column 6, or a digit (@samp{0} through @samp{9}) in column -7 through 72 of a line that has only spaces to the left of that -digit. - -The continuation character is ignored as far as the content of -the statement is concerned. - -The GNU Fortran language places no limit on the number of -continuation lines in a statement. -In practice, the limit depends on a variety of factors, such as -available memory, statement content, and so on, but no -GNU Fortran system may impose an arbitrary limit. - -@node Statements -@subsection Statements - -(Corresponds to Section 3.3 of ANSI X3.9-1978 FORTRAN 77.) - -Statements may be written using an arbitrary number of continuation -lines. - -Statements may be separated using the semicolon (@samp{;}), except -that the logical @code{IF} and non-construct @code{WHERE} statements -may not be separated from subsequent statements using only a semicolon -as statement separator. - -The @code{END PROGRAM}, @code{END SUBROUTINE}, @code{END FUNCTION}, -and @code{END BLOCK DATA} statements are alternatives to the @code{END} -statement. -These alternatives may be written as normal statements---they are not -subject to the restrictions of the @code{END} statement. - -However, no statement other than @code{END} may have an initial line -that appears to be an @code{END} statement---even @code{END PROGRAM}, -for example, must not be written as: +@samp{READ (5), I} and @samp{WRITE (10), J}---the standard disallows the +comma in each case, while allowing it in @samp{READ 10, I}, but many +compilers (including @code{f2c}) allow the superfluous comma. -@example - END - &PROGRAM -@end example - -@node Statement Labels -@subsection Statement Labels - -(Corresponds to Section 3.4 of ANSI X3.9-1978 FORTRAN 77.) - -A statement separated from its predecessor via a semicolon may be -labeled as follows: - -@itemize @bullet @item -The semicolon is followed by the label for the statement, -which in turn follows the label. +@samp{DOUBLE COMPLEX}, either explicitly (via explicit or @samp{IMPLICIT} +statement) or implicitly (as in @samp{C*D}, where @samp{C} is @samp{COMPLEX} +and @samp{D} is @samp{DOUBLE PRECISION}, which is prohibited by the +standard because it should produce a non-standard @samp{DOUBLE COMPLEX} +result). @item -The label must be no more than five digits in length. +Automatic conversion of numeric +expressions to @samp{INTEGER} in contexts such as: +@itemize -- @item -The first digit of the label for the statement is not -the first non-space character on a line. -Otherwise, that character is treated as a continuation -character. -@end itemize - -A statement may have only one label defined for it. - -@node Order -@subsection Order of Statements and Lines - -(Corresponds to Section 3.5 of ANSI X3.9-1978 FORTRAN 77.) - -Generally, @code{DATA} statements may precede executable statements. -However, specification statements pertaining to any entities -initialized by a @code{DATA} statement must precede that @code{DATA} -statement. -For example, -after @samp{DATA I/1/}, @samp{INTEGER I} is not permitted, but -@samp{INTEGER J} is permitted. - -The last line of a program unit may be an @code{END} statement, -or may be: - -@itemize @bullet +Array-reference indexes. @item -An @code{END PROGRAM} statement, if the program unit is a main program. - +Alternate-return values. @item -An @code{END SUBROUTINE} statement, if the program unit is a subroutine. - +Computed @samp{GOTO}. @item -An @code{END FUNCTION} statement, if the program unit is a function. - +@samp{FORMAT} run-time expressions (not yet supported). +@item +Dimension lists in specification statements. +@item +Numbers for I/O statements (such as @samp{READ (UNIT=3.2), I}) +@item +Sizes of @samp{CHARACTER} entities in specification statements. +@item +Kind types in specification entities (a Fortran 90 feature). @item -An @code{END BLOCK DATA} statement, if the program unit is a block data. +Initial, terminal, and incrementation parameters for implied-@samp{DO} +constructs in @samp{DATA} statements. @end itemize -@node INCLUDE -@subsection Including Source Text -@cindex INCLUDE - -Additional source text may be included in the processing of -the source file via the @code{INCLUDE} directive: - -@example -INCLUDE @var{filename} -@end example - -@noindent -The source text to be included is identified by @var{filename}, -which is a literal GNU Fortran character constant. -The meaning and interpretation of @var{filename} depends on the -implementation, but typically is a filename. - -(@code{g77} treats it as a filename that it searches for -in the current directory and/or directories specified -via the @samp{-I} command-line option.) - -The effect of the @code{INCLUDE} directive is as if the -included text directly replaced the directive in the source -file prior to interpretation of the program. -Included text may itself use @code{INCLUDE}. -The depth of nested @code{INCLUDE} references depends on -the implementation, but typically is a positive integer. - -This virtual replacement treats the statements and @code{INCLUDE} -directives in the included text as syntactically distinct from -those in the including text. - -Therefore, the first non-comment line of the included text -must not be a continuation line. -The included text must therefore have, after the non-comment -lines, either an initial line (statement), an @code{INCLUDE} -directive, or nothing (the end of the included text). - -Similarly, the including text may end the @code{INCLUDE} -directive with a semicolon or the end of the line, but it -cannot follow an @code{INCLUDE} directive at the end of its -line with a continuation line. -Thus, the last statement in an included text may not be -continued. - -Any statements between two @code{INCLUDE} directives on the -same line are treated as if they appeared in between the -respective included texts. -For example: - -@smallexample -INCLUDE 'A'; PRINT *, 'B'; INCLUDE 'C'; END PROGRAM -@end smallexample - -@noindent -If the text included by @samp{INCLUDE 'A'} constitutes -a @samp{PRINT *, 'A'} statement and the text included by -@samp{INCLUDE 'C'} constitutes a @samp{PRINT *, 'C'} statement, -then the output of the above sample program would be - -@example -A -B -C -@end example - -@noindent -(with suitable allowances for how an implementation defines -its handling of output). - -Included text must not include itself directly or indirectly, -regardless of whether the @var{filename} used to reference -the text is the same. - -Note that @code{INCLUDE} is @emph{not} a statement. -As such, it is neither a non-executable or executable -statement. -However, if the text it includes constitutes one or more -executable statements, then the placement of @code{INCLUDE} -is subject to effectively the same restrictions as those -on executable statements. - -An @code{INCLUDE} directive may be continued across multiple -lines as if it were a statement. -This permits long names to be used for @var{filename}. - -@node Data Types and Constants -@section Data Types and Constants - -(The following information augments or overrides the information in -Chapter 4 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 4 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -To more concisely express the appropriate types for -entities, this document uses the more concise -Fortran 90 nomenclature such as @code{INTEGER(KIND=1)} -instead of the more traditional, but less portably concise, -byte-size-based nomenclature such as @code{INTEGER*4}, -wherever reasonable. - -When referring to generic types---in contexts where the -specific precision and range of a type are not important---this -document uses the generic type names @code{INTEGER}, @code{LOGICAL}, -@code{REAL}, @code{COMPLEX}, and @code{CHARACTER}. - -In some cases, the context requires specification of a -particular type. -This document uses the @samp{KIND=} notation to accomplish -this throughout, sometimes supplying the more traditional -notation for clarification, though the traditional notation -might not work the same way on all GNU Fortran implementations. - -Use of @samp{KIND=} makes this document more concise because -@code{g77} is able to define values for @samp{KIND=} that -have the same meanings on all systems, due to the way the -Fortran 90 standard specifies these values are to be used. - -(In particular, that standard permits an implementation to -arbitrarily assign nonnegative values. -There are four distinct sets of assignments: one to the @code{CHARACTER} -type; one to the @code{INTEGER} type; one to the @code{LOGICAL} type; -and the fourth to both the @code{REAL} and @code{COMPLEX} types. -Implementations are free to assign these values in any order, -leave gaps in the ordering of assignments, and assign more than -one value to a representation.) - -This makes @samp{KIND=} values superior to the values used -in non-standard statements such as @samp{INTEGER*4}, because -the meanings of the values in those statements vary from machine -to machine, compiler to compiler, even operating system to -operating system. - -However, use of @samp{KIND=} is @emph{not} generally recommended -when writing portable code (unless, for example, the code is -going to be compiled only via @code{g77}, which is a widely -ported compiler). -GNU Fortran does not yet have adequate language constructs to -permit use of @samp{KIND=} in a fashion that would make the -code portable to Fortran 90 implementations; and, this construct -is known to @emph{not} be accepted by many popular FORTRAN 77 -implementations, so it cannot be used in code that is to be ported -to those. - -The distinction here is that this document is able to use -specific values for @samp{KIND=} to concisely document the -types of various operations and operands. - -A Fortran program should use the FORTRAN 77 designations for the -appropriate GNU Fortran types---such as @code{INTEGER} for -@code{INTEGER(KIND=1)}, @code{REAL} for @code{REAL(KIND=1)}, -and @code{DOUBLE COMPLEX} for @code{COMPLEX(KIND=2)}---and, -where no such designations exist, make use of appropriate -techniques (preprocessor macros, parameters, and so on) -to specify the types in a fashion that may be easily adjusted -to suit each particular implementation to which the program -is ported. -(These types generally won't need to be adjusted for ports of -@code{g77}.) - -Further details regarding GNU Fortran data types and constants -are provided below. - -@menu -* Types:: -* Constants:: -* Integer Type:: -* Character Type:: -@end menu - -@node Types -@subsection Data Types - -(Corresponds to Section 4.1 of ANSI X3.9-1978 FORTRAN 77.) - -GNU Fortran supports these types: - -@enumerate @item -Integer (generic type @code{INTEGER}) +Automatic conversion of @samp{LOGICAL} expressions to @samp{INTEGER} +in contexts such as arithmetic @samp{IF} (where @samp{COMPLEX} +expressions are disallowed anyway). @item -Real (generic type @code{REAL}) +Substring operators applied to character constants and named +constants (such as @samp{PRINT *,'hello'(3:5)}, which would print @samp{llo}). @item -Double precision +Null argument passed to statement function (as in @samp{PRINT *,FOO(,3)}). @item -Complex (generic type @code{COMPLEX}) +Differences between program units regarding whether a given @samp{COMMON} +area is @samp{SAVE}d (for targets where program units in a single source +file are ``glued'' together as they typically are for UNIX development +environments). @item -Logical (generic type @code{LOGICAL}) +Differences between named-@samp{COMMON}-block sizes between program units. @item -Character (generic type @code{CHARACTER}) +Specification statements following first @samp{DATA} statement (normally +@samp{DATA I/1/} may be followed by @samp{INTEGER J}, though not +@samp{INTEGER I}, but @samp{-fpedantic} disables use of both cases. @item -Double Complex -@end enumerate - -(The types numbered 1 through 6 above are standard FORTRAN 77 types.) - -The generic types shown above are referred to in this document -using only their generic type names. -Such references usually indicate that any specific type (kind) -of that generic type is valid. - -For example, a context described in this document as accepting -the @code{COMPLEX} type also is likely to accept the -@code{DOUBLE COMPLEX} type. - -The GNU Fortran language supports three ways to specify -a specific kind of a generic type. - -@menu -* Double Notation:: As in @code{DOUBLE COMPLEX}. -* Star Notation:: As in @code{INTEGER*4}. -* Kind Notation:: As in @code{INTEGER(KIND=1)}. -@end menu - -@node Double Notation -@subsubsection Double Notation +Semicolon as statement separator (as in @samp{CALL FOO; CALL BAR}). +@c +@c @item +@c Comma before list of I/O items in @samp{WRITE} +@c @c, @samp{ENCODE}, @samp{DECODE}, and @samp{REWRITE} +@c statements, as with @samp{READ} (as explained above). -The GNU Fortran language supports two uses of the keyword -@code{DOUBLE} to specify a specific kind of type: +@item +Use of @samp{&} in column 1 of fixed-form source (indicates continuation). -@itemize @bullet @item -@code{DOUBLE PRECISION}, equivalent to @code{REAL(KIND=2)} +Use of @samp{CHARACTER} constants to initialize numeric entities, and vice +versa. @item -@code{DOUBLE COMPLEX}, equivalent to @code{COMPLEX(KIND=2)} +Expressions having two arithmetic operators in a row, such +as @samp{X*-Y}. @end itemize -Use one of the above forms where a type name is valid. - -While use of this notation is popular, it doesn't scale -well in a language or dialect rich in intrinsic types, -as is the case for the GNU Fortran language (especially -planned future versions of it). - -After all, one rarely sees type names such as @samp{DOUBLE INTEGER}, -@samp{QUADRUPLE REAL}, or @samp{QUARTER INTEGER}. -Instead, @code{INTEGER*8}, @code{REAL*16}, and @code{INTEGER*1} -often are substituted for these, respectively, even though they -do not always have the same meanings on all systems. -(And, the fact that @samp{DOUBLE REAL} does not exist as such -is an inconsistency.) +If @samp{-fpedantic} is specified along with @samp{-ff90}, the +following constructs result in diagnostics: -Therefore, this document uses ``double notation'' only on occasion -for the benefit of those readers who are accustomed to it. +@itemize @bullet +@item +Use of semicolons on line with INCLUDE statement. +@end itemize -@node Star Notation -@subsubsection Star Notation -@cindex *@var{n} notation +@node Case Sensitivity +@section Case Sensitivity +@cindex case sensitivity +@cindex source file format +@cindex code, source +@cindex source code +@cindex uppercase letters +@cindex lowercase letters +@cindex letters, uppercase +@cindex letters, lowercase -The following notation specifies the storage size for a type: - -@example -@var{generic-type}*@var{n} -@end example - -@noindent -@var{generic-type} must be a generic type---one of -@code{INTEGER}, @code{REAL}, @code{COMPLEX}, @code{LOGICAL}, -or @code{CHARACTER}. -@var{n} must be one or more digits comprising a decimal -integer number greater than zero. - -Use the above form where a type name is valid. - -The @samp{*@var{n}} notation specifies that the amount of storage -occupied by variables and array elements of that type is @var{n} -times the storage occupied by a @code{CHARACTER*1} variable. - -This notation might indicate a different degree of precision and/or -range for such variables and array elements, and the functions that -return values of types using this notation. -It does not limit the precision or range of values of that type -in any particular way---use explicit code to do that. - -Further, the GNU Fortran language requires no particular values -for @var{n} to be supported by an implementation via the @samp{*@var{n}} -notation. -@code{g77} supports @code{INTEGER*1} (as @code{INTEGER(KIND=3)}) -on all systems, for example, -but not all implementations are required to do so, and @code{g77} -is known to not support @code{REAL*1} on most (or all) systems. - -As a result, except for @var{generic-type} of @code{CHARACTER}, -uses of this notation should be limited to isolated -portions of a program that are intended to handle system-specific -tasks and are expected to be non-portable. - -(Standard FORTRAN 77 supports the @samp{*@var{n}} notation for -only @code{CHARACTER}, where it signifies not only the amount -of storage occupied, but the number of characters in entities -of that type. -However, almost all Fortran compilers have supported this -notation for generic types, though with a variety of meanings -for @var{n}.) - -Specifications of types using the @samp{*@var{n}} notation -always are interpreted as specifications of the appropriate -types described in this document using the @samp{KIND=@var{n}} -notation, described below. - -While use of this notation is popular, it doesn't serve well -in the context of a widely portable dialect of Fortran, such as -the GNU Fortran language. - -For example, even on one particular machine, two or more popular -Fortran compilers might well disagree on the size of a type -declared @code{INTEGER*2} or @code{REAL*16}. -Certainly there -is known to be disagreement over such things among Fortran -compilers on @emph{different} systems. - -Further, this notation offers no elegant way to specify sizes -that are not even multiples of the ``byte size'' typically -designated by @code{INTEGER*1}. -Use of ``absurd'' values (such as @code{INTEGER*1000}) would -certainly be possible, but would perhaps be stretching the original -intent of this notation beyond the breaking point in terms -of widespread readability of documentation and code making use -of it. - -Therefore, this document uses ``star notation'' only on occasion -for the benefit of those readers who are accustomed to it. - -@node Kind Notation -@subsubsection Kind Notation -@cindex KIND= notation - -The following notation specifies the kind-type selector of a type: - -@example -@var{generic-type}(KIND=@var{n}) -@end example - -@noindent -Use the above form where a type name is valid. - -@var{generic-type} must be a generic type---one of -@code{INTEGER}, @code{REAL}, @code{COMPLEX}, @code{LOGICAL}, -or @code{CHARACTER}. -@var{n} must be an integer initialization expression that -is a positive, nonzero value. - -Programmers are discouraged from writing these values directly -into their code. -Future versions of the GNU Fortran language will offer -facilities that will make the writing of code portable -to @code{g77} @emph{and} Fortran 90 implementations simpler. +GNU Fortran offers the programmer way too much flexibility in deciding +how source files are to be treated vis-a-vis uppercase and lowercase +characters. +There are 66 useful settings that affect case sensitivity, plus 10 +settings that are nearly useless, with the remaining 116 settings +being either redundant or useless. -However, writing code that ports to existing FORTRAN 77 -implementations depends on avoiding the @samp{KIND=} construct. +None of these settings have any effect on the contents of comments +(the text after a @samp{c} or @samp{C} in Column 1, for example) +or of character or Hollerith constants. +Note that things like the @samp{E} in the statement +@samp{CALL FOO(3.2E10)} and the @samp{TO} in @samp{ASSIGN 10 TO LAB} +are considered built-in keywords. -The @samp{KIND=} construct is thus useful in the context -of GNU Fortran for two reasons: +Low-level switches are identified in this discussion thusly: -@itemize @bullet -@item -It provides a means to specify a type in a fashion that -is portable across all GNU Fortran implementations (though -not other FORTRAN 77 and Fortran 90 implementations). +@itemize @w{} +@item A +Source Case Conversion: -@item -It provides a sort of Rosetta stone for this document to use -to concisely describe the types of various operations and -operands. +@itemize @w{} +@item 0 +Preserve (see Note 1) +@item 1 +Convert to Upper Case +@item 2 +Convert to Lower Case @end itemize -The values of @var{n} in the GNU Fortran language are -assigned using a scheme that: - -@itemize @bullet -@item -Attempts to maximize the ability of readers -of this document to quickly familiarize themselves -with assignments for popular types - -@item -Provides a unique value for each specific desired -meaning - -@item -Provides a means to automatically assign new values so -they have a ``natural'' relationship to existing values, -if appropriate, or, if no such relationship exists, will -not interfere with future values assigned on the basis -of such relationships +@item B +Built-in Keyword Matching: -@item -Avoids using values that are similar to values used -in the existing, popular @samp{*@var{n}} notation, -to prevent readers from expecting that these implied -correspondences work on all GNU Fortran implementations +@itemize @w{} +@item 0 +Match Any Case (per-character basis) +@item 1 +Match Upper Case Only +@item 2 +Match Lower Case Only +@item 3 +Match InitialCaps Only (see tables for spellings) @end itemize -The assignment system accomplishes this by assigning -to each ``fundamental meaning'' of a specific type a -unique prime number. -Combinations of fundamental meanings---for example, a type -that is two times the size of some other type---are assigned -values of @var{n} that are the products of the values for -those fundamental meanings. - -A prime value of @var{n} is never given more than one fundamental -meaning, to avoid situations where some code or system -cannot reasonably provide those meanings in the form of a -single type. - -The values of @var{n} assigned so far are: - -@table @code -@item KIND=0 -This is valid only as @code{INTEGER(KIND=0)} and -denotes the @code{INTEGER} type that has the smallest -storage size that holds a pointer on the system. - -A pointer representable by this type is capable of uniquely -addressing a @code{CHARACTER*1} variable, array, array element, -or substring. - -(Typically this is equivalent to @code{INTEGER*4} or, -on 64-bit systems, @code{INTEGER*8}. -In a compatible C implementation, it typically would -be the same size and semantics of the C type @code{void *}.) - -@item KIND=1 -This corresponds to the default types for -@code{REAL}, @code{INTEGER}, @code{LOGICAL}, @code{COMPLEX}, -and @code{CHARACTER}, as appropriate. - -These are the ``default'' types described in the Fortran 90 standard, -though that standard does not assign any particular @samp{KIND=} -value to these types. - -(Typically, these are @code{REAL*4}, @code{INTEGER*4}, -@code{LOGICAL*4}, and @code{COMPLEX*8}.) - -@item KIND=2 -This corresponds to types that occupy twice as much -storage as the default types. -@code{REAL(KIND=2)} is @code{DOUBLE PRECISION} (typically @code{REAL*8}), -@code{COMPLEX(KIND=2)} is @code{DOUBLE COMPLEX} (typically @code{COMPLEX*16}), - -These are the ``double precision'' types described in the Fortran 90 -standard, -though that standard does not assign any particular @samp{KIND=} -value to these types. - -@var{n} of 4 thus corresponds to types that occupy four times -as much storage as the default types, @var{n} of 8 to types that -occupy eight times as much storage, and so on. - -The @code{INTEGER(KIND=2)} and @code{LOGICAL(KIND=2)} types -are not necessarily supported by every GNU Fortran implementation. - -@item KIND=3 -This corresponds to types that occupy as much -storage as the default @code{CHARACTER} type, -which is the same effective type as @code{CHARACTER(KIND=1)} -(making that type effectively the same as @code{CHARACTER(KIND=3)}). - -(Typically, these are @code{INTEGER*1} and @code{LOGICAL*1}.) - -@var{n} of 6 thus corresponds to types that occupy twice as -much storage as the @var{n}=3 types, @var{n} of 12 to types -that occupy four times as much storage, and so on. - -These are not necessarily supported by every GNU Fortran -implementation. - -@item KIND=5 -This corresponds to types that occupy half the -storage as the default (@var{n}=1) types. - -(Typically, these are @code{INTEGER*2} and @code{LOGICAL*2}.) - -@var{n} of 25 thus corresponds to types that occupy one-quarter -as much storage as the default types. - -These are not necessarily supported by every GNU Fortran -implementation. -@end table - -Note that these are @emph{proposed} correspondences and might change -in future versions of @code{g77}---avoid writing code depending -on them while @code{g77}, and therefore the GNU Fortran language -it defines, is in beta testing. - -Values not specified in the above list are reserved to -future versions of the GNU Fortran language. - -Implementation-dependent meanings will be assigned new, -unique prime numbers so as to not interfere with other -implementation-dependent meanings, and offer the possibility -of increasing the portability of code depending on such -types by offering support for them in other GNU Fortran -implementations. - -Other meanings that might be given unique values are: - -@itemize @bullet -@item -Types that make use of only half their storage size for -representing precision and range. - -For example, some compilers offer options that cause -@code{INTEGER} types to occupy the amount of storage -that would be needed for @code{INTEGER(KIND=2)} types, but the -range remains that of @code{INTEGER(KIND=1)}. - -@item -The IEEE single floating-point type. +@item C +Built-in Intrinsic Matching: -@item -Types with a specific bit pattern (endianness), such as the -little-endian form of @code{INTEGER(KIND=1)}. -These could permit, conceptually, use of portable code and -implementations on data files written by existing systems. +@itemize @w{} +@item 0 +Match Any Case (per-character basis) +@item 1 +Match Upper Case Only +@item 2 +Match Lower Case Only +@item 3 +Match InitialCaps Only (see tables for spellings) @end itemize -Future @emph{prime} numbers should be given meanings in as incremental -a fashion as possible, to allow for flexibility and -expressiveness in combining types. - -For example, instead of defining a prime number for little-endian -IEEE doubles, one prime number might be assigned the meaning -``little-endian'', another the meaning ``IEEE double'', and the -value of @var{n} for a little-endian IEEE double would thus -naturally be the product of those two respective assigned values. -(It could even be reasonable to have IEEE values result from the -products of prime values denoting exponent and fraction sizes -and meanings, hidden bit usage, availability and representations -of special values such as subnormals, infinities, and Not-A-Numbers -(NaNs), and so on.) - -This assignment mechanism, while not inherently required for -future versions of the GNU Fortran language, is worth using -because it could ease management of the ``space'' of supported -types much easier in the long run. - -The above approach suggests a mechanism for specifying inheritance -of intrinsic (built-in) types for an entire, widely portable -product line. -It is certainly reasonable that, unlike programmers of other languages -offering inheritance mechanisms that employ verbose names for classes -and subclasses, along with graphical browsers to elucidate the -relationships, Fortran programmers would employ -a mechanism that works by multiplying prime numbers together -and finding the prime factors of such products. - -Most of the advantages for the above scheme have been explained -above. -One disadvantage is that it could lead to the defining, -by the GNU Fortran language, of some fairly large prime numbers. -This could lead to the GNU Fortran language being declared -``munitions'' by the United States Department of Defense. - -@node Constants -@subsection Constants -@cindex constants -@cindex types, constants - -(Corresponds to Section 4.2 of ANSI X3.9-1978 FORTRAN 77.) - -A @dfn{typeless constant} has one of the following forms: - -@example -'@var{binary-digits}'B -'@var{octal-digits}'O -'@var{hexadecimal-digits}'Z -'@var{hexadecimal-digits}'X -@end example - -@noindent -@var{binary-digits}, @var{octal-digits}, and @var{hexadecimal-digits} -are nonempty strings of characters in the set @samp{01}, @samp{01234567}, -and @samp{0123456789ABCDEFabcdef}, respectively. -(The value for @samp{A} (and @samp{a}) is 10, for @samp{B} and @samp{b} -is 11, and so on.) - -Typeless constants have values that depend on the context in which -they are used. - -All other constants, called @dfn{typed constants}, are interpreted---converted -to internal form---according to their inherent type. -Thus, context is @emph{never} a determining factor for the type, and hence -the interpretation, of a typed constant. -(All constants in the ANSI FORTRAN 77 language are typed constants.) - -For example, @samp{1} is always type @code{INTEGER(KIND=1)} in GNU -Fortran (called default INTEGER in Fortran 90), -@samp{9.435784839284958} is always type @code{REAL(KIND=1)} (even if the -additional precision specified is lost, and even when used in a -@code{REAL(KIND=2)} context), @samp{1E0} is always type @code{REAL(KIND=2)}, -and @samp{1D0} is always type @code{REAL(KIND=2)}. - -@node Integer Type -@subsection Integer Type - -(Corresponds to Section 4.3 of ANSI X3.9-1978 FORTRAN 77.) - -An integer constant also may have one of the following forms: - -@example -B'@var{binary-digits}' -O'@var{octal-digits}' -Z'@var{hexadecimal-digits}' -X'@var{hexadecimal-digits}' -@end example - -@noindent -@var{binary-digits}, @var{octal-digits}, and @var{hexadecimal-digits} -are nonempty strings of characters in the set @samp{01}, @samp{01234567}, -and @samp{0123456789ABCDEFabcdef}, respectively. -(The value for @samp{A} (and @samp{a}) is 10, for @samp{B} and @samp{b} -is 11, and so on.) - -@node Character Type -@subsection Character Type - -(Corresponds to Section 4.8 of ANSI X3.9-1978 FORTRAN 77.) - -A character constant may be delimited by a pair of double quotes -(@samp{"}) instead of apostrophes. -In this case, an apostrophe within the constant represents -a single apostrophe, while a double quote is represented in -the source text of the constant by two consecutive double -quotes with no intervening blanks. - -@cindex zero-length CHARACTER -@cindex null CHARACTER strings -@cindex empty CHARACTER strings -@cindex strings, empty -@cindex CHARACTER, null -A character constant may be empty (have a length of zero). - -A character constant may include a substring specification, -The value of such a constant is the value of the substring---for -example, the value of @samp{'hello'(3:5)} is the same -as the value of @samp{'llo'}. - -@node Expressions -@section Expressions - -(The following information augments or overrides the information in -Chapter 6 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 6 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -@menu -* %LOC():: -@end menu - -@node %LOC() -@subsection The @code{%LOC()} Construct -@cindex %LOC() construct - -@example -%LOC(@var{arg}) -@end example - -The @code{%LOC()} construct is an expression -that yields the value of the location of its argument, -@var{arg}, in memory. -The size of the type of the expression depends on the system---typically, -it is equivalent to either @code{INTEGER(KIND=1)} or @code{INTEGER(KIND=2)}, -though it is actually type @code{INTEGER(KIND=0)}. - -The argument to @code{%LOC()} must be suitable as the -left-hand side of an assignment statement. -That is, it may not be a general expression involving -operators such as addition, subtraction, and so on, -nor may it be a constant. - -Use of @code{%LOC()} is recommended only for code that -is accessing facilities outside of GNU Fortran, such as -operating system or windowing facilities. -It is best to constrain such uses to isolated portions of -a program---portions that deal specifically and exclusively -with low-level, system-dependent facilities. -Such portions might well provide a portable interface for -use by the program as a whole, but are themselves not -portable, and should be thoroughly tested each time they -are rebuilt using a new compiler or version of a compiler. - -Do not depend on @code{%LOC()} returning a pointer that -can be safely used to @emph{define} (change) the argument. -While this might work in some circumstances, it is hard -to predict whether it will continue to work when a program -(that works using this unsafe behavior) -is recompiled using different command-line options or -a different version of @code{g77}. - -Generally, @code{%LOC()} is safe when used as an argument -to a procedure that makes use of the value of the corresponding -dummy argument only during its activation, and only when -such use is restricted to referencing (reading) the value -of the argument to @code{%LOC()}. - -@emph{Implementation Note:} Currently, @code{g77} passes -arguments (those not passed using a construct such as @code{%VAL()}) -by reference or descriptor, depending on the type of -the actual argument. -Thus, given @samp{INTEGER I}, @samp{CALL FOO(I)} would -seem to mean the same thing as @samp{CALL FOO(%LOC(I))}, and -in fact might compile to identical code. - -However, @samp{CALL FOO(%LOC(I))} emphatically means ``pass the -address of @samp{I} in memory''. -While @samp{CALL FOO(I)} might use that same approach in a -particular version of @code{g77}, another version or compiler -might choose a different implementation, such as copy-in/copy-out, -to effect the desired behavior---and which will therefore not -necessarily compile to the same code as would @samp{CALL FOO(%LOC(I))} -using the same version or compiler. - -@xref{Debugging and Interfacing}, for detailed information on -how this particular version of @code{g77} implements various -constructs. - -@node Specification Statements -@section Specification Statements - -(The following information augments or overrides the information in -Chapter 8 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 8 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -@menu -* NAMELIST:: -* DOUBLE COMPLEX:: -@end menu - -@node NAMELIST -@subsection @code{NAMELIST} Statement -@cindex NAMELIST statement -@cindex statements, NAMELIST - -The @code{NAMELIST} statement, and related I/O constructs, are -supported by the GNU Fortran language in essentially the same -way as they are by @code{f2c}. - -@node DOUBLE COMPLEX -@subsection @code{DOUBLE COMPLEX} Statement -@cindex DOUBLE COMPLEX - -@code{DOUBLE COMPLEX} is a type-statement (and type) that -specifies the type @code{COMPLEX(KIND=2)} in GNU Fortran. - -@node Control Statements -@section Control Statements - -(The following information augments or overrides the information in -Chapter 11 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 11 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -@menu -* DO WHILE:: -* END DO:: -* Construct Names:: -* CYCLE and EXIT:: -@end menu +@item D +User-defined Symbol Possibilities (warnings only): -@node DO WHILE -@subsection DO WHILE -@cindex DO WHILE -@cindex MIL-STD 1753 +@itemize @w{} +@item 0 +Allow Any Case (per-character basis) +@item 1 +Allow Upper Case Only +@item 2 +Allow Lower Case Only +@item 3 +Allow InitialCaps Only (see Note 2) +@end itemize +@end itemize -The @code{DO WHILE} statement, a feature of both the MIL-STD 1753 and -Fortran 90 standards, is provided by the GNU Fortran language. +Note 1: @code{g77} eventually will support @samp{NAMELIST} in a manner that is +consistent with these source switches---in the sense that input will be +expected to meet the same requirements as source code in terms +of matching symbol names and keywords (for the exponent letters). -@node END DO -@subsection END DO -@cindex END DO -@cindex MIL-STD 1753 +Currently, however, @samp{NAMELIST} is supported @samp{libf2c}, +which uppercases @samp{NAMELIST} input and symbol names for matching. +This means not only that @samp{NAMELIST} output currently shows symbol +(and keyword) names in uppercase even if lower-case source +conversion (option A2) is selected, but that @samp{NAMELIST} cannot be +adequately supported when source case preservation (option A0) +is selected. -The @code{END DO} statement is provided by the GNU Fortran language. +If A0 is selected, a warning message will be +output for each @samp{NAMELIST} statement to this effect. +The behavior +of the program is undefined at run time if two or more symbol names +appear in a given @samp{NAMELIST} such that the names are identical +when converted to upper case (e.g. @samp{NAMELIST /X/ VAR, Var, var}). +For complete and total elegance, perhaps there should be a warning +when option A2 is selected, since the output of NAMELIST is currently +in uppercase but will someday be lowercase (when a @samp{libg77} is written), +but that seems to be overkill for a product in beta test. -This statement is used in one of two ways: +Note 2: Rules for InitialCaps names are: -@itemize @bullet +@itemize -- @item -The Fortran 90 meaning, in which it specifies the termination -point of a single @code{DO} loop started with a @code{DO} statement -that specifies no termination label. - +Must be a single uppercase letter, @strong{or} @item -The MIL-STD 1753 meaning, in which it specifies the termination -point of one or more @code{DO} loops, all of which start with a -@code{DO} statement that specify the label defined for the -@code{END DO} statement. - -This kind of @code{END DO} statement is merely a synonym for -@code{CONTINUE}, except it is permitted only when the statement -is labeled and a target of one or more labeled @code{DO} loops. - -It is expected that this use of @code{END DO} will be removed from -the GNU Fortran language in the future, though it is likely that -it will long be supported by @code{g77} as a dialect form. +Must start with an uppercase letter and contain at least one +lowercase letter. @end itemize -@node Construct Names -@subsection Construct Names -@cindex construct names - -The GNU Fortran language supports construct names as defined -by the Fortran 90 standard. -These names are local to the program unit and are defined -as follows: - -@example -@var{construct-name}: @var{block-statement} -@end example - -@noindent -Here, @var{construct-name} is the construct name itself; -its definition is connoted by the single colon (@samp{:}); and -@var{block-statement} is an @code{IF}, @code{DO}, -or @code{SELECT CASE} statement that begins a block. - -A block that is given a construct name must also specify the -same construct name in its termination statement: - -@example -END @var{block} @var{construct-name} -@end example - -@noindent -Here, @var{block} must be @code{IF}, @code{DO}, or @code{SELECT}, -as appropriate. - -@node CYCLE and EXIT -@subsection The @code{CYCLE} and @code{EXIT} Statements - -The @code{CYCLE} and @code{EXIT} statements specify that -the remaining statements in the current iteration of a -particular active (enclosing) @code{DO} loop are to be skipped. - -@code{CYCLE} specifies that these statements are skipped, -but the @code{END DO} statement that marks the end of the -@code{DO} loop be executed---that is, the next iteration, -if any, is to be started. -If the statement marking the end of the @code{DO} loop is -not @code{END DO}---in other words, if the loop is not -a block @code{DO}---the @code{CYCLE} statement does not -execute that statement, but does start the next iteration (if any). - -@code{EXIT} specifies that the loop specified by the -@code{DO} construct is terminated. - -The @code{DO} loop affected by @code{CYCLE} and @code{EXIT} -is the innermost enclosing @code{DO} loop when the following -forms are used: - -@example -CYCLE -EXIT -@end example - -Otherwise, the following forms specify the construct name -of the pertinent @code{DO} loop: - -@example -CYCLE @var{construct-name} -EXIT @var{construct-name} -@end example +So @samp{A}, @samp{Ab}, @samp{ABc}, @samp{AbC}, and @samp{Abc} are +valid InitialCaps names, but @samp{AB}, @samp{A2}, and @samp{ABC} are +not. +Note that most, but not all, built-in names meet these +requirements---the exceptions are some of the two-letter format +specifiers, such as @samp{BN} and @samp{BZ}. -@code{CYCLE} and @code{EXIT} can be viewed as glorified @code{GO TO} -statements. -However, they cannot be easily thought of as @code{GO TO} statements -in obscure cases involving FORTRAN 77 loops. -For example: +Here are the names of the corresponding command-line options: @smallexample - DO 10 I = 1, 5 - DO 10 J = 1, 5 - IF (J .EQ. 5) EXIT - DO 10 K = 1, 5 - IF (K .EQ. 3) CYCLE -10 PRINT *, 'I=', I, ' J=', J, ' K=', K -20 CONTINUE -@end smallexample +A0: -fsource-case-preserve +A1: -fsource-case-upper +A2: -fsource-case-lower -@noindent -In particular, neither the @code{EXIT} nor @code{CYCLE} statements -above are equivalent to a @code{GO TO} statement to either label -@samp{10} or @samp{20}. +B0: -fmatch-case-any +B1: -fmatch-case-upper +B2: -fmatch-case-lower +B3: -fmatch-case-initcap -To understand the effect of @code{CYCLE} and @code{EXIT} in the -above fragment, it is helpful to first translate it to its equivalent -using only block @code{DO} loops: +C0: -fintrin-case-any +C1: -fintrin-case-upper +C2: -fintrin-case-lower +C3: -fintrin-case-initcap -@smallexample - DO I = 1, 5 - DO J = 1, 5 - IF (J .EQ. 5) EXIT - DO K = 1, 5 - IF (K .EQ. 3) CYCLE -10 PRINT *, 'I=', I, ' J=', J, ' K=', K - END DO - END DO - END DO -20 CONTINUE +D0: -fsymbol-case-any +D1: -fsymbol-case-upper +D2: -fsymbol-case-lower +D3: -fsymbol-case-initcap @end smallexample -Adding new labels allows translation of @code{CYCLE} and @code{EXIT} -to @code{GO TO} so they may be more easily understood by programmers -accustomed to FORTRAN coding: +Useful combinations of the above settings, along with abbreviated +option names that set some of these combinations all at once: @smallexample - DO I = 1, 5 - DO J = 1, 5 - IF (J .EQ. 5) GOTO 18 - DO K = 1, 5 - IF (K .EQ. 3) GO TO 12 -10 PRINT *, 'I=', I, ' J=', J, ' K=', K -12 END DO - END DO -18 END DO -20 CONTINUE -@end smallexample - -@noindent -Thus, the @code{CYCLE} statement in the innermost loop skips over -the @code{PRINT} statement as it begins the next iteration of the -loop, while the @code{EXIT} statement in the middle loop ends that -loop but @emph{not} the outermost loop. - -@node Functions and Subroutines -@section Functions and Subroutines - -(The following information augments or overrides the information in -Chapter 15 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 15 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -@menu -* %VAL():: -* %REF():: -* %DESCR():: -* Generics and Specifics:: -* REAL() and AIMAG() of Complex:: -* CMPLX() of DOUBLE PRECISION:: -* MIL-STD 1753:: -* f77/f2c Intrinsics:: -* Table of Intrinsic Functions:: -@end menu - -@node %VAL() -@subsection The @code{%VAL()} Construct -@cindex %VAL() construct - -@example -%VAL(@var{arg}) -@end example - -The @code{%VAL()} construct specifies that an argument, -@var{arg}, is to be passed by value, instead of by reference -or descriptor. - -@code{%VAL()} is restricted to actual arguments in -invocations of external procedures. - -Use of @code{%VAL()} is recommended only for code that -is accessing facilities outside of GNU Fortran, such as -operating system or windowing facilities. -It is best to constrain such uses to isolated portions of -a program---portions the deal specifically and exclusively -with low-level, system-dependent facilities. -Such portions might well provide a portable interface for -use by the program as a whole, but are themselves not -portable, and should be thoroughly tested each time they -are rebuilt using a new compiler or version of a compiler. - -@emph{Implementation Note:} Currently, @code{g77} passes -all arguments either by reference or by descriptor. - -Thus, use of @code{%VAL()} tends to be restricted to cases -where the called procedure is written in a language other -than Fortran that supports call-by-value semantics. -(C is an example of such a language.) - -@xref{Procedures,,Procedures (SUBROUTINE and FUNCTION)}, -for detailed information on -how this particular version of @code{g77} passes arguments -to procedures. - -@node %REF() -@subsection The @code{%REF()} Construct -@cindex %REF() construct - -@example -%REF(@var{arg}) -@end example - -The @code{%REF()} construct specifies that an argument, -@var{arg}, is to be passed by reference, instead of by -value or descriptor. - -@code{%REF()} is restricted to actual arguments in -invocations of external procedures. - -Use of @code{%REF()} is recommended only for code that -is accessing facilities outside of GNU Fortran, such as -operating system or windowing facilities. -It is best to constrain such uses to isolated portions of -a program---portions the deal specifically and exclusively -with low-level, system-dependent facilities. -Such portions might well provide a portable interface for -use by the program as a whole, but are themselves not -portable, and should be thoroughly tested each time they -are rebuilt using a new compiler or version of a compiler. - -Do not depend on @code{%REF()} supplying a pointer to the -procedure being invoked. -While that is a likely implementation choice, other -implementation choices are available that preserve Fortran -pass-by-reference semantics without passing a pointer to -the argument, @var{arg}. -(For example, a copy-in/copy-out implementation.) - -@emph{Implementation Note:} Currently, @code{g77} passes -all arguments -(other than variables and arrays of type @code{CHARACTER}) -by reference. -Future versions of, or dialects supported by, @code{g77} might -not pass @code{CHARACTER} functions by reference. - -Thus, use of @code{%REF()} tends to be restricted to cases -where @var{arg} is type @code{CHARACTER} but the called -procedure accesses it via a means other than the method -used for Fortran @code{CHARACTER} arguments. - -@xref{Procedures,,Procedures (SUBROUTINE and FUNCTION)}, for detailed information on -how this particular version of @code{g77} passes arguments -to procedures. - -@node %DESCR() -@subsection The @code{%DESCR()} Construct -@cindex %DESCR() construct - -@example -%DESCR(@var{arg}) -@end example - -The @code{%DESCR()} construct specifies that an argument, -@var{arg}, is to be passed by descriptor, instead of by -value or reference. - -@code{%DESCR()} is restricted to actual arguments in -invocations of external procedures. - -Use of @code{%DESCR()} is recommended only for code that -is accessing facilities outside of GNU Fortran, such as -operating system or windowing facilities. -It is best to constrain such uses to isolated portions of -a program---portions the deal specifically and exclusively -with low-level, system-dependent facilities. -Such portions might well provide a portable interface for -use by the program as a whole, but are themselves not -portable, and should be thoroughly tested each time they -are rebuilt using a new compiler or version of a compiler. - -Do not depend on @code{%DESCR()} supplying a pointer -and/or a length passed by value -to the procedure being invoked. -While that is a likely implementation choice, other -implementation choices are available that preserve the -pass-by-reference semantics without passing a pointer to -the argument, @var{arg}. -(For example, a copy-in/copy-out implementation.)@ -And, future versions of @code{g77} might change the -way descriptors are implemented, such as passing a -single argument pointing to a record containing the -pointer/length information instead of passing that same -information via two arguments as it currently does. - -@emph{Implementation Note:} Currently, @code{g77} passes -all variables and arrays of type @code{CHARACTER} -by descriptor. -Future versions of, or dialects supported by, @code{g77} might -pass @code{CHARACTER} functions by descriptor as well. - -Thus, use of @code{%DESCR()} tends to be restricted to cases -where @var{arg} is not type @code{CHARACTER} but the called -procedure accesses it via a means similar to the method -used for Fortran @code{CHARACTER} arguments. - -@xref{Procedures,,Procedures (SUBROUTINE and FUNCTION)}, for detailed information on -how this particular version of @code{g77} passes arguments -to procedures. - -@node Generics and Specifics -@subsection Generics and Specifics -@cindex generic intrinsics -@cindex intrinsics, generic - -The ANSI FORTRAN 77 language defines generic and specific -intrinsics. -In short, the distinctions are: - -@itemize @bullet -@item -@emph{Specific} intrinsics have -specific types for their arguments and a specific return -type. - -@item -@emph{Generic} intrinsics are treated, -on a case-by-case basis in the program's source code, -as one of several possible specific intrinsics. - -Typically, a generic intrinsic has a return type that -is determined by the type of one or more of its arguments. -@end itemize - -The GNU Fortran language generalizes these concepts somewhat, -especially by providing intrinsic subroutines and generic -intrinsics that are treated as either a specific intrinsic subroutine -or a specific intrinsic function (e.g. @code{SECOND}). - -However, GNU Fortran avoids generalizing this concept to -the point where existing code would be accepted as meaning -something possibly different than what was intended. - -For example, @code{ABS} is a generic intrinsic, so all working -code written using @code{ABS} of an @code{INTEGER} argument -expects an @code{INTEGER} return value. -Similarly, all such code expects that @code{ABS} of an @code{INTEGER*2} -argument returns an @code{INTEGER*2} return value. - -Yet, @code{IABS} is a @emph{specific} intrinsic that accepts only -an @code{INTEGER(KIND=1)} argument. -Code that passes something other than an @code{INTEGER(KIND=1)} -argument to @code{IABS} is not valid GNU Fortran code, because -it is not clear what the author intended. - -For example, if @samp{J} is @code{INTEGER(KIND=6)}, @samp{IABS(J)} -is not defined by the GNU Fortran language, because the programmer -might have used that construct to mean any of the following, subtly -different, things: - -@itemize @bullet -@item -Convert @samp{J} to @code{INTEGER(KIND=1)} first -(as if @samp{IABS(INT(J))} had been written). - -@item -Convert the result of the intrinsic to @code{INTEGER(KIND=1)} -(as if @samp{INT(ABS(J))} had been written). - -@item -No conversion (as if @samp{ABS(J)} had been written). -@end itemize - -The distinctions matter especially when types and values wider than -@code{INTEGER(KIND=1)} (such as @code{INTEGER(KIND=2)}), or when -operations performing more ``arithmetic'' than absolute-value, are involved. - -The following sample program is not a valid GNU Fortran program, but -might be accepted by other compilers. -If so, the output is likely to be revealing in terms of how a given -compiler treats intrinsics (that normally are specific) when they -are given arguments that do not conform to their stated requirements: - -@cindex JCB002 program -@smallexample - PROGRAM JCB002 -C -C Written by James Craig Burley 1997-02-20. -C Contact via Internet email: burley@@gnu.ai.mit.edu -C -C Determine how compilers handle non-standard IDIM -C on INTEGER*2 operands, which presumably can be -C extrapolated into understanding how the compiler -C generally treats specific intrinsics that are passed -C arguments not of the correct types. -C -C If your compiler implements INTEGER*2 and INTEGER -C as the same type, change all INTEGER*2 below to -C INTEGER*1. -C - INTEGER*2 I0, I4 - INTEGER I1, I2, I3 - INTEGER*2 ISMALL, ILARGE - INTEGER*2 ITOOLG, ITWO - LOGICAL L2, L3, L4 -C -C Find smallest INTEGER*2 number. -C - ISMALL=0 - 10 I0 = ISMALL-1 - IF ((I0 .GE. ISMALL) .OR. (I0+1 .NE. ISMALL)) GOTO 20 - ISMALL = I0 - GOTO 10 - 20 CONTINUE -C -C Find largest INTEGER*2 number. -C - ILARGE=0 - 30 I0 = ILARGE+1 - IF ((I0 .LE. ILARGE) .OR. (I0-1 .NE. ILARGE)) GOTO 40 - ILARGE = I0 - GOTO 30 - 40 CONTINUE -C -C Multiplying by two adds stress to the situation. -C - ITWO = 2 -C -C Need a number that, added to -2, is too wide to fit in I*2. -C - ITOOLG = ISMALL -C -C Use IDIM the straightforward way. -C - I1 = IDIM (ILARGE, ISMALL) * ITWO + ITOOLG -C -C Try first interpretation. -C - I2 = (INT (ILARGE) - INT (ISMALL)) * ITWO + ITOOLG -C -C Try second interpretation. -C - I3 = (INT (ILARGE - ISMALL)) * ITWO + ITOOLG -C -C Try third interpretation. -C - I4 = (ILARGE - ISMALL) * ITWO + ITOOLG -C -C Print results. -C - PRINT *, 'ILARGE=', ILARGE - PRINT *, 'ITWO=', ITWO - PRINT *, 'ITOOLG=', ITOOLG - PRINT *, 'ISMALL=', ISMALL - PRINT *, 'I1=', I1 - PRINT *, 'I2=', I2 - PRINT *, 'I3=', I3 - PRINT *, 'I4=', I4 - PRINT * - L2 = (I1 .EQ. I2) - L3 = (I1 .EQ. I3) - L4 = (I1 .EQ. I4) - IF (L2 .AND. .NOT.L3 .AND. .NOT.L4) THEN - PRINT *, 'Interp 1: IDIM(I*2,I*2) => IDIM(INT(I*2),INT(I*2))' - STOP - END IF - IF (L3 .AND. .NOT.L2 .AND. .NOT.L4) THEN - PRINT *, 'Interp 2: IDIM(I*2,I*2) => INT(DIM(I*2,I*2))' - STOP - END IF - IF (L4 .AND. .NOT.L2 .AND. .NOT.L3) THEN - PRINT *, 'Interp 3: IDIM(I*2,I*2) => DIM(I*2,I*2)' - STOP - END IF - PRINT *, 'Results need careful analysis.' - END + 1: A0-- B0--- C0--- D0--- -fcase-preserve + 2: A0-- B0--- C0--- D-1-- + 3: A0-- B0--- C0--- D--2- + 4: A0-- B0--- C0--- D---3 + 5: A0-- B0--- C-1-- D0--- + 6: A0-- B0--- C-1-- D-1-- + 7: A0-- B0--- C-1-- D--2- + 8: A0-- B0--- C-1-- D---3 + 9: A0-- B0--- C--2- D0--- +10: A0-- B0--- C--2- D-1-- +11: A0-- B0--- C--2- D--2- +12: A0-- B0--- C--2- D---3 +13: A0-- B0--- C---3 D0--- +14: A0-- B0--- C---3 D-1-- +15: A0-- B0--- C---3 D--2- +16: A0-- B0--- C---3 D---3 +17: A0-- B-1-- C0--- D0--- +18: A0-- B-1-- C0--- D-1-- +19: A0-- B-1-- C0--- D--2- +20: A0-- B-1-- C0--- D---3 +21: A0-- B-1-- C-1-- D0--- +22: A0-- B-1-- C-1-- D-1-- -fcase-strict-upper +23: A0-- B-1-- C-1-- D--2- +24: A0-- B-1-- C-1-- D---3 +25: A0-- B-1-- C--2- D0--- +26: A0-- B-1-- C--2- D-1-- +27: A0-- B-1-- C--2- D--2- +28: A0-- B-1-- C--2- D---3 +29: A0-- B-1-- C---3 D0--- +30: A0-- B-1-- C---3 D-1-- +31: A0-- B-1-- C---3 D--2- +32: A0-- B-1-- C---3 D---3 +33: A0-- B--2- C0--- D0--- +34: A0-- B--2- C0--- D-1-- +35: A0-- B--2- C0--- D--2- +36: A0-- B--2- C0--- D---3 +37: A0-- B--2- C-1-- D0--- +38: A0-- B--2- C-1-- D-1-- +39: A0-- B--2- C-1-- D--2- +40: A0-- B--2- C-1-- D---3 +41: A0-- B--2- C--2- D0--- +42: A0-- B--2- C--2- D-1-- +43: A0-- B--2- C--2- D--2- -fcase-strict-lower +44: A0-- B--2- C--2- D---3 +45: A0-- B--2- C---3 D0--- +46: A0-- B--2- C---3 D-1-- +47: A0-- B--2- C---3 D--2- +48: A0-- B--2- C---3 D---3 +49: A0-- B---3 C0--- D0--- +50: A0-- B---3 C0--- D-1-- +51: A0-- B---3 C0--- D--2- +52: A0-- B---3 C0--- D---3 +53: A0-- B---3 C-1-- D0--- +54: A0-- B---3 C-1-- D-1-- +55: A0-- B---3 C-1-- D--2- +56: A0-- B---3 C-1-- D---3 +57: A0-- B---3 C--2- D0--- +58: A0-- B---3 C--2- D-1-- +59: A0-- B---3 C--2- D--2- +60: A0-- B---3 C--2- D---3 +61: A0-- B---3 C---3 D0--- +62: A0-- B---3 C---3 D-1-- +63: A0-- B---3 C---3 D--2- +64: A0-- B---3 C---3 D---3 -fcase-initcap +65: A-1- B01-- C01-- D01-- -fcase-upper +66: A--2 B0-2- C0-2- D0-2- -fcase-lower @end smallexample -It is possible that a future version of the GNU Fortran language -will permit specific intrinsic invocations with wrong-typed -arguments (such as @code{IDIM} in the above example) if the vast -majority of production compilers agree on the interpretation of -such invocations. - -Especially if you know of a compiler that does not implement -interpretation 3 above (output @samp{Interp 3: @dots{}}), please -let us know the details (compiler product, version, machine, results, -and so on). - -@node REAL() and AIMAG() of Complex -@subsection @code{REAL()} and @code{AIMAG()} of Complex -@cindex REAL intrinsic -@cindex intrinsics, REAL -@cindex AIMAG intrinsic -@cindex intrinsics, AIMAG - -The GNU Fortran language disallows @code{REAL(@var{expr})} -and @code{AIMAG(@var{expr})}, -where @var{expr} is any @code{COMPLEX} type other than @code{COMPLEX(KIND=1)}, -except when they are used in the following way: - -@example -REAL(REAL(@var{expr})) -REAL(AIMAG(@var{expr})) -@end example - -@noindent -The above forms explicitly specify that the desired effect -is to convert the real or imaginary part of @var{expr}, which might -be some @code{REAL} type other than @code{REAL(KIND=1)}, -to type @code{REAL(KIND=1)}, -and have that serve as the value of the expression. - -The GNU Fortran language offers clearly named intrinsics to extract the -real and imaginary parts of a complex entity without any -conversion: - -@example -REALPART(@var{expr}) -IMAGPART(@var{expr}) -@end example - -To express the above using typical extended FORTRAN 77, -use the following constructs -(when @var{expr} is @code{COMPLEX(KIND=2)}): - -@example -DBLE(@var{expr}) -DIMAG(@var{expr}) -@end example - -The FORTRAN 77 language offers no way -to explicitly specify the real and imaginary parts of a complex expression of -arbitrary type, apparently as a result of requiring support for -only one @code{COMPLEX} type (@code{COMPLEX(KIND=1)}). -The concepts of converting an expression to type @code{REAL(KIND=1)} and -of extracting the real part of a complex expression were -thus ``smooshed'' by FORTRAN 77 into a single intrinsic, since -they happened to have the exact same effect in that language -(due to having only one @code{COMPLEX} type). - -@emph{Note:} When @samp{-ff90} is in effect, -@code{g77} treats @samp{REAL(@var{expr})}, where @var{expr} is of -type @code{COMPLEX}, as @samp{REALPART(@var{expr})}, -whereas with @samp{-fugly-complex -fno-f90} in effect, it is -treated as @samp{REAL(REALPART(@var{expr}))}. - -@xref{Ugly Complex Part Extraction}, for more information. - -@node CMPLX() of DOUBLE PRECISION -@subsection @code{CMPLX()} of @code{DOUBLE PRECISION} -@cindex CMPLX intrinsic -@cindex intrinsics, CMPLX - -In accordance with Fortran 90 and at least some (perhaps all) -other compilers, the GNU Fortran language defines @code{CMPLX()} -as always returning a result that is type @code{COMPLEX(KIND=1)}. - -This means @samp{CMPLX(D1,D2)}, where @samp{D1} and @samp{D2} -are @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}), is treated as: - -@example -CMPLX(SNGL(D1), SNGL(D2)) -@end example - -The GNU Fortran language also provides the @code{DCMPLX()} intrinsic, -which is provided by some FORTRAN 77 compilers to construct -a @code{DOUBLE COMPLEX} entity from of @code{DOUBLE PRECISION} -operands. -However, this solution does not scale well when more @code{COMPLEX} types -(having various precisions and ranges) are offered by Fortran implementations. - -Fortran 90 extends the @code{CMPLX()} intrinsic by adding -an extra argument used to specify the desired kind of complex -result. -However, this solution is somewhat awkward to use. - -The GNU Fortran language provides a simple way to build a complex -value out of two numbers, with the precise type of the value -determined by the types of the two numbers (via the usual -type-promotion mechanism): - -@example -COMPLEX(@var{real}, @var{imag}) -@end example - -When @var{real} and @var{imag} are the same @code{REAL} types, @code{COMPLEX()} -performs no conversion other than to put them together to form a -complex result of the same (complex version of real) type. - -@xref{Complex Intrinsic}, for more information. - -@node MIL-STD 1753 -@subsection MIL-STD 1753 Support -@cindex MIL-STD 1753 - -The GNU Fortran language includes the MIL-STD 1753 intrinsics -@code{BTEST}, @code{IAND}, @code{IBCLR}, @code{IBITS}, -@code{IBSET}, @code{IEOR}, @code{IOR}, @code{ISHFT}, -@code{ISHFTC}, @code{MVBITS}, and @code{NOT}. - -@node f77/f2c Intrinsics -@subsection @code{f77}/@code{f2c} Intrinsics - -The bit-manipulation intrinsics supported by traditional -@code{f77} and by @code{f2c} are available in the GNU Fortran language. -These include @code{AND}, @code{LSHIFT}, @code{OR}, @code{RSHIFT}, -and @code{XOR}. - -Also supported are the intrinsics @code{CDABS}, -@code{CDCOS}, @code{CDEXP}, @code{CDLOG}, @code{CDSIN}, -@code{CDSQRT}, @code{DCMPLX}, @code{DCONJG}, @code{DFLOAT}, -@code{DIMAG}, @code{DREAL}, and @code{IMAG}, -@code{ZABS}, @code{ZCOS}, @code{ZEXP}, @code{ZLOG}, @code{ZSIN}, -and @code{ZSQRT}. - -@node Table of Intrinsic Functions -@subsection Table of Intrinsic Functions -@cindex intrinsics, table of -@cindex table of intrinsics - -(Corresponds to Section 15.10 of ANSI X3.9-1978 FORTRAN 77.) - -The GNU Fortran language adds various functions, subroutines, types, -and arguments to the set of intrinsic functions in ANSI FORTRAN 77. -The complete set of intrinsics supported by the GNU Fortran language -is described below. - -Note that a name is not treated as that of an intrinsic if it is -specified in an @code{EXTERNAL} statement in the same program unit; -if a command-line option is used to disable the groups to which -the intrinsic belongs; or if the intrinsic is not named in an -@code{INTRINSIC} statement and a command-line option is used to -hide the groups to which the intrinsic belongs. - -So, it is recommended that any reference in a program unit to -an intrinsic procedure that is not a standard FORTRAN 77 -intrinsic be accompanied by an appropriate @code{INTRINSIC} -statement in that program unit. -This sort of defensive programming makes it more -likely that an implementation will issue a diagnostic rather -than generate incorrect code for such a reference. - -The terminology used below is based on that of the Fortran 90 -standard, so that the text may be more concise and accurate: - -@itemize @bullet -@item -@code{OPTIONAL} means the argument may be omitted. - -@item -@samp{A-1, A-2, @dots{}, A-n} means more than one argument -(generally named @samp{A}) may be specified. - -@item -@samp{scalar} means the argument must not be an array (must -be a variable or array element, or perhaps a constant if expressions -are permitted). - -@item -@samp{DIMENSION(4)} means the argument must be an array having 4 elements. - -@item -@code{INTENT(IN)} means the argument must be an expression -(such as a constant or a variable that is defined upon invocation -of the intrinsic). - -@item -@code{INTENT(OUT)} means the argument must be definable by the -invocation of the intrinsic (that is, must not be a constant nor -an expression involving operators other than array reference and -substring reference). - -@item -@code{INTENT(INOUT)} means the argument must be defined prior to, -and definable by, invocation of the intrinsic (a combination of -the requirements of @code{INTENT(IN)} and @code{INTENT(OUT)}. -@end itemize - -@ifinfo -(Note that the blank lines appearing in the menu below -are not intentional---they result from a bug in the -GNU @code{makeinfo} program@dots{}a program that, if it -did not exist, this document would be in far worse shape!) -@end ifinfo - -@c The actual documentation for intrinsics comes from -@c intdoc.texi, which in turn is automatically generated -@c from the internal g77 tables in intrin.def _and_ the -@c largely hand-written text in intdoc.h. So, if you want -@c to change or add to existing documentation on intrinsics, -@c you probably want to edit intdoc.h. -@c -@set familyF77 -@set familyGNU -@set familyASC -@set familyMIL -@set familyF90 -@clear familyVXT -@clear familyFVZ -@set familyF2C -@set familyF2U -@include intdoc.texi - -@node Scope and Classes of Names -@section Scope and Classes of Symbolic Names -@cindex symbolic names -@cindex scope - -(The following information augments or overrides the information in -Chapter 18 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran -language. -Chapter 18 of that document otherwise serves as the basis -for the relevant aspects of GNU Fortran.) - -@menu -* Underscores in Symbol Names:: -@end menu - -@node Underscores in Symbol Names -@subsection Underscores in Symbol Names -@cindex underscores - -Underscores (@samp{_}) are accepted in symbol names after the first -character (which must be a letter). - -@node Other Dialects -@chapter Other Dialects - -GNU Fortran supports a variety of features that are not -considered part of the GNU Fortran language itself, but -are representative of various dialects of Fortran that -@code{g77} supports in whole or in part. - -Any of the features listed below might be disallowed by -@code{g77} unless some command-line option is specified. -Currently, some of the features are accepted using the -default invocation of @code{g77}, but that might change -in the future. - -@emph{Note: This portion of the documentation definitely needs a lot -of work!} - -@menu -* Source Form:: Details of fixed-form and free-form source. -* Trailing Comment:: Use of @samp{/*} to start a comment. -* Debug Line:: Use of @samp{D} in column 1. -* Dollar Signs:: Use of @samp{$} in symbolic names. -* Case Sensitivity:: Uppercase and lowercase in source files. -* VXT Fortran:: @dots{}versus the GNU Fortran language. -* Fortran 90:: @dots{}versus the GNU Fortran language. -* Pedantic Compilation:: Enforcing the standard. -* Distensions:: Misfeatures supported by GNU Fortran. -@end menu - -@node Source Form -@section Source Form -@cindex source file format -@cindex source form -@cindex files, source -@cindex source code -@cindex code, source -@cindex fixed form -@cindex free form - -GNU Fortran accepts programs written in either fixed form or -free form. - -Fixed form -corresponds to ANSI FORTRAN 77 (plus popular extensions, such as -allowing tabs) and Fortran 90's fixed form. - -Free form corresponds to -Fortran 90's free form (though possibly not entirely up-to-date, and -without complaining about some things that for which Fortran 90 requires -diagnostics, such as the spaces in the constant in @samp{R = 3 . 1}). - -The way a Fortran compiler views source files depends entirely on the -implementation choices made for the compiler, since those choices -are explicitly left to the implementation by the published Fortran -standards. -GNU Fortran currently tries to be somewhat like a few popular compilers -(@code{f2c}, DEC Fortran, and so on), though a cleaner default -definition along with more -flexibility offered by command-line options is likely to be offered -in version 0.6. - -This section describes how @code{g77} interprets source lines. - -@menu -* Carriage Returns:: Carriage returns ignored. -* Tabs:: Tabs converted to spaces. -* Short Lines:: Short lines padded with spaces (fixed-form only). -* Long Lines:: Long lines truncated. -* Ampersands:: Special Continuation Lines. -@end menu - -@node Carriage Returns -@subsection Carriage Returns -@cindex carriage returns - -Carriage returns (@samp{\r}) in source lines are ignored. -This is somewhat different from @code{f2c}, which seems to treat them as -spaces outside character/Hollerith constants, and encodes them as @samp{\r} -inside such constants. - -@node Tabs -@subsection Tabs -@cindex tab characters - -A source line with a @key{TAB} character anywhere in it is treated as -entirely significant---however long it is---instead of ending in -column 72 (for fixed-form source) or 132 (for free-form source). -This also is different from @code{f2c}, which encodes tabs as -@samp{\t} (the ASCII @key{TAB} character) inside character -and Hollerith constants, but nevertheless seems to treat the column -position as if it had been affected by the canonical tab positioning. - -@code{g77} effectively -translates tabs to the appropriate number of spaces (a la the default -for the UNIX @code{expand} command) before doing any other processing, other -than (currently) noting whether a tab was found on a line and using this -information to decide how to interpret the length of the line and continued -constants. - -Note that this default behavior probably will change for version 0.6, -when it will presumably be available via a command-line option. -The default as of version 0.6 is planned to be a ``pure visual'' -model, where tabs are immediately -converted to spaces and otherwise have no effect, so the way a typical -user sees source lines produces a consistent result no matter how the -spacing in those source lines is actually implemented via tabs, spaces, -and trailing tabs/spaces before newline. -Command-line options are likely to be added to specify whether all or -just-tabbed lines are to be extended to 132 or full input-line length, -and perhaps even an option will be added to specify the truncated-line -behavior to which some Digital compilers default (and which affects -the way continued character/Hollerith constants are interpreted). - -@node Short Lines -@subsection Short Lines -@cindex short source lines -@cindex space-padding -@cindex spaces -@cindex source lines, short -@cindex lines, short - -Source lines shorter than the applicable fixed-form length are treated as -if they were padded with spaces to that length. -(None of this is relevant to source files written in free form.) - -This affects only -continued character and Hollerith constants, and is a different -interpretation than provided by some other popular compilers -(although a bit more consistent with the traditional punched-card -basis of Fortran and the way the Fortran standard expressed fixed -source form). - -@code{g77} might someday offer an option to warn about cases where differences -might be seen as a result of this treatment, and perhaps an option to -specify the alternate behavior as well. - -Note that this padding cannot apply to lines that are effectively of -infinite length---such lines are specified using command-line options -like @samp{-ffixed-line-length-none}, for example. - -@node Long Lines -@subsection Long Lines -@cindex long source lines -@cindex truncation -@cindex lines, long -@cindex source lines, long - -Source lines longer than the applicable length are truncated to that -length. -Currently, @code{g77} does not warn if the truncated characters are -not spaces, to accommodate existing code written for systems that -treated truncated text as commentary (especially in columns 73 through 80). - -@node Ampersands -@subsection Ampersand Continuation Line -@cindex ampersand continuation line -@cindex continuation line, ampersand - -A @samp{&} in column 1 of fixed-form source denotes an arbitrary-length -continuation line, imitating the behavior of @code{f2c}. - -@node Trailing Comment -@section Trailing Comment - -@code{g77} supports use of @samp{/*} to start a trailing -comment. -In the GNU Fortran language, @samp{!} is used for this purpose. - -@samp{/*} is not in the GNU Fortran language -because the use of @samp{/*} in a program might -suggest to some readers that a block, not trailing, comment is -started (and thus ended by @samp{*/}, not end of line), -since that is the meaning of @samp{/*} in C. - -Also, such readers might think they can use @samp{//} to start -a trailing comment as an alternative to @samp{/*}, but -@samp{//} already denotes concatenation, and such a ``comment'' -might actually result in a program that compiles without -error (though it would likely behave incorrectly). - -@node Debug Line -@section Debug Line -@cindex debug line - -Use of @samp{D} or @samp{d} as the first character (column 1) of -a source line denotes a debug line. - -In turn, a debug line is treated as either a comment line -or a normal line, depending on whether debug lines are enabled. - -When treated as a comment line, a line beginning with @samp{D} or -@samp{d} is treated as if it the first character was @samp{C} or @samp{c}, respectively. -When treated as a normal line, such a line is treated as if -the first character was @key{SPC} (space). - -(Currently, @code{g77} provides no means for treating debug -lines as normal lines.) - -@node Dollar Signs -@section Dollar Signs in Symbol Names -@cindex dollar sign -@cindex $ - -Dollar signs (@samp{$}) are allow in symbol names (after the first character) -when the @samp{-fdollar-ok} option is specified. - -@node Case Sensitivity -@section Case Sensitivity -@cindex case sensitivity -@cindex source file format -@cindex code, source -@cindex source code -@cindex uppercase letters -@cindex lowercase letters -@cindex letters, uppercase -@cindex letters, lowercase - -GNU Fortran offers the programmer way too much flexibility in deciding -how source files are to be treated vis-a-vis uppercase and lowercase -characters. -There are 66 useful settings that affect case sensitivity, plus 10 -settings that are nearly useless, with the remaining 116 settings -being either redundant or useless. - -None of these settings have any effect on the contents of comments -(the text after a @samp{c} or @samp{C} in Column 1, for example) -or of character or Hollerith constants. -Note that things like the @samp{E} in the statement -@samp{CALL FOO(3.2E10)} and the @samp{TO} in @samp{ASSIGN 10 TO LAB} -are considered built-in keywords, and so are affected by -these settings. - -Low-level switches are identified in this section as follows: - -@itemize @w{} -@item A -Source Case Conversion: - -@itemize @w{} -@item 0 -Preserve (see Note 1) -@item 1 -Convert to Upper Case -@item 2 -Convert to Lower Case -@end itemize - -@item B -Built-in Keyword Matching: - -@itemize @w{} -@item 0 -Match Any Case (per-character basis) -@item 1 -Match Upper Case Only -@item 2 -Match Lower Case Only -@item 3 -Match InitialCaps Only (see tables for spellings) -@end itemize - -@item C -Built-in Intrinsic Matching: - -@itemize @w{} -@item 0 -Match Any Case (per-character basis) -@item 1 -Match Upper Case Only -@item 2 -Match Lower Case Only -@item 3 -Match InitialCaps Only (see tables for spellings) -@end itemize - -@item D -User-defined Symbol Possibilities (warnings only): - -@itemize @w{} -@item 0 -Allow Any Case (per-character basis) -@item 1 -Allow Upper Case Only -@item 2 -Allow Lower Case Only -@item 3 -Allow InitialCaps Only (see Note 2) -@end itemize -@end itemize - -Note 1: @code{g77} eventually will support @code{NAMELIST} in a manner that is -consistent with these source switches---in the sense that input will be -expected to meet the same requirements as source code in terms -of matching symbol names and keywords (for the exponent letters). - -Currently, however, @code{NAMELIST} is supported by @code{libf2c}, -which uppercases @code{NAMELIST} input and symbol names for matching. -This means not only that @code{NAMELIST} output currently shows symbol -(and keyword) names in uppercase even if lower-case source -conversion (option A2) is selected, but that @code{NAMELIST} cannot be -adequately supported when source case preservation (option A0) -is selected. - -If A0 is selected, a warning message will be -output for each @code{NAMELIST} statement to this effect. -The behavior -of the program is undefined at run time if two or more symbol names -appear in a given @code{NAMELIST} such that the names are identical -when converted to upper case (e.g. @samp{NAMELIST /X/ VAR, Var, var}). -For complete and total elegance, perhaps there should be a warning -when option A2 is selected, since the output of NAMELIST is currently -in uppercase but will someday be lowercase (when a @code{libg77} is written), -but that seems to be overkill for a product in beta test. - -Note 2: Rules for InitialCaps names are: - -@itemize -- -@item -Must be a single uppercase letter, @strong{or} -@item -Must start with an uppercase letter and contain at least one -lowercase letter. -@end itemize - -So @samp{A}, @samp{Ab}, @samp{ABc}, @samp{AbC}, and @samp{Abc} are -valid InitialCaps names, but @samp{AB}, @samp{A2}, and @samp{ABC} are -not. -Note that most, but not all, built-in names meet these -requirements---the exceptions are some of the two-letter format -specifiers, such as @samp{BN} and @samp{BZ}. - -Here are the names of the corresponding command-line options: - -@smallexample -A0: -fsource-case-preserve -A1: -fsource-case-upper -A2: -fsource-case-lower - -B0: -fmatch-case-any -B1: -fmatch-case-upper -B2: -fmatch-case-lower -B3: -fmatch-case-initcap - -C0: -fintrin-case-any -C1: -fintrin-case-upper -C2: -fintrin-case-lower -C3: -fintrin-case-initcap - -D0: -fsymbol-case-any -D1: -fsymbol-case-upper -D2: -fsymbol-case-lower -D3: -fsymbol-case-initcap -@end smallexample - -Useful combinations of the above settings, along with abbreviated -option names that set some of these combinations all at once: - -@smallexample - 1: A0-- B0--- C0--- D0--- -fcase-preserve - 2: A0-- B0--- C0--- D-1-- - 3: A0-- B0--- C0--- D--2- - 4: A0-- B0--- C0--- D---3 - 5: A0-- B0--- C-1-- D0--- - 6: A0-- B0--- C-1-- D-1-- - 7: A0-- B0--- C-1-- D--2- - 8: A0-- B0--- C-1-- D---3 - 9: A0-- B0--- C--2- D0--- -10: A0-- B0--- C--2- D-1-- -11: A0-- B0--- C--2- D--2- -12: A0-- B0--- C--2- D---3 -13: A0-- B0--- C---3 D0--- -14: A0-- B0--- C---3 D-1-- -15: A0-- B0--- C---3 D--2- -16: A0-- B0--- C---3 D---3 -17: A0-- B-1-- C0--- D0--- -18: A0-- B-1-- C0--- D-1-- -19: A0-- B-1-- C0--- D--2- -20: A0-- B-1-- C0--- D---3 -21: A0-- B-1-- C-1-- D0--- -22: A0-- B-1-- C-1-- D-1-- -fcase-strict-upper -23: A0-- B-1-- C-1-- D--2- -24: A0-- B-1-- C-1-- D---3 -25: A0-- B-1-- C--2- D0--- -26: A0-- B-1-- C--2- D-1-- -27: A0-- B-1-- C--2- D--2- -28: A0-- B-1-- C--2- D---3 -29: A0-- B-1-- C---3 D0--- -30: A0-- B-1-- C---3 D-1-- -31: A0-- B-1-- C---3 D--2- -32: A0-- B-1-- C---3 D---3 -33: A0-- B--2- C0--- D0--- -34: A0-- B--2- C0--- D-1-- -35: A0-- B--2- C0--- D--2- -36: A0-- B--2- C0--- D---3 -37: A0-- B--2- C-1-- D0--- -38: A0-- B--2- C-1-- D-1-- -39: A0-- B--2- C-1-- D--2- -40: A0-- B--2- C-1-- D---3 -41: A0-- B--2- C--2- D0--- -42: A0-- B--2- C--2- D-1-- -43: A0-- B--2- C--2- D--2- -fcase-strict-lower -44: A0-- B--2- C--2- D---3 -45: A0-- B--2- C---3 D0--- -46: A0-- B--2- C---3 D-1-- -47: A0-- B--2- C---3 D--2- -48: A0-- B--2- C---3 D---3 -49: A0-- B---3 C0--- D0--- -50: A0-- B---3 C0--- D-1-- -51: A0-- B---3 C0--- D--2- -52: A0-- B---3 C0--- D---3 -53: A0-- B---3 C-1-- D0--- -54: A0-- B---3 C-1-- D-1-- -55: A0-- B---3 C-1-- D--2- -56: A0-- B---3 C-1-- D---3 -57: A0-- B---3 C--2- D0--- -58: A0-- B---3 C--2- D-1-- -59: A0-- B---3 C--2- D--2- -60: A0-- B---3 C--2- D---3 -61: A0-- B---3 C---3 D0--- -62: A0-- B---3 C---3 D-1-- -63: A0-- B---3 C---3 D--2- -64: A0-- B---3 C---3 D---3 -fcase-initcap -65: A-1- B01-- C01-- D01-- -fcase-upper -66: A--2 B0-2- C0-2- D0-2- -fcase-lower -@end smallexample - -Number 22 is the ``strict'' ANSI FORTRAN 77 model wherein all input -(except comments, character constants, and Hollerith strings) must -be entered in uppercase. -Use @samp{-fcase-strict-upper} to specify this -combination. +Number 22 is the ``strict'' ANSI FORTRAN 77 model wherein all input +(except comments, character constants, and Hollerith strings) must +be entered in uppercase. +Use @samp{-fcase-strict-upper} to specify this +combination. Number 43 is like Number 22 except all input must be lowercase. Use @samp{-fcase-strict-lower} to specify this combination. -Number 65 is the ``classic'' ANSI FORTRAN 77 model as implemented on many -non-UNIX machines whereby all the source is translated to uppercase. -Use @samp{-fcase-upper} to specify this combination. - -Number 66 is the ``canonical'' UNIX model whereby all the source is -translated to lowercase. -Use @samp{-fcase-lower} to specify this combination. - -There are a few nearly useless combinations: - -@smallexample -67: A-1- B01-- C01-- D--2- -68: A-1- B01-- C01-- D---3 -69: A-1- B01-- C--23 D01-- -70: A-1- B01-- C--23 D--2- -71: A-1- B01-- C--23 D---3 -72: A--2 B01-- C0-2- D-1-- -73: A--2 B01-- C0-2- D---3 -74: A--2 B01-- C-1-3 D0-2- -75: A--2 B01-- C-1-3 D-1-- -76: A--2 B01-- C-1-3 D---3 -@end smallexample - -The above allow some programs to be compiled but with restrictions that -make most useful programs impossible: Numbers 67 and 72 warn about -@emph{any} user-defined symbol names (such as @samp{SUBROUTINE FOO}); -Numbers -68 and 73 warn about any user-defined symbol names longer than one -character that don't have at least one non-alphabetic character after -the first; -Numbers 69 and 74 disallow any references to intrinsics; -and Numbers 70, 71, 75, and 76 are combinations of the restrictions in -67+69, 68+69, 72+74, and 73+74, respectively. - -All redundant combinations are shown in the above tables anyplace -where more than one setting is shown for a low-level switch. -For example, @samp{B0-2-} means either setting 0 or 2 is valid for switch B. -The ``proper'' setting in such a case is the one that copies the setting -of switch A---any other setting might slightly reduce the speed of -the compiler, though possibly to an unmeasurable extent. - -All remaining combinations are useless in that they prevent successful -compilation of non-null source files (source files with something other -than comments). - -@node VXT Fortran -@section VXT Fortran - -@cindex VXT extensions -@cindex extensions, VXT -@code{g77} supports certain constructs that -have different meanings in VXT Fortran than they -do in the GNU Fortran language. - -Generally, this manual uses the invented term VXT Fortran to refer -VAX FORTRAN (circa v4). -That compiler offered many popular features, though not necessarily -those that are specific to the VAX processor architecture, -the VMS operating system, -or Digital Equipment Corporation's Fortran product line. -(VAX and VMS probably are trademarks of Digital Equipment -Corporation.) - -An extension offered by a Digital Fortran product that also is -offered by several other Fortran products for different kinds of -systems is probably going to be considered for inclusion in @code{g77} -someday, and is considered a VXT Fortran feature. - -The @samp{-fvxt} option generally specifies that, where -the meaning of a construct is ambiguous (means one thing -in GNU Fortran and another in VXT Fortran), the VXT Fortran -meaning is to be assumed. - -@menu -* Double Quote Meaning:: @samp{"2000} as octal constant. -* Exclamation Point:: @samp{!} in column 6. -@end menu - -@node Double Quote Meaning -@subsection Meaning of Double Quote -@cindex double quotes -@cindex character constants -@cindex constants, character -@cindex octal constants -@cindex constants, octal - -@code{g77} treats double-quote (@samp{"}) -as beginning an octal constant of @code{INTEGER(KIND=1)} type -when the @code{-fvxt} option is specified. -The form of this octal constant is - -@example -"@var{octal-digits} -@end example - -@noindent -where @var{octal-digits} is a nonempty string of characters in -the set @samp{01234567}. - -For example, the @code{-fvxt} option permits this: - -@example -PRINT *, "20 -END -@end example - -@noindent -The above program would print the value @samp{16}. - -@xref{Integer Type}, for information on the preferred construct -for integer constants specified using GNU Fortran's octal notation. - -(In the GNU Fortran language, the double-quote character (@samp{"}) -delimits a character constant just as does apostrophe (@samp{'}). -There is no way to allow -both constructs in the general case, since statements like -@samp{PRINT *,"2000 !comment?"} would be ambiguous.) - -@node Exclamation Point -@subsection Meaning of Exclamation Point in Column 6 -@cindex exclamation points -@cindex continuation character -@cindex characters, continuation -@cindex comment character -@cindex characters, comment - -@code{g77} treats an exclamation point (@samp{!}) in column 6 of -a fixed-form source file -as a continuation character rather than -as the beginning of a comment -(as it does in any other column) -when the @code{-fvxt} option is specified. - -The following program, when run, prints a message indicating -whether it is interpreted according to GNU Fortran (and Fortran 90) -rules or VXT Fortran rules: - -@smallexample -C234567 (This line begins in column 1.) - I = 0 - !1 - IF (I.EQ.0) PRINT *, ' I am a VXT Fortran program' - IF (I.EQ.1) PRINT *, ' I am a Fortran 90 program' - IF (I.LT.0 .OR. I.GT.1) PRINT *, ' I am a HAL 9000 computer' - END -@end smallexample - -(In the GNU Fortran and Fortran 90 languages, exclamation point is -a valid character and, unlike space (@key{SPC}) or zero (@samp{0}), -marks a line as a continuation line when it appears in column 6.) - -@node Fortran 90 -@section Fortran 90 -@cindex compatibility, Fortran 90 -@cindex Fortran 90 compatibility - -The GNU Fortran language includes a number of features that are -part of Fortran 90, even when the @samp{-ff90} option is not specified. -The features enabled by @samp{-ff90} are intended to be those that, -when @samp{-ff90} is not specified, would have another -meaning to @code{g77}---usually meaning something invalid in the -GNU Fortran language. - -So, the purpose of @samp{-ff90} is not to specify whether @code{g77} is -to gratuitously reject Fortran 90 constructs. -The @samp{-pedantic} option specified with @samp{-fno-f90} is intended -to do that, although its implementation is certainly incomplete at -this point. - -When @samp{-ff90} is specified: - -@itemize @bullet -@item -The type of @samp{REAL(@var{expr})} and @samp{AIMAG(@var{expr})}, -where @var{expr} is @code{COMPLEX} type, -is the same type as the real part of @var{expr}. - -For example, assuming @samp{Z} is type @code{COMPLEX(KIND=2)}, -@samp{REAL(Z)} would return a value of type @code{REAL(KIND=2)}, -not of type @code{REAL(KIND=1)}, since @samp{-ff90} is specified. -@end itemize - -@node Pedantic Compilation -@section Pedantic Compilation -@cindex pedantic compilation -@cindex compilation, pedantic - -The @samp{-fpedantic} command-line option specifies that @code{g77} -is to warn about code that is not standard-conforming. -This is useful for finding -some extensions @code{g77} accepts that other compilers might not accept. -(Note that the @samp{-pedantic} and @samp{-pedantic-errors} options -always imply @samp{-fpedantic}.) - -With @samp{-fno-f90} in force, ANSI FORTRAN 77 is used as the standard -for conforming code. -With @samp{-ff90} in force, Fortran 90 is used. - -The constructs for which @code{g77} issues diagnostics when @samp{-fpedantic} -and @samp{-fno-f90} are in force are: - -@itemize @bullet -@item -Automatic arrays, as in - -@example -SUBROUTINE X(N) -REAL A(N) -@dots{} -@end example - -@noindent -where @samp{A} is not listed in any @code{ENTRY} statement, -and thus is not a dummy argument. - -@item -The commas in @samp{READ (5), I} and @samp{WRITE (10), J}. - -These commas are disallowed by FORTRAN 77, but, while strictly -superfluous, are syntactically elegant, -especially given that commas are required in statements such -as @samp{READ 99, I} and @samp{PRINT *, J}. -Many compilers permit the superfluous commas for this reason. - -@item -@code{DOUBLE COMPLEX}, either explicitly or implicitly. - -An explicit use of this type is via a @code{DOUBLE COMPLEX} or -@code{IMPLICIT DOUBLE COMPLEX} statement, for examples. - -An example of an implicit use is the expression @samp{C*D}, -where @samp{C} is @code{COMPLEX(KIND=1)} -and @samp{D} is @code{DOUBLE PRECISION}. -This expression is prohibited by ANSI FORTRAN 77 -because the rules of promotion would suggest that it -produce a @code{DOUBLE COMPLEX} result---a type not -provided for by that standard. - -@item -Automatic conversion of numeric -expressions to @code{INTEGER(KIND=1)} in contexts such as: - -@itemize -- -@item -Array-reference indexes. -@item -Alternate-return values. -@item -Computed @code{GOTO}. -@item -@code{FORMAT} run-time expressions (not yet supported). -@item -Dimension lists in specification statements. -@item -Numbers for I/O statements (such as @samp{READ (UNIT=3.2), I}) -@item -Sizes of @code{CHARACTER} entities in specification statements. -@item -Kind types in specification entities (a Fortran 90 feature). -@item -Initial, terminal, and incrementation parameters for implied-@code{DO} -constructs in @code{DATA} statements. -@end itemize - -@item -Automatic conversion of @code{LOGICAL} expressions to @code{INTEGER} -in contexts such as arithmetic @code{IF} (where @code{COMPLEX} -expressions are disallowed anyway). - -@item -Zero-size array dimensions, as in: - -@example -INTEGER I(10,20,4:2) -@end example - -@item -Zero-length @code{CHARACTER} entities, as in: - -@example -PRINT *, '' -@end example - -@item -Substring operators applied to character constants and named -constants, as in: - -@example -PRINT *, 'hello'(3:5) -@end example - -@item -Null arguments passed to statement function, as in: - -@example -PRINT *, FOO(,3) -@end example - -@item -Disagreement among program units regarding whether a given @code{COMMON} -area is @code{SAVE}d (for targets where program units in a single source -file are ``glued'' together as they typically are for UNIX development -environments). - -@item -Disagreement among program units regarding the size of a -named @code{COMMON} block. - -@item -Specification statements following first @code{DATA} statement. - -(In the GNU Fortran language, @samp{DATA I/1/} may be followed by @samp{INTEGER J}, -but not @samp{INTEGER I}. -The @samp{-fpedantic} option disallows both of these.) - -@item -Semicolon as statement separator, as in: - -@example -CALL FOO; CALL BAR -@end example -@c -@c @item -@c Comma before list of I/O items in @code{WRITE} -@c @c, @code{ENCODE}, @code{DECODE}, and @code{REWRITE} -@c statements, as with @code{READ} (as explained above). - -@item -Use of @samp{&} in column 1 of fixed-form source (to indicate continuation). - -@item -Use of @code{CHARACTER} constants to initialize numeric entities, and vice -versa. - -@item -Expressions having two arithmetic operators in a row, such -as @samp{X*-Y}. -@end itemize - -If @samp{-fpedantic} is specified along with @samp{-ff90}, the -following constructs result in diagnostics: - -@itemize @bullet -@item -Use of semicolon as a statement separator on a line -that has an @code{INCLUDE} directive. -@end itemize - -@node Distensions -@section Distensions -@cindex distensions -@cindex ugly features -@cindex features, ugly - -The @samp{-fugly-*} command-line options determine whether certain -features supported by VAX FORTRAN and other such compilers, but considered -too ugly to be in code that can be changed to use safer and/or more -portable constructs, are accepted. -These are humorously referred to as ``distensions'', -extensions that just plain look ugly in the harsh light of day. - -@emph{Note:} The @samp{-fugly} option, which currently serves -as shorthand to enable all of the distensions below, is likely to -be removed in a future version of @code{g77}. -That's because it's likely new distensions will be added that -conflict with existing ones in terms of assigning meaning to -a given chunk of code. -(Also, it's pretty clear that users should not use @samp{-fugly} -as shorthand when the next release of @code{g77} might add a -distension to that that causes their existing code, when recompiled, -to behave differently---perhaps even fail to compile or run -correctly.) - -@menu -* Ugly Implicit Argument Conversion:: Disabled via @samp{-fno-ugly-args}. -* Ugly Assumed-Size Arrays:: Enabled via @samp{-fugly-assumed}. -* Ugly Null Arguments:: Enabled via @samp{-fugly-comma}. -* Ugly Complex Part Extraction:: Enabled via @samp{-fugly-complex}. -* Ugly Conversion of Initializers:: Disabled via @samp{-fno-ugly-init}. -* Ugly Integer Conversions:: Enabled via @samp{-fugly-logint}. -* Ugly Assigned Labels:: Enabled via @samp{-fugly-assign}. -@end menu - -@node Ugly Implicit Argument Conversion -@subsection Implicit Argument Conversion -@cindex Hollerith constants -@cindex constants, Hollerith - -The @samp{-fno-ugly-args} option disables -passing typeless and Hollerith constants as actual arguments -in procedure invocations. -For example: - -@example -CALL FOO(4HABCD) -CALL BAR('123'O) -@end example - -@noindent -These constructs can be too easily used to create non-portable -code, but are not considered as ``ugly'' as others. -Further, they are widely used in existing Fortran source code -in ways that often are quite portable. -Therefore, they are enabled by default. - -@node Ugly Assumed-Size Arrays -@subsection Ugly Assumed-Size Arrays -@cindex arrays, assumed-size -@cindex assumed-size arrays -@cindex DIMENSION X(1) - -The @samp{-fugly-assumed} option enables -the treatment of any array with a final dimension specified as @samp{1} -as an assumed-size array, as if @samp{*} had been specified -instead. - -For example, @samp{DIMENSION X(1)} is treated as if it -had read @samp{DIMENSION X(*)} if @samp{X} is listed as -a dummy argument in a preceding @code{SUBROUTINE}, @code{FUNCTION}, -or @code{ENTRY} statement in the same program unit. - -Use an explicit lower bound to avoid this interpretation. -For example, @samp{DIMENSION X(1:1)} is never treated as if -it had read @samp{DIMENSION X(*)} or @samp{DIMENSION X(1:*)}. -Nor is @samp{DIMENSION X(2-1)} affected by this option, -since that kind of expression is unlikely to have been -intended to designate an assumed-size array. - -This option is used to prevent warnings being issued about apparent -out-of-bounds reference such as @samp{X(2) = 99}. - -It also prevents the array from being used in contexts that -disallow assumed-size arrays, such as @samp{PRINT *,X}. -In such cases, a diagnostic is generated and the source file is -not compiled. - -The construct affected by this option is used only in old code -that pre-exists the widespread acceptance of adjustable and assumed-size -arrays in the Fortran community. - -@emph{Note:} This option does not affect how @samp{DIMENSION X(1)} is -treated if @samp{X} is listed as a dummy argument only -@emph{after} the @code{DIMENSION} statement (presumably in -an @code{ENTRY} statement). -For example, @samp{-fugly-assumed} has no effect on the -following program unit: - -@example -SUBROUTINE X -REAL A(1) -RETURN -ENTRY Y(A) -PRINT *, A -END -@end example - -@node Ugly Complex Part Extraction -@subsection Ugly Complex Part Extraction -@cindex complex values -@cindex real part -@cindex imaginary part - -The @samp{-fugly-complex} option enables -use of the @code{REAL()} and @code{AIMAG()} -intrinsics with arguments that are -@code{COMPLEX} types other than @code{COMPLEX(KIND=1)}. - -With @samp{-ff90} in effect, these intrinsics return -the unconverted real and imaginary parts (respectively) -of their argument. - -With @samp{-fno-f90} in effect, these intrinsics convert -the real and imaginary parts to @code{REAL(KIND=1)}, and return -the result of that conversion. - -Due to this ambiguity, the GNU Fortran language defines -these constructs as invalid, except in the specific -case where they are entirely and solely passed as an -argument to an invocation of the @code{REAL()} intrinsic. -For example, - -@example -REAL(REAL(Z)) -@end example - -@noindent -is permitted even when @samp{Z} is @code{COMPLEX(KIND=2)} -and @samp{-fno-ugly-complex} is in effect, because the -meaning is clear. - -@code{g77} enforces this restriction, unless @samp{-fugly-complex} -is specified, in which case the appropriate interpretation is -chosen and no diagnostic is issued. - -@xref{CMPAMBIG}, for information on how to cope with existing -code with unclear expectations of @code{REAL()} and @code{AIMAG()} -with @code{COMPLEX(KIND=2)} arguments. - -@xref{RealPart Intrinsic}, for information on the @code{REALPART()} -intrinsic, used to extract the real part of a complex expression -without conversion. -@xref{ImagPart Intrinsic}, for information on the @code{IMAGPART()} -intrinsic, used to extract the imaginary part of a complex expression -without conversion. - -@node Ugly Null Arguments -@subsection Ugly Null Arguments -@cindex trailing commas -@cindex commas, trailing -@cindex null arguments -@cindex arguments, null - -The @samp{-fugly-comma} option enables -use of a single trailing comma to mean ``pass an extra trailing null -argument'' in a list of actual arguments to a procedure other than a -statement function, and use of an empty list of arguments to -mean ``pass a single null argument''. - -@cindex omitting arguments -@cindex arguments, omitting -(Null arguments often are used in some procedure-calling -schemes to indicate omitted arguments.) - -For example, @samp{CALL FOO(,)} means ``pass -two null arguments'', rather than ``pass one null argument''. -Also, @samp{CALL BAR()} means ``pass one null argument''. - -This construct is considered ``ugly'' because it does not -provide an elegant way to pass a single null argument -that is syntactically distinct from passing no arguments. -That is, this construct changes the meaning of code that -makes no use of the construct. - -So, with @samp{-fugly-comma} in force, @samp{CALL FOO()} -and @samp{I = JFUNC()} pass a single null argument, instead -of passing no arguments as required by the Fortran 77 and -90 standards. - -@emph{Note:} Many systems gracefully allow the case -where a procedure call passes one extra argument that the -called procedure does not expect. - -So, in practice, there might be no difference in -the behavior of a program that does @samp{CALL FOO()} -or @samp{I = JFUNC()} and is compiled with @samp{-fugly-comma} -in force as compared to its behavior when compiled -with the default, @samp{-fno-ugly-comma}, in force, -assuming @samp{FOO} and @samp{JFUNC} do not expect any -arguments to be passed. - -@node Ugly Conversion of Initializers -@subsection Ugly Conversion of Initializers - -The constructs disabled by @samp{-fno-ugly-init} are: - -@itemize @bullet -@cindex Hollerith constants -@cindex constants, Hollerith -@item -Use of Hollerith and typeless constants in contexts where they set -initial (compile-time) values for variables, arrays, and named -constants---that is, @code{DATA} and @code{PARAMETER} statements, plus -type-declaration statements specifying initial values. - -Here are some sample initializations that are disabled by the -@samp{-fno-ugly-init} option: - -@example -PARAMETER (VAL='9A304FFE'X) -REAL*8 STRING/8HOUTPUT00/ -DATA VAR/4HABCD/ -@end example - -@cindex character constants -@cindex constants, character -@item -In the same contexts as above, use of character constants to initialize -numeric items and vice versa (one constant per item). - -Here are more sample initializations that are disabled by the -@samp{-fno-ugly-init} option: - -@example -INTEGER IA -CHARACTER BELL -PARAMETER (IA = 'A') -PARAMETER (BELL = 7) -@end example - -@item -Use of Hollerith and typeless constants on the right-hand side -of assignment statements to numeric types, and in other -contexts (such as passing arguments in invocations of -intrinsic procedures and statement functions) that -are treated as assignments to known types (the dummy -arguments, in these cases). - -Here are sample statements that are disabled by the -@samp{-fno-ugly-init} option: - -@example -IVAR = 4HABCD -PRINT *, IMAX0(2HAB, 2HBA) -@end example -@end itemize - -The above constructs, when used, -can tend to result in non-portable code. -But, they are widely used in existing Fortran code in ways -that often are quite portable. -Therefore, they are enabled by default. - -@node Ugly Integer Conversions -@subsection Ugly Integer Conversions - -The constructs enabled via @samp{-fugly-logint} are: - -@itemize @bullet -@item -Automatic conversion between @code{INTEGER} and @code{LOGICAL} as -dictated by -context (typically implies nonportable dependencies on how a -particular implementation encodes @code{.TRUE.} and @code{.FALSE.}). - -@item -Use of a @code{LOGICAL} variable in @code{ASSIGN} and assigned-@code{GOTO} -statements. -@end itemize - -The above constructs are disabled by default because use -of them tends to lead to non-portable code. -Even existing Fortran code that uses that often turns out -to be non-portable, if not outright buggy. - -Some of this is due to differences among implementations as -far as how @code{.TRUE.} and @code{.FALSE.} are encoded as -@code{INTEGER} values---Fortran code that assumes a particular -coding is likely to use one of the above constructs, and is -also likely to not work correctly on implementations using -different encodings. - -@xref{Equivalence Versus Equality}, for more information. - -@node Ugly Assigned Labels -@subsection Ugly Assigned Labels -@cindex ASSIGN statement -@cindex statements, ASSIGN -@cindex assigned labels -@cindex pointers - -The @samp{-fugly-assign} option forces @code{g77} to use the -same storage for assigned labels as it would for a normal -assignment to the same variable. - -For example, consider the following code fragment: - -@example -I = 3 -ASSIGN 10 TO I -@end example - -@noindent -Normally, for portability and improved diagnostics, @code{g77} -reserves distinct storage for a ``sibling'' of @samp{I}, used -only for @code{ASSIGN} statements to that variable (along with -the corresponding assigned-@code{GOTO} and assigned-@samp{FORMAT}-I/O -statements that reference the variable). - -However, some code (that violates the ANSI FORTRAN 77 standard) -attempts to copy assigned labels among variables involved with -@code{ASSIGN} statements, as in: - -@example -ASSIGN 10 TO I -ISTATE(5) = I -@dots{} -J = ISTATE(ICUR) -GOTO J -@end example - -@noindent -Such code doesn't work under @code{g77} unless @samp{-fugly-assign} -is specified on the command-line, ensuring that the value of @code{I} -referenced in the second line is whatever value @code{g77} uses -to designate statement label @samp{10}, so the value may be -copied into the @samp{ISTATE} array, later retrieved into a -variable of the appropriate type (@samp{J}), and used as the target of -an assigned-@code{GOTO} statement. - -@emph{Note:} To avoid subtle program bugs, -when @samp{-fugly-assign} is specified, -@code{g77} requires the type of variables -specified in assigned-label contexts -@emph{must} be the same type returned by @code{%LOC()}. -On many systems, this type is effectively the same -as @code{INTEGER(KIND=1)}, while, on others, it is -effectively the same as @code{INTEGER(KIND=2)}. - -Do @emph{not} depend on @code{g77} actually writing valid pointers -to these variables, however. -While @code{g77} currently chooses that implementation, it might -be changed in the future. - -@xref{Assigned Statement Labels,,Assigned Statement Labels (ASSIGN and GOTO)}, -for implementation details on assigned-statement labels. - -@node Compiler -@chapter The GNU Fortran Compiler - -The GNU Fortran compiler, @code{g77}, supports programs written -in the GNU Fortran language and in some other dialects of Fortran. - -Some aspects of how @code{g77} works are universal regardless -of dialect, and yet are not properly part of the GNU Fortran -language itself. -These are described below. - -@emph{Note: This portion of the documentation definitely needs a lot -of work!} - -@menu -* Compiler Types:: -* Compiler Constants:: -* Compiler Intrinsics:: -@end menu - -@node Compiler Types -@section Compiler Types -@cindex types, of data -@cindex data types - -Fortran implementations have a fair amount of freedom given them by the -standard as far as how much storage space is used and how much precision -and range is offered by the various types such as @code{LOGICAL(KIND=1)}, -@code{INTEGER(KIND=1)}, @code{REAL(KIND=1)}, @code{REAL(KIND=2)}, -@code{COMPLEX(KIND=1)}, and @code{CHARACTER}. -Further, many compilers offer so-called @samp{*@var{n}} notation, but -the interpretation of @var{n} varies across compilers and target architectures. - -The standard requires that @code{LOGICAL(KIND=1)}, @code{INTEGER(KIND=1)}, -and @code{REAL(KIND=1)} -occupy the same amount of storage space, and that @code{COMPLEX(KIND=1)} -and @code{REAL(KIND=2)} take twice as much storage space as @code{REAL(KIND=1)}. -Further, it requires that @code{COMPLEX(KIND=1)} -entities be ordered such that when a @code{COMPLEX(KIND=1)} variable is -storage-associated (such as via @code{EQUIVALENCE}) -with a two-element @code{REAL(KIND=1)} array named @samp{R}, @samp{R(1)} -corresponds to the real element and @samp{R(2)} to the imaginary -element of the @code{COMPLEX(KIND=1)} variable. - -(Few requirements as to precision or ranges of any of these are -placed on the implementation, nor is the relationship of storage sizes of -these types to the @code{CHARACTER} type specified, by the standard.) - -@code{g77} follows the above requirements, warning when compiling -a program requires placement of items in memory that contradict the -requirements of the target architecture. -(For example, a program can require placement of a @code{REAL(KIND=2)} -on a boundary that is not an even multiple of its size, but still an -even multiple of the size of a @code{REAL(KIND=1)} variable. -On some target architectures, using the canonical -mapping of Fortran types to underlying architectural types, such -placement is prohibited by the machine definition or -the Application Binary Interface (ABI) in force for -the configuration defined for building @code{gcc} and @code{g77}. -@code{g77} warns about such -situations when it encounters them.) - -@code{g77} follows consistent rules for configuring the mapping between Fortran -types, including the @samp{*@var{n}} notation, and the underlying architectural -types as accessed by a similarly-configured applicable version of the -@code{gcc} compiler. -These rules offer a widely portable, consistent Fortran/C -environment, although they might well conflict with the expectations of -users of Fortran compilers designed and written for particular -architectures. - -These rules are based on the configuration that is in force for the -version of @code{gcc} built in the same release as @code{g77} (and -which was therefore used to build both the @code{g77} compiler -components and the @code{libf2c} run-time library): - -@table @code -@cindex REAL(KIND=1) type -@cindex types, REAL(KIND=1) -@item REAL(KIND=1) -Same as @code{float} type. - -@cindex REAL(KIND=2) type -@cindex types, REAL(KIND=2) -@item REAL(KIND=2) -Same as whatever floating-point type that is twice the size -of a @code{float}---usually, this is a @code{double}. - -@cindex INTEGER(KIND=1) type -@cindex types, INTEGER(KIND=1) -@item INTEGER(KIND=1) -Same as an integral type that is occupies the same amount -of memory storage as @code{float}---usually, this is either -an @code{int} or a @code{long int}. - -@cindex LOGICAL(KIND=1) type -@cindex types, LOGICAL(KIND=1) -@item LOGICAL(KIND=1) -Same @code{gcc} type as @code{INTEGER(KIND=1)}. - -@cindex INTEGER(KIND=2) type -@cindex types, INTEGER(KIND=2) -@item INTEGER(KIND=2) -Twice the size, and usually nearly twice the range, -as @code{INTEGER(KIND=1)}---usually, this is either -a @code{long int} or a @code{long long int}. - -@cindex LOGICAL(KIND=2) type -@cindex types, LOGICAL(KIND=2) -@item LOGICAL(KIND=2) -Same @code{gcc} type as @code{INTEGER(KIND=2)}. - -@cindex INTEGER(KIND=3) type -@cindex types, INTEGER(KIND=3) -@item INTEGER(KIND=3) -Same @code{gcc} type as signed @code{char}. - -@cindex LOGICAL(KIND=3) type -@cindex types, LOGICAL(KIND=3) -@item LOGICAL(KIND=3) -Same @code{gcc} type as @code{INTEGER(KIND=3)}. - -@cindex INTEGER(KIND=6) type -@cindex types, INTEGER(KIND=6) -@item INTEGER(KIND=6) -Twice the size, and usually nearly twice the range, -as @code{INTEGER(KIND=3)}---usually, this is -a @code{short}. - -@cindex LOGICAL(KIND=6) type -@cindex types, LOGICAL(KIND=6) -@item LOGICAL(KIND=6) -Same @code{gcc} type as @code{INTEGER(KIND=6)}. - -@cindex COMPLEX(KIND=1) type -@cindex types, COMPLEX(KIND=1) -@item COMPLEX(KIND=1) -Two @code{REAL(KIND=1)} scalars (one for the real part followed by -one for the imaginary part). - -@cindex COMPLEX(KIND=2) type -@cindex types, COMPLEX(KIND=2) -@item COMPLEX(KIND=2) -Two @code{REAL(KIND=2)} scalars. - -@cindex *@var{n} notation -@item @var{numeric-type}*@var{n} -(Where @var{numeric-type} is any type other than @code{CHARACTER}.)@ -Same as whatever @code{gcc} type occupies @var{n} times the storage -space of a @code{gcc} @code{char} item. - -@cindex DOUBLE PRECISION type -@cindex types, DOUBLE PRECISION -@item DOUBLE PRECISION -Same as @code{REAL(KIND=2)}. - -@cindex DOUBLE COMPLEX type -@cindex types, DOUBLE COMPLEX -@item DOUBLE COMPLEX -Same as @code{COMPLEX(KIND=2)}. -@end table - -Note that the above are proposed correspondences and might change -in future versions of @code{g77}---avoid writing code depending -on them. - -Other types supported by @code{g77} -are derived from gcc types such as @code{char}, @code{short}, -@code{int}, @code{long int}, @code{long long int}, @code{long double}, -and so on. -That is, whatever types @code{gcc} already supports, @code{g77} supports -now or probably will support in a future version. -The rules for the @samp{@var{numeric-type}*@var{n}} notation -apply to these types, -and new values for @samp{@var{numeric-type}(KIND=@var{n})} will be -assigned in a way that encourages clarity, consistency, and portability. - -@node Compiler Constants -@section Compiler Constants -@cindex constants -@cindex types, constants - -@code{g77} strictly assigns types to @emph{all} constants not -documented as ``typeless'' (typeless constants including @samp{'1'Z}, -for example). -Many other Fortran compilers attempt to assign types to typed constants -based on their context. -This results in hard-to-find bugs, nonportable -code, and is not in the spirit (though it strictly follows the letter) -of the 77 and 90 standards. - -@code{g77} might offer, in a future release, explicit constructs by -which a wider variety of typeless constants may be specified, and/or -user-requested warnings indicating places where @code{g77} might differ -from how other compilers assign types to constants. - -@xref{Context-Sensitive Constants}, for more information on this issue. +Number 65 is the ``classic'' ANSI FORTRAN 77 model as implemented on many +non-UNIX machines whereby all the source is translated to uppercase. +Use @samp{-fcase-upper} to specify this combination. -@node Compiler Intrinsics -@section Compiler Intrinsics +Number 66 is the ``canonical'' UNIX model whereby all the source is +translated to lowercase. +Use @samp{-fcase-lower} to specify this combination. -@code{g77} offers an ever-widening set of intrinsics. -Currently these all are procedures (functions and subroutines). +There are a few nearly useless combinations: -Some of these intrinsics are unimplemented, but their names reserved -to reduce future problems with existing code as they are implemented. -Others are implemented as part of the GNU Fortran language, while -yet others are provided for compatibility with other dialects of -Fortran but are not part of the GNU Fortran language. +@smallexample +67: A-1- B01-- C01-- D--2- +68: A-1- B01-- C01-- D---3 +69: A-1- B01-- C--23 D01-- +70: A-1- B01-- C--23 D--2- +71: A-1- B01-- C--23 D---3 +72: A--2 B01-- C0-2- D-1-- +73: A--2 B01-- C0-2- D---3 +74: A--2 B01-- C-1-3 D0-2- +75: A--2 B01-- C-1-3 D-1-- +76: A--2 B01-- C-1-3 D---3 +@end smallexample -To manage these distinctions, @code{g77} provides intrinsic @emph{groups}, -a facility that is simply an extension of the intrinsic groups provided -by the GNU Fortran language. +The above allow some programs to be compiled but with restrictions that +make most useful programs impossible: Numbers 67 and 72 warn about +@emph{any} user-defined symbol names (such as @samp{SUBROUTINE FOO}); +Numbers +68 and 73 warn about any user-defined symbol names longer than one +character that don't have at least one non-alphabetic character after +the first; +Numbers 69 and 74 disallow any references to intrinsics; +and Numbers 70, 71, 75, and 76 are combinations of the restrictions in +67+69, 68+69, 72+74, and 73+74, respectively. -@menu -* Intrinsic Groups:: How intrinsics are grouped for easy management. -* Other Intrinsics:: Intrinsics other than those in the GNU - Fortran language. -@end menu +All redundant combinations are shown in the above tables anyplace +where more than one setting is shown for a low-level switch. +For example, @samp{B0-2-} means either setting 0 or 2 is valid for switch B. +The ``proper'' setting in such a case is the one that copies the setting +of switch A---any other setting might slightly reduce the speed of +the compiler, though possibly to an unmeasurable extent. + +All remaining combinations are useless in that they prevent successful +compilation of non-null source files (source files with something other +than comments). -@node Intrinsic Groups -@subsection Intrinsic Groups +@node Intrinsics +@section Intrinsics @cindex groups of intrinsics @cindex intrinsics, groups A given specific intrinsic belongs in one or more groups. -Each group is deleted, disabled, hidden, or enabled -by default or a command-line option. -The meaning of each term follows. +Each group +is deleted, disabled, hidden, or enabled by default or a command-line +option. The meaning of each term follows. @table @b @cindex deleted intrinsics @@ -7228,7 +4167,7 @@ No intrinsics are recognized as belonging to that group. @cindex intrinsics, disabled @item Disabled Intrinsics are recognized as belonging to the group, but -references to them (other than via the @code{INTRINSIC} statement) +references to them (other than via the @samp{INTRINSIC} statement) are disallowed through that group. @cindex hidden intrinsics @@ -7236,7 +4175,7 @@ are disallowed through that group. @item Hidden Intrinsics in that group are recognized and enabled (if implemented) @emph{only} if the first mention of the actual name of an intrinsic -in a program unit is in an @code{INTRINSIC} statement. +in a program unit is in an @samp{INTRINSIC} statement. @cindex enabled intrinsics @cindex intrinsics, enabled @@ -7274,14 +4213,14 @@ that group do not exist at all, whereas disabling it tells @code{g77} to recognize them as (disabled) intrinsics in intrinsic-like contexts. Hiding a group is like enabling it, but the intrinsic must be first -named in an @code{INTRINSIC} statement to be considered a reference to the +named in an @samp{INTRINSIC} statement to be considered a reference to the intrinsic rather than to an external procedure. This might be the ``safest'' way to treat a new group of intrinsics when compiling old code, because it allows the old code to be generally written as if those new intrinsics never existed, but to be changed to use them -by inserting @code{INTRINSIC} statements in the appropriate places. -However, it should be the goal of development to use @code{EXTERNAL} +by inserting @samp{INTRINSIC} statements in the appropriate places. +However, it should be the goal of development to use @samp{EXTERNAL} for all names of external procedures that might be intrinsic names. If an intrinsic is in more than one group, it is enabled if any of its @@ -7290,7 +4229,7 @@ any of its containing groups are hidden; if not so hidden, it is disabled if any of its containing groups are disabled; if not so disabled, it is deleted. This extra complication is necessary because some intrinsics, -such as @code{IBITS}, belong to more than one group, and hence should be +such as @samp{IBITS}, belong to more than one group, and hence should be enabled if any of the groups to which they belong are enabled, and so on. @@ -7299,61 +4238,84 @@ The groups are: @cindex intrinsics, groups of @cindex groups of intrinsics @table @code -@item gnu -Intrinsics the GNU Fortran language supports that are extensions to -the Fortran standards (77 and 90). - +@item dcp +@samp{DOUBLE COMPLEX} intrinsics from the standards (F77, F90). @item f2c Intrinsics supported by AT&T's @code{f2c} converter and/or @code{libf2c}. - @item f90 Fortran 90 intrinsics. - @item mil -MIL-STD 1753 intrinsics (@code{MVBITS}, @code{IAND}, @code{BTEST}, and so on). - +MIL-STD 1753 intrinsics (@samp{MVBITS}, @samp{IAND}, @samp{BTEST}, and so on). @item unix -UNIX intrinsics (@code{IARGC}, @code{EXIT}, @code{ERF}, and so on). - +UNIX intrinsics (@samp{IARGC}, @samp{EXIT}, @samp{ERF}, and so on). @item vxt VAX/VMS FORTRAN (current as of v4) intrinsics. @end table -@node Other Intrinsics -@subsection Other Intrinsics -@cindex intrinsics, others -@cindex other intrinsics +@node Dialects +@section GNU Fortran Dialects +@cindex language dialects +@cindex dialects of language +@cindex Fortran 90 features +@cindex VXT features -@code{g77} supports intrinsics other than those in the GNU Fortran -language proper. -This set of intrinsics is described below. +The @samp{-fvxt-not-f90} and @samp{-ff90-not-vxt} command-line options +control how @code{g77} interprets certain tokens and constructs that +have different meanings in VAX FORTRAN (circa v4) and Fortran 90. +@cindex VXT extensions +@cindex extensions, VXT +(Generally, this manual uses the invented acronym VXT to refer +to many popular VAX FORTRAN extensions, though not necessarily +those that are specific to the VAX processor architecture or the +VMS operating system. +An extension offered by a Digital Fortran product that also is +offered by several other Fortran products for different kinds of +systems is probably going to be considered for inclusion in @code{g77} +someday, and is considered a VXT extension.) -@ifinfo -(Note that the blank lines appearing in the menu below -are not intentional---they result from a bug in the -@code{makeinfo} program.) -@end ifinfo +When @samp{-ff90-not-vxt} is specified, the following interpretations are made +(and, when @samp{-fvxt-not-f90} is in effect, the opposite interpretations +are made): -@c The actual documentation for intrinsics comes from -@c intdoc.texi, which in turn is automatically generated -@c from the internal g77 tables in intrin.def _and_ the -@c largely hand-written text in intdoc.h. So, if you want -@c to change or add to existing documentation on intrinsics, -@c you probably want to edit intdoc.h. -@c -@clear familyF77 -@clear familyGNU -@clear familyASC -@clear familyMIL -@clear familyF90 -@set familyVXT -@set familyFVZ -@clear familyF2C -@clear familyF2U -@include intdoc.texi +@itemize @bullet +@cindex double quotes +@cindex character constants +@cindex constants, character +@cindex octal constants +@cindex constants, octal +@item +Double-quote character (@samp{"}) delimits character constant just as does +apostrophe (@samp{'}), rather than beginning an octal constant of +@samp{INTEGER} type. -@node Other Compilers -@chapter Other Compilers +@cindex exclamation points +@cindex continuation character +@cindex characters, continuation +@cindex comment character +@cindex characters, comment +@item +An exclamation point (@samp{!}) in column 5 of fixed-form source file +treated as a continuation character rather than the beginning of a comment +(as it does in any other column). + +@cindex TYPE statement +@cindex statements, TYPE +@item +@samp{TYPE FOO} and @samp{TYPE (FOO), BAR} +statements are recognized as the Fortran 90 variety, not I/O statements. +(However, the F90 variety is @emph{not} supported, so this really just +ensures that @code{g77} will produce a diagnostic instead of trying to +implement the VXT @samp{TYPE} statement---which currently is not supported +either.) +@end itemize + +@node Object Compatibility +@section Object Compatibility +@cindex object code +@cindex code, object +@cindex compatibility, @code{f2c} +@cindex f2c compatibility +@cindex compilers, compatibility An individual Fortran source file can be compiled to an object (@file{*.o}) file instead of to the final @@ -7364,7 +4326,7 @@ version of the program is needed. However, it introduces the issue of @dfn{object compatibility} across the various object files (and libraries, or @file{*.a} files) that are linked together to produce any particular -executable file. +exectable file. Object compatibility is an issue when combining, in one program, Fortran code compiled by more than one compiler @@ -7374,7 +4336,7 @@ disagree on how to transform the names of procedures, there will normally be errors when linking such programs. Worse, if the compilers agree on naming, but disagree on issues like how to pass parameters, return arguments, and lay out -@code{COMMON} areas, the earliest detected errors might be the +@samp{COMMON} areas, the earliest detected errors might be the incorrect results produced by the program (and that assumes these errors are detected, which is not always the case). @@ -7389,8 +4351,8 @@ to @code{f2c} internals, will produce object files that are incompatible with @code{g77}.) For example, a Fortran string subroutine -argument will become two arguments on the C side: a @code{char *} -and an @code{int} length. +argument will become two arguments on the C side: a @samp{char *} +and an @samp{int} length. Much of this compatibility results from the fact that @code{g77} uses the same run-time library, @code{libf2c}, used by @@ -7401,34 +4363,31 @@ is object-compatible with @code{libf2c} and current @code{g77}, and some might offer such compatibility only when explicitly selected via a command-line option to the compiler. -@emph{Note: This portion of the documentation definitely needs a lot -of work!} - @menu * Dropping f2c Compatibility:: When speed is more important. -* Compilers Other Than f2c:: Interoperation with code from other compilers. +* Other Compilers:: Interoperation with code from other compilers. @end menu @node Dropping f2c Compatibility -@section Dropping @code{f2c} Compatibility +@subsection Dropping f2c Compatibility Specifying @samp{-fno-f2c} allows @code{g77} to generate, in some cases, faster code, by not needing to allow to the possibility of linking with code compiled by @code{f2c}. -For example, this affects how @code{REAL(KIND=1)}, -@code{COMPLEX(KIND=1)}, and @code{COMPLEX(KIND=2)} functions are called. +For example, this affects how @samp{REAL}, @samp{COMPLEX}, and +@samp{DOUBLE COMPLEX} functions are called. With @samp{-fno-f2c}, they are compiled as returning the appropriate @code{gcc} type -(@code{float}, @code{__complex__ float}, @code{__complex__ double}, +(@samp{float}, @samp{__complex__ float}, @samp{__complex__ double}, in many configurations). With @samp{-ff2c} in force, they are compiled differently (with perhaps slower run-time performance) to accommodate the restrictions inherent in @code{f2c}'s use of K&R -C as an intermediate language---@code{REAL(KIND=1)} functions -return C's @code{double} type, while @code{COMPLEX} functions return -@code{void} and use an extra argument pointing to a place for the functions to +C as an intermediate language---@samp{REAL} functions return double, +while @samp{COMPLEX} functions return +@samp{void} and use an extra argument pointing to a place for the functions to return their values. It is possible that, in some cases, leaving @samp{-ff2c} in force @@ -7459,22 +4418,23 @@ carefully watch for any announcements about changes to the (thus requiring recompilation). It is probable that a future version of @code{g77} will not, -by default, generate object files compatible with @code{f2c}, -and that version probably would no longer use @code{libf2c}. +by default, generate object files compatible with @code{f2c} and not +use @code{libf2c}. If you expect to depend on this compatibility in the long term, use the options @samp{-ff2c -ff2c-library} when compiling all of the applicable code. -This should cause future versions of @code{g77} either to produce -compatible code (at the expense of the availability of some features and -performance), or at the very least, to produce diagnostics. +This should either cause @code{g77} to produce compatible code +(at the expense of the availability of some features and +performance), or at the very least trigger +compiler warning messages, in future versions of @code{g77}. -@node Compilers Other Than f2c -@section Compilers Other Than @code{f2c} +@node Other Compilers +@subsection Other Compilers On systems with Fortran compilers other than @code{f2c} and @code{g77}, code compiled by @code{g77} is not expected to work well with code compiled by the native compiler. -(This is true for @code{f2c}-compiled objects as well.)@ +(This is true for @code{f2c}-compiled objects as well.) Libraries compiled with the native compiler probably will have to be recompiled with @code{g77} to be used with @code{g77}-compiled code. @@ -7514,159 +4474,221 @@ would have to add @samp{-L/usr/lang/SCx.x -lF77 -lV77} to the link command. @end itemize -@node Other Languages -@chapter Other Languages +@node Distensions +@section Distensions +@cindex distensions +@cindex ugly features +@cindex features, ugly -@emph{Note: This portion of the documentation definitely needs a lot -of work!} +The @samp{-fugly-*} command-line options determine whether certain +features supported by VAX FORTRAN and other such compilers, but considered +too ugly to be in code that can be changed to use safer and/or more +portable constructs, are accepted. +These are humorously referred to as ``distensions'', +extensions that just plain look ugly in the harsh light of day. @menu -* Interoperating with C and C++:: +* Ugly Implicit Argument Conversion:: Disabled via @samp{-fno-ugly-args}. +* Ugly Assumed-Size Arrays:: Enabled via @samp{-fugly-assumed}. +* Ugly Null Arguments:: Enabled via @samp{-fugly-comma}. +* Ugly Conversion of Initializers:: Disabled via @samp{-fno-ugly-init}. +* Ugly Integer Conversions:: Enabled via @samp{-fugly-logint}. @end menu -@node Interoperating with C and C++ -@section Tools and advice for interoperating with C and C++ - -@cindex C, linking with -@cindex C++, linking with -@cindex linking with C -The following discussion assumes that you are running @code{g77} in @code{f2c} -compatibility mode, i.e.@ not using @samp{-fno-f2c}. -It provides some -advice about quick and simple techniques for linking Fortran and C (or -C++), the most common requirement. -For the full story consult the -description of code generation. -@xref{Debugging and Interfacing}. - -When linking Fortran and C, it's usually best to use @code{g77} to do -the linking so that the correct libraries are included (including the -maths one). -If you're linking with C++ you will want to add -@samp{-lstdc++}, @samp{-lg++} or whatever. -If you need to use another -driver program (or @code{ld} directly), -you can find out what linkage -options @code{g77} passes by running @samp{g77 -v}. +@node Ugly Implicit Argument Conversion +@subsection Implicit Argument Conversion + +The construct disabled via @samp{-fno-ugly-args} is: + +@itemize @bullet +@cindex Hollerith constants +@cindex constants, Hollerith +@item +Passing of typeless and Hollerith constants as actual arguments +in procedure invocations. + +For example, @samp{CALL FOO(4HABCD)}. + +This construct can be too easily used to create non-portable +code, but is not considered as ``ugly'' as others. +Further, it is widely used in existing Fortran source code +in ways that often are quite portable. +Therefore, it is enabled by default. +@end itemize + +@cindex arrays, assumed-size +@cindex assumed-size arrays +@cindex DIMENSION X(1) +@node Ugly Assumed-Size Arrays +@subsection Ugly Assumed-Size Arrays + +The construct enabled via @samp{-fugly-assumed} is: + +@itemize @bullet +@item +Treatment of any array with a final dimension specified as @samp{1} +as an assumed-size array, as if @samp{*} had been specified +instead. + +For example, @samp{DIMENSION X(1)} is treated as if it +had read @samp{DIMENSION X(*)}. + +Use an explicit lower bound to avoid this interpretation. +For example, @samp{DIMENSION X(1:1)} is never treated as if +it had read @samp{DIMENSION X(*)} or @samp{DIMENSION X(1:*)}. + +This option prevents a warning being issued about an apparent +out-of-bounds reference such as @samp{X(2) = 99}. + +It also prevents the array from being used in contexts that +disallow assumed-size arrays, such as @samp{PRINT *,X}. + +This construct is used only in very old code that pre-exists +the widespread acceptance of adjustable and assumed-size +arrays in the Fortran community. +@end itemize + +@cindex trailing commas +@cindex commas, trailing +@cindex null arguments +@cindex arguments, null +@node Ugly Null Arguments +@subsection Ugly Null Arguments + +The construct enabled via @samp{-fugly-comma} is: + +@itemize @bullet +@item +Use of a single trailing comma to mean ``pass an extra trailing null +argument'' in a list of actual arguments to a procedure other than a +statement function, and an empty list of arguments to +mean ``pass a single null argument''. + +@cindex omitting arguments +@cindex arguments, omitting +(Null arguments often are used in some procedure-calling +schemes to indicate omitted arguments.) + +For example, @samp{CALL FOO(,)} means ``pass +two null arguments'', rather than ``pass one null argument''. +Also, @samp{CALL BAR()} means ``pass one null argument''. + +This construct is considered ``ugly'' because it does not +provide an elegant way to pass a single null argument +that is syntactically distinct from passing no arguments. +That is, this construct changes the meaning of code that +makes no use of the construct. + +So, with @samp{-fugly-comma} in force, @samp{CALL FOO()} +and @samp{I = JFUNC()} pass a single null argument, instead +of passing no arguments as required by the Fortran 77 and +90 standards. + +@emph{Note:} Many systems gracefully allow the case +where a procedure call passes one extra argument that the +called procedure does not expect. + +So, in practice, there might be no difference in +the behavior of a program that does @samp{CALL FOO()} +or @samp{I = JFUNC()} and is compiled with @samp{-fugly-comma} +in force as compared to its behavior when compiled +with the default, @samp{-fno-ugly-comma}, in force, +assuming @samp{FOO} and @samp{JFUNC} do not expect any +arguments to be passed. +@end itemize + +@node Ugly Conversion of Initializers +@subsection Ugly Conversion of Initializers + +The constructs disabled by @samp{-fno-ugly-init} are: + +@itemize @bullet +@cindex Hollerith constants +@cindex constants, Hollerith +@item +Use of Hollerith and typeless constants in contexts where they set +initial (compile-time) values for variables, arrays, and named +constants---that is, @samp{DATA} and @samp{PARAMETER} statements, plus +type-declaration statements specifying initial values. + +Here are some sample initializations that are disabled by the +@samp{-fno-ugly-init} option: + +@example +PARAMETER (VAL='9A304FFE'X) +REAL*8 STRING/8HOUTPUT00/ +DATA VAR/4HABCD/ +@end example + +@cindex character constants +@cindex constants, character +@item +In the same contexts as above, use of character constants to initialize +numeric items and vice versa (one constant per item). + +Here are more sample initializations that are disabled by the +@samp{-fno-ugly-init} option: + +@example +INTEGER IA +CHARACTER BELL +PARAMETER (IA = 'A') +PARAMETER (BELL = 7) +@end example + +@item +Use of Hollerith and typeless constants on the right-hand side +of assignment statements to numeric types, and in other +contexts (such as passing arguments in invocations of +intrinsic procedures and statement functions) that +are treated as assignments to known types (the dummy +arguments, in these cases). + +Here are sample statements that are disabled by the +@samp{-fno-ugly-init} option: + +@example +IVAR = 4HABCD +PRINT *, IMAX0(2HAB, 2HBA) +@end example +@end itemize + +The above constructs, when used, +can tend to result in non-portable code. +But, they are widely used in existing Fortran code in ways +that often are quite portable. +Therefore, they are enabled by default. + +@node Ugly Integer Conversions +@subsection Ugly Integer Conversions + +The constructs enabled via @samp{-fugly-logint} are: + +@itemize @bullet +@item +Automatic conversion between @samp{INTEGER} and @samp{LOGICAL} as +dictated by +context (typically implies nonportable dependencies on how a +particular implementation encodes @samp{.TRUE.} and @samp{.FALSE.}). + +@item +Use of a @samp{LOGICAL} variable in @samp{ASSIGN} and assigned-@samp{GOTO} +statements. +@end itemize + +The above constructs are disabled by default because use +of them tends to lead to non-portable code. +Even existing Fortran code that uses that often turns out +to be non-portable, if not outright buggy. -@menu -* C Interfacing Tools:: -* C Access to Type Information:: -* f2c Skeletons and Prototypes:: -* C++ Considerations:: -* Startup Code:: -@end menu +Some of this is due to differences among implementations as +far as how @samp{.TRUE.} and @samp{.FALSE.} are encoded as +@samp{INTEGER} values---Fortran code that assumes a particular +coding is likely to use one of the above constructs, and is +also likely to not work correctly on implementations using +different encodings. -@node C Interfacing Tools -@subsection C Interfacing Tools -@pindex f2c -@cindex cfortran.h -@cindex Netlib -Even if you don't actually use it as a compiler, @samp{f2c} from -@url{ftp://ftp.netlib.org/f2c/src}, can be a useful tool when you're -interfacing (linking) Fortran and C@. -@xref{f2c Skeletons and Prototypes,,Generating Skeletons and Prototypes with @code{f2c}}. - -To use @code{f2c} for this purpose you only need retrieve and -build the @file{src} directory from the distribution, consult the -@file{README} instructions there for machine-specifics, and install the -@code{f2c} program on your path. - -Something else that might be useful is @samp{cfortran.h} from -@url{ftp://zebra/desy.de/cfortran}. -This is a fairly general tool which -can be used to generate interfaces for calling in both directions -between Fortran and C@. -It can be used in @code{f2c} mode with -@code{g77}---consult its documentation for details. - -@node C Access to Type Information -@subsection Accessing Type Information in C - -@cindex types, Fortran/C -Generally, C code written to link with -@code{g77} code---calling and/or being -called from Fortran---should @samp{#include } to define the C -versions of the Fortran types. -Don't assume Fortran @code{INTEGER} types -correspond to C @samp{int}s, for instance; instead, declare them as -@code{integer}, a type defined by @file{f2c.h}. -@file{f2c.h} is installed where @code{gcc} will find it by -default, assuming you use a copy of @code{gcc} compatible with -@code{g77}, probably built at the same time as @code{g77}. - -@node f2c Skeletons and Prototypes -@subsection Generating Skeletons and Prototypes with @code{f2c} - -@pindex f2c -@cindex -fno-second-underscore -A simple and foolproof way to write @code{g77}-callable C routines---e.g.@ to -interface with an existing library---is to write a file (named, for -example, @file{fred.f}) of dummy Fortran -skeletons comprising just the declaration of the routine(s) and dummy -arguments plus @samp{END} statements. -Then run @code{f2c} on file @file{fred.f} to produce @file{fred.c} -into which you can edit -useful code, confident the calling sequence is correct, at least. -(There are some errors otherwise commonly made in generating C -interfaces with f2c conventions, such as not using @code{doublereal} as -the return type of a @code{REAL} @code{FUNCTION}.) - -@pindex ftnchek -@code{f2c} also can help with calling Fortran from C, using its -@samp{-P} option to generate C prototypes appropriate for calling the -Fortran.@footnote{The files generated like this can also be used for -inter-unit consistency checking of dummy and actual arguments, although -the @samp{ftnchek} tool from @url{ftp://ftp.netlib.org/fortran} is -probably better for this purpose.} -If the Fortran code containing any -routines to be called from C is in file @file{joe.f}, use the command -@kbd{f2c -P joe.f} to generate the file @file{joe.P} containing -prototype information. -@code{#include} this in the C which has to call -the Fortran routines to make sure you get it right. - -@xref{Arrays,,Arrays (DIMENSION}, for information on the differences -between the way Fortran (including compilers like @code{g77}) and -C handle arrays. - -@node C++ Considerations -@subsection C++ Considerations - -@cindex C++ -@code{f2c} can be used to generate suitable code for compilation with a -C++ system using the @samp{-C++} option. -The important thing about linking @code{g77}-compiled -code with C++ is that the prototypes for the @code{g77} -routines must specify C linkage to avoid name mangling. -So, use an @samp{extern "C"} declaration. -@code{f2c}'s @samp{-C++} option will take care -of this when generating skeletons or prototype files as above, and also -avoid clashes with C++ reserved words in addition to those in C@. - -@node Startup Code -@subsection Startup Code - -@cindex startup code -@cindex runtime initialization -@cindex initialization, runtime -Unlike with some runtime systems, it shouldn't be necessary (unless there are -bugs) to use a Fortran main program to ensure the -runtime---specifically the i/o system---is initialized. -However, to use -the @code{g77} intrinsics @code{GETARG()} and @code{IARGC()} the -@code{main()} routine from the @file{libf2c} library must be used, either -explicitly or implicitly by using a Fortran main program. -This -@code{main()} program calls @code{MAIN__()} (where the names are C-type -@code{extern} names, i.e.@ not mangled). -You need to provide this -nullary procedure as the entry point for your C code if using -@file{libf2c}'s @code{main}. -In some cases it might be necessary to -provide a dummy version of this to avoid linkers complaining about -failure to resolve @code{MAIN__()} if linking against @file{libf2c} and -not using @code{main()} from it. +@xref{Equivalence Versus Equality}, for more information. @include install.texi @@ -7715,221 +4737,20 @@ are installed, because new versions can change the behaviors described in this section. @menu +* Names:: Naming of user-defined variables, procedures, etc. * Main Program Unit:: How @code{g77} compiles a main program unit. +* Arrays:: Dealing with (possibly multi-dimensional) arrays. * Procedures:: How @code{g77} constructs parameter lists for procedures. -* Functions:: Functions returning floating-point or character data. -* Names:: Naming of user-defined variables, procedures, etc. -* Common Blocks:: Accessing common variables while debugging. -* Local Equivalence Areas:: Accessing @code{EQUIVALENCE} while debugging. -* Complex Variables:: How @code{g77} performs complex arithmetic. -* Arrays:: Dealing with (possibly multi-dimensional) arrays. * Adjustable Arrays:: Special consideration for adjustable arrays. -* Alternate Entry Points:: How @code{g77} implements alternate @code{ENTRY}. * Alternate Returns:: How @code{g77} handles alternate returns. -* Assigned Statement Labels:: How @code{g77} handles @code{ASSIGN}. -* Run-time Library Errors:: Meanings of some @code{IOSTAT=} values. +* Functions:: Functions returning floating-point or character data. +* Common Blocks:: Accessing common variables while debugging. +* Local Equivalence Areas:: Accessing @samp{EQUIVALENCE} while debugging. +* Alternate Entry Points:: How @code{g77} implements alternate @samp{ENTRY}. +* Assigned Statement Labels:: How @code{g77} handles @samp{ASSIGN}. @end menu -@node Main Program Unit -@section Main Program Unit (PROGRAM) -@cindex PROGRAM statement -@cindex statements, PROGRAM - -When @code{g77} compiles a main program unit, it gives it the public -procedure name @samp{MAIN__}. -The @code{libf2c} library has the actual @code{main()} procedure -as is typical of C-based environments, and -it is this procedure that performs some initial start-up -activity and then calls @samp{MAIN__}. - -Generally, @code{g77} and @code{libf2c} are designed so that you need not -include a main program unit written in Fortran in your program---it -can be written in C or some other language. -Especially for I/O handling, this is the case, although @code{g77} version 0.5.16 -includes a bug fix for @code{libf2c} that solved a problem with using the -@code{OPEN} statement as the first Fortran I/O activity in a program -without a Fortran main program unit. - -However, if you don't intend to use @code{g77} (or @code{f2c}) to compile -your main program unit---that is, if you intend to compile a @code{main()} -procedure using some other language---you should carefully -examine the code for @code{main()} in @code{libf2c}, found in the source -file @file{gcc/f/runtime/libF77/main.c}, to see what kinds of things -might need to be done by your @code{main()} in order to provide the -Fortran environment your Fortran code is expecting. - -@cindex IARGC() intrinsic -@cindex intrinsics, IARGC() -@cindex GETARG() intrinsic -@cindex intrinsics, GETARG() -For example, @code{libf2c}'s @code{main()} sets up the information used by -the @code{IARGC} and @code{GETARG} intrinsics. -Bypassing @code{libf2c}'s @code{main()} -without providing a substitute for this activity would mean -that invoking @code{IARGC} and @code{GETARG} would produce undefined -results. - -@cindex debugging -@cindex main program unit, debugging -@cindex main() -@cindex MAIN__() -@cindex .gdbinit -When debugging, one implication of the fact that @code{main()}, which -is the place where the debugged program ``starts'' from the -debugger's point of view, is in @code{libf2c} is that you won't be -starting your Fortran program at a point you recognize as your -Fortran code. - -The standard way to get around this problem is to set a break -point (a one-time, or temporary, break point will do) at -the entrance to @samp{MAIN__}, and then run the program. -A convenient way to do so is to add the @code{gdb} command - -@example -tbreak MAIN__ -@end example - -@noindent -to the file @file{.gdbinit} in the directory in which you're debugging -(using @code{gdb}). - -After doing this, the debugger will see the current execution -point of the program as at the beginning of the main program -unit of your program. - -Of course, if you really want to set a break point at some -other place in your program and just start the program -running, without first breaking at @samp{MAIN__}, -that should work fine. - -@node Procedures -@section Procedures (SUBROUTINE and FUNCTION) -@cindex procedures -@cindex SUBROUTINE statement -@cindex statements, SUBROUTINE -@cindex FUNCTION statement -@cindex statements, FUNCTION -@cindex signature of procedures - -Currently, @code{g77} passes arguments via reference---specifically, -by passing a pointer to the location in memory of a variable, array, -array element, a temporary location that holds the result of evaluating an -expression, or a temporary or permanent location that holds the value -of a constant. - -Procedures that accept @code{CHARACTER} arguments are implemented by -@code{g77} so that each @code{CHARACTER} argument has two actual arguments. - -The first argument occupies the expected position in the -argument list and has the user-specified name. -This argument -is a pointer to an array of characters, passed by the caller. - -The second argument is appended to the end of the user-specified -calling sequence and is named @samp{__g77_length_@var{x}}, where @var{x} -is the user-specified name. -This argument is of the C type @code{ftnlen} -(see @file{gcc/f/runtime/f2c.h.in} for information on that type) and -is the number of characters the caller has allocated in the -array pointed to by the first argument. - -A procedure will ignore the length argument if @samp{X} is not declared -@code{CHARACTER*(*)}, because for other declarations, it knows the -length. -Not all callers necessarily ``know'' this, however, which -is why they all pass the extra argument. - -The contents of the @code{CHARACTER} argument are specified by the -address passed in the first argument (named after it). -The procedure can read or write these contents as appropriate. - -When more than one @code{CHARACTER} argument is present in the argument -list, the length arguments are appended in the order -the original arguments appear. -So @samp{CALL FOO('HI','THERE')} is implemented in -C as @samp{foo("hi","there",2,5);}, ignoring the fact that @code{g77} -does not provide the trailing null bytes on the constant -strings (@code{f2c} does provide them, but they are unnecessary in -a Fortran environment, and you should not expect them to be -there). - -Note that the above information applies to @code{CHARACTER} variables and -arrays @strong{only}. -It does @strong{not} apply to external @code{CHARACTER} -functions or to intrinsic @code{CHARACTER} functions. -That is, no second length argument is passed to @samp{FOO} in this case: - -@example -CHARACTER X -EXTERNAL X -CALL FOO(X) -@end example - -@noindent -Nor does @samp{FOO} expect such an argument in this case: - -@example -SUBROUTINE FOO(X) -CHARACTER X -EXTERNAL X -@end example - -Because of this implementation detail, if a program has a bug -such that there is disagreement as to whether an argument is -a procedure, and the type of the argument is @code{CHARACTER}, subtle -symptoms might appear. - -@node Functions -@section Functions (FUNCTION and RETURN) -@cindex functions -@cindex FUNCTION statement -@cindex statements, FUNCTION -@cindex RETURN statement -@cindex statements, RETURN -@cindex return type of functions - -@code{g77} handles in a special way functions that return the following -types: - -@itemize @bullet -@item -@code{CHARACTER} -@item -@code{COMPLEX} -@item -@code{REAL(KIND=1)} -@end itemize - -For @code{CHARACTER}, @code{g77} implements a subroutine (a C function -returning @code{void}) -with two arguments prepended: @samp{__g77_result}, which the caller passes -as a pointer to a @code{char} array expected to hold the return value, -and @samp{__g77_length}, which the caller passes as an @code{ftnlen} value -specifying the length of the return value as declared in the calling -program. -For @code{CHARACTER*(*)}, the called function uses @samp{__g77_length} -to determine the size of the array that @samp{__g77_result} points to; -otherwise, it ignores that argument. - -For @code{COMPLEX}, when @samp{-ff2c} is in -force, @code{g77} implements -a subroutine with one argument prepended: @samp{__g77_result}, which the -caller passes as a pointer to a variable of the type of the function. -The called function writes the return value into this variable instead -of returning it as a function value. -When @samp{-fno-f2c} is in force, -@code{g77} implements a @code{COMPLEX} function as @code{gcc}'s -@samp{__complex__ float} or @samp{__complex__ double} function -(or an emulation thereof, when @samp{-femulate-complex} is in effect), -returning the result of the function in the same way as @code{gcc} would. - -For @code{REAL(KIND=1)}, when @samp{-ff2c} is in force, @code{g77} implements -a function that actually returns @code{REAL(KIND=2)} (typically -C's @code{double} type). -When @samp{-fno-f2c} is in force, @code{REAL(KIND=1)} -functions return @code{float}. - @node Names @section Names @cindex symbol names @@ -7954,15 +4775,13 @@ the transformation certainly improves the chances of colliding with incompatible externals written in other languages---but that might be intentional. -@cindex -fno-underscoring option -@cindex options, -fno-underscoring -@cindex -fno-second-underscore option -@cindex options, -fno-underscoring +@cindex -fno-underscoring +@cindex -fno-second-underscore When @samp{-funderscoring} is in force, any name (external or local) that already has at least one underscore in it is implemented by @code{g77} by appending two underscores. (This second underscore can be disabled via the -@samp{-fno-second-underscore} option.)@ +@samp{-fno-second-underscore} option.) External names are changed this way for @code{f2c} compatibility. Local names are changed this way to avoid collisions with external names that are different in the source code---@code{f2c} does the same thing, but @@ -7975,7 +4794,6 @@ For example: Max_Cost = 0 @end example -@cindex debugging @noindent Here, a user would, in the debugger, refer to this variable using the name @samp{max_cost__} (or @samp{MAX_COST__} or @samp{Max_Cost__}, @@ -8029,155 +4847,67 @@ of names, resulting in the name @samp{FOO_} or @samp{Foo_} being given to the procedure instead of @samp{foo_}, and the @samp{-fno-underscoring} option could be used to inhibit the appending of the underscore to the name. -@node Common Blocks -@section Common Blocks (COMMON) -@cindex common blocks -@cindex COMMON statement -@cindex statements, COMMON - -@code{g77} names and lays out @code{COMMON} areas the same way f2c does, -for compatibility with f2c. - -Currently, @code{g77} does not emit ``true'' debugging information for -members of a @code{COMMON} area, due to an apparent bug in the GBE. - -(As of Version 0.5.19, @code{g77} emits debugging information for such -members in the form of a constant string specifying the base name of -the aggregate area and the offset of the member in bytes from the start -of the area. -Use the @samp{-fdebug-kludge} option to enable this behavior. -In @code{gdb}, use @samp{set language c} before printing the value -of the member, then @samp{set language fortran} to restore the default -language, since @code{gdb} doesn't provide a way to print a readable -version of a character string in Fortran language mode. - -This kludge will be removed in a future version of @code{g77} that, -in conjunction with a contemporary version of @code{gdb}, -properly supports Fortran-language debugging, including access -to members of @code{COMMON} areas.) - -@xref{Code Gen Options,,Options for Code Generation Conventions}, -for information on the @samp{-fdebug-kludge} option. - -Moreover, @code{g77} currently implements a @code{COMMON} area such that its -type is an array of the C @code{char} data type. - -So, when debugging, you must know the offset into a @code{COMMON} area -for a particular item in that area, and you have to take into -account the appropriate multiplier for the respective sizes -of the types (as declared in your code) for the items preceding -the item in question as compared to the size of the @code{char} type. - -For example, using default implicit typing, the statement - -@example -COMMON I(15), R(20), T -@end example - -@noindent -results in a public 144-byte @code{char} array named @samp{_BLNK__} -with @samp{I} placed at @samp{_BLNK__[0]}, @samp{R} at @samp{_BLNK__[60]}, -and @samp{T} at @samp{_BLNK__[140]}. -(This is assuming that the target machine for -the compilation has 4-byte @code{INTEGER(KIND=1)} and @code{REAL(KIND=1)} -types.) - -@node Local Equivalence Areas -@section Local Equivalence Areas (EQUIVALENCE) -@cindex equivalence areas -@cindex local equivalence areas -@cindex EQUIVALENCE statement -@cindex statements, EQUIVALENCE - -@code{g77} treats storage-associated areas involving a @code{COMMON} -block as explained in the section on common blocks. - -A local @code{EQUIVALENCE} area is a collection of variables and arrays -connected to each other in any way via @code{EQUIVALENCE}, none of which are -listed in a @code{COMMON} statement. - -Currently, @code{g77} does not emit ``true'' debugging information for -members in a local @code{EQUIVALENCE} area, due to an apparent bug in the GBE. +@node Main Program Unit +@section Main Program Unit (PROGRAM) +@cindex PROGRAM statement +@cindex statements, PROGRAM -(As of Version 0.5.19, @code{g77} does emit debugging information for such -members in the form of a constant string specifying the base name of -the aggregate area and the offset of the member in bytes from the start -of the area. -Use the @samp{-fdebug-kludge} option to enable this behavior. -In @code{gdb}, use @samp{set language c} before printing the value -of the member, then @samp{set language fortran} to restore the default -language, since @code{gdb} doesn't provide a way to print a readable -version of a character string in Fortran language mode. +When @code{g77} compiles a main program unit, it gives it the public +procedure name @samp{MAIN__}. +The @code{libf2c} library has the actual @samp{main()} procedure +as is typical of C-based environments, and +it is this procedure that performs some initial start-up +activity and then calls @samp{MAIN__}. -This kludge will be removed in a future version of @code{g77} that, -in conjunction with a contemporary version of @code{gdb}, -properly supports Fortran-language debugging, including access -to members of @code{EQUIVALENCE} areas.) +Generally, @code{g77} and @code{libf2c} are designed so that you need not +include a main program unit written in Fortran in your program---it +can be written in C or some other language. +Especially for I/O handling, this is the case, although @code{g77-0.5.16} +includes a bug fix for @code{libf2c} that solved a problem with using the +@samp{OPEN} statement as the first Fortran I/O activity in a program +without a Fortran main program unit. -@xref{Code Gen Options,,Options for Code Generation Conventions}, -for information on the @samp{-fdebug-kludge} option. +However, if you don't intend to use @code{g77} (or @code{f2c}) to compile +your main program unit---that is, if you intend to compile a @samp{main()} +procedure using some other language---you should carefully +examine the code for @samp{main()} in @code{libf2c}, found in the source +file @file{gcc/f/runtime/libF77/main.c}, to see what kinds of things +might need to be done by your @samp{main()} in order to provide the +Fortran environment your Fortran code is expecting. -Moreover, @code{g77} implements a local @code{EQUIVALENCE} area such that its -type is an array of the C @code{char} data type. +@cindex IARGC() intrinsic +@cindex intrinsics, IARGC() +@cindex GETARG() intrinsic +@cindex intrinsics, GETARG() +For example, @code{libf2c}'s @samp{main()} sets up the information used by +the @samp{IARGC} and @samp{GETARG} intrinsics. +Bypassing @code{libf2c}'s @samp{main()} +without providing a substitute for this activity would mean +that invoking @samp{IARGC} and @samp{GETARG} would produce undefined +results. -The name @code{g77} gives this array of @code{char} type is @samp{__g77_equiv_@var{x}}, -where @var{x} is the name of the item that is placed at the beginning (offset 0) -of this array. -If more than one such item is placed at the beginning, @var{x} is -the name that sorts to the top in an alphabetical sort of the list of -such items. +@cindex debugging +@cindex main program unit, debugging +@cindex main() +@cindex MAIN__() +When debugging, one implication of the fact that @samp{main()}, which +is the place where the debugged program ``starts'' from the +debugger's point of view, is in @code{libf2c} is that you won't be +starting your Fortran program at a point you recognize as your +Fortran code. -When debugging, you must therefore access members of @code{EQUIVALENCE} -areas by specifying the appropriate @samp{__g77_equiv_@var{x}} -array section with the appropriate offset. -See the explanation of debugging @code{COMMON} blocks -for info applicable to debugging local @code{EQUIVALENCE} areas. +The standard way to get around this problem is to set a break +point (a one-time, or temporary, break point will do) at +the entrance to @samp{MAIN__}, and then run the program. -(@emph{Note:} @code{g77} version 0.5.18 and earlier chose the name -for @var{x} using a different method when more than one name was -in the list of names of entities placed at the beginning of the -array. -Though the documentation specified that the first name listed in -the @code{EQUIVALENCE} statements was chosen for @var{x}, @code{g77} -in fact chose the name using a method that was so complicated, -it seemed easier to change it to an alphabetical sort than to describe the -previous method in the documentation.) +After doing this, the debugger will see the current execution +point of the program as at the beginning of the main program +unit of your program. -@node Complex Variables -@section Complex Variables (COMPLEX) -@cindex complex variables -@cindex imaginary part of complex -@cindex COMPLEX statement -@cindex statements, COMPLEX - -As of 0.5.20, @code{g77} defaults to handling @code{COMPLEX} types -(and related intrinsics, constants, functions, and so on) -in a manner that -makes direct debugging involving these types in Fortran -language mode difficult. - -Essentially, @code{g77} implements these types using an -internal construct similar to C's @code{struct}, at least -as seen by the @code{gcc} back end. - -Currently, the back end, when outputting debugging info with -the compiled code for the assembler to digest, does not detect -these @code{struct} types as being substitutes for Fortran -complex. -As a result, the Fortran language modes of debuggers such as -@code{gdb} see these types as C @code{struct} types, which -they might or might not support. - -Until this is fixed, switch to C language mode to work with -entities of @code{COMPLEX} type and then switch back to Fortran language -mode afterward. -(In @code{gdb}, this is accomplished via @samp{set lang c} and -either @samp{set lang fortran} or @samp{set lang auto}.) - -@emph{Note:} Compiling with the @samp{-fno-emulate-complex} option -avoids the debugging problem, but is known to cause other problems -like compiler crashes and generation of incorrect code, so it is -not recommended. +Of course, if you really want to set a break point at some +other place in your program and just start the program +running, without first breaking at @samp{MAIN__}, +that should work fine. @node Arrays @section Arrays (DIMENSION) @@ -8253,95 +4983,351 @@ this can be that the expression @samp{*(&a[2][1][0] + 4293)} works fine, but that @samp{a[20][10][5]} produces the equivalent of @samp{*(&a[0][0][0] + 4305)} because of the missing lower bounds. -Come to think of it, perhaps -the behavior is due to the debugger internally compensating for -the lower bounds by offsetting the base address of @samp{a}, leaving -@samp{&a} set lower, in this case, than @samp{&a[2][1][0]} (the address of -its first element as identified by subscripts equal to the -corresponding lower bounds). +Come to think of it, perhaps +the behavior is due to the debugger internally compensating for +the lower bounds by offsetting the base address of @samp{a}, leaving +@samp{&a} set lower, in this case, than @samp{&a[2][1][0]} (the address of +its first element as identified by subscripts equal to the +corresponding lower bounds). + +You know, maybe nobody really needs to use arrays. + +@node Procedures +@section Procedures (SUBROUTINE and FUNCTION) +@cindex procedures +@cindex SUBROUTINE statement +@cindex statements, SUBROUTINE +@cindex FUNCTION statement +@cindex statements, FUNCTION +@cindex signature of procedures + +Procedures that accept @samp{CHARACTER} arguments are implemented by +@code{g77} so that each @samp{CHARACTER} argument has two actual arguments. + +The first argument occupies the expected position in the +argument list and has the user-specified name. +This argument +is a pointer to an array of characters, passed by the caller. + +The second argument is appended to the end of the user-specified +calling sequence and is named @samp{__g77_length_@var{x}}, where @var{x} +is the user-specified name. +This argument is of the C type @samp{ftnlen} +(see @file{gcc/f/runtime/f2c.h.in} for information on that type) and +is the number of characters the caller has allocated in the +array pointed to by the first argument. + +A procedure will ignore the length argument if @samp{X} is not declared +@samp{CHARACTER*(*)}, because for other declarations, it knows the +length. +Not all callers necessarily ``know'' this, however, which +is why they all pass the extra argument. + +The contents of the @samp{CHARACTER} argument are specified by the +address passed in the first argument (named after it). +The procedure can read or write these contents as appropriate. + +When more than one @samp{CHARACTER} argument is present in the argument +list, the length arguments are appended in the order +the orginal arguments appear. +So @samp{CALL FOO('HI','THERE')} is implemented in +C as @samp{foo("hi","there",2,5);}, ignoring the fact that @code{g77} +does not provide the trailing null bytes on the constant +strings (@code{f2c} does provide them, but they are unnecessary in +a Fortran environment, and you should not expect them to be +there). + +Note that the above information applies to @samp{CHARACTER} variables and +arrays @strong{only}. +It does @strong{not} apply to external @samp{CHARACTER} +functions or to intrinsic @samp{CHARACTER} functions. +That is, no second length argument is passed to @samp{FOO} in this case: + +@example +CHARACTER X +EXTERNAL X +CALL FOO(X) +@end example + +@noindent +Nor does @samp{FOO} expect such an argument in this case: + +@example +SUBROUTINE FOO(X) +CHARACTER X +EXTERNAL X +@end example + +Because of this implementation detail, if a program has a bug +such that there is disagreement as to whether an argument is +a procedure, and the type of the argument is @samp{CHARACTER}, subtle +symptoms might appear. + +@node Adjustable Arrays +@section Adjustable Arrays (DIMENSION) +@cindex arrays, adjustable +@cindex adjustable arrays +@cindex arrays, automatic +@cindex automatic arrays +@cindex DIMENSION statement +@cindex statements, DIMENSION +@cindex dimensioning arrays +@cindex arrays, dimensioning + +Adjustable and automatic arrays in Fortran require the implementation +(in this +case, the @code{g77} compiler) to ``memorize'' the expressions that +dimension the arrays each time the procedure is invoked. +This is so that subsequent changes to variables used in those +expressions, made during execution of the procedure, do not +have any effect on the dimensions of those arrays. + +For example: + +@example +REAL ARRAY(5) +DATA ARRAY/5*2/ +CALL X(ARRAY, 5) +END +SUBROUTINE X(A, N) +DIMENSION A(N) +N = 20 +PRINT *, N, A +END +@end example + +@noindent +Here, the implementation should, when running the program, print something +like: + +@example +20 2. 2. 2. 2. 2. +@end example + +@noindent +Note that this shows that while the value of @samp{N} was successfully +changed, the size of the @samp{A} array remained at 5 elements. + +To support this, @code{g77} generates code that executes before any user +code (and before the internally generated computed @samp{GOTO} to handle +alternate entry points, as described below) that evaluates each +(nonconstant) expression in the list of subscripts for an +array, and saves the result of each such evaluation to be used when +determining the size of the array (instead of re-evaluating the +expressions). + +So, in the above example, when @samp{X} is first invoked, code is +executed that copies the value of @samp{N} to a temporary. +And that same temporary serves as the actual high bound for the single +dimension of the @samp{A} array (the low bound being the constant 1). +Since the user program cannot (legitimately) change the value +of the temporary during execution of the procedure, the size +of the array remains constant during each invocation. + +For alternate entry points, the code @code{g77} generates takes into +account the possibility that a dummy adjustable array is not actually +passed to the actual entry point being invoked at that time. +In that case, the public procedure implementing the entry point +passes to the master private procedure implementing all the +code for the entry points a @samp{NULL} pointer where a pointer to that +adjustable array would be expected. +The @code{g77}-generated code +doesn't attempt to evaluate any of the expressions in the subscripts +for an array if the pointer to that array is @samp{NULL} at run time in +such cases. +(Don't depend on this particular implementation +by writing code that purposely passes @samp{NULL} pointers where the +callee expects adjustable arrays, even if you know the callee +won't reference the arrays---nor should you pass @samp{NULL} pointers +for any dummy arguments used in calculating the bounds of such +arrays or leave undefined any values used for that purpose in +COMMON---because the way @code{g77} implements these things might +change in the future!) + +@node Alternate Returns +@section Alternate Returns (SUBROUTINE and RETURN) +@cindex subroutines +@cindex alternate returns +@cindex SUBROUTINE statement +@cindex statements, SUBROUTINE +@cindex RETURN statement +@cindex statements, RETURN + +Subroutines with alternate returns (e.g. @samp{SUBROUTINE X(*)} and +@samp{CALL X(*50)}) are implemented by @code{g77} as functions returning +the C @samp{int} type. +The actual alternate-return arguments are omitted from the calling sequence. +Instead, the caller uses +the return value to do a rough equivalent of the Fortran +computed-@samp{GOTO} statement, as in @samp{GOTO (50), X()} in the +example above (where @samp{X} is quietly declared as an @samp{INTEGER} +function), and the callee just returns whatever integer +is specified in the @samp{RETURN} statement for the subroutine +For example, @samp{RETURN 1} is implemented as @samp{X = 1} followed +by @samp{RETURN} +in C, and @samp{RETURN} by itself is @samp{X = 0} and @samp{RETURN}). + +@node Functions +@section Functions (FUNCTION and RETURN) +@cindex functions +@cindex FUNCTION statement +@cindex statements, FUNCTION +@cindex RETURN statement +@cindex statements, RETURN +@cindex return type of functions + +@code{g77} handles in a special way functions that return the following +types: + +@itemize @bullet +@item +@samp{CHARACTER} +@item +@samp{COMPLEX} (and @samp{DOUBLE COMPLEX}) +@item +@samp{REAL} +@end itemize + +For @samp{CHARACTER}, @code{g77} implements a subroutine (a C function +returning @samp{void}) +with two arguments prepended: @samp{__g77_result}, which the caller passes +as a pointer to a @samp{char} array expected to hold the return value, +and @samp{__g77_length}, which the caller passes as an @samp{ftnlen} value +specifying the length of the return value as declared in the calling +program. +For @samp{CHARACTER}*(*), the called function uses @samp{__g77_length} +to determine the size of the array that @samp{__g77_result} points to; +otherwise, it ignores that argument. + +For @samp{COMPLEX} and @samp{DOUBLE COMPLEX}, when @samp{-ff2c} is in +force, @code{g77} implements +a subroutine with one argument prepended: @samp{__g77_result}, which the +caller passes as a pointer to a variable of the type of the function. +The called function writes the return value into this variable instead +of returning it as a function value. +When @samp{-fno-f2c} is in force, +@code{g77} implements a @samp{COMPLEX} function as @code{gcc}'s +@samp{__complex__ float} function, +returning the result of the function in the same way as @code{gcc} would, +and implements a @samp{DOUBLE COMPLEX} function similarly. + +For @samp{REAL}, when @samp{-ff2c} is in force, @code{g77} implements +a function that actually returns @samp{DOUBLE PRECISION} (usually +C's @samp{double} type). +When @samp{-fno-f2c} is in force, @samp{REAL} functions return @samp{float}. + +@node Common Blocks +@section Common Blocks (COMMON) +@cindex common blocks +@cindex COMMON statement +@cindex statements, COMMON + +@code{g77} names and lays out @samp{COMMON} areas the same way f2c does, +for compatibility with f2c. + +Currently, @code{g77} does not emit ``true'' debugging information for +members of a @samp{COMMON} area, due to an apparent bug in the GBE. + +(As of Version 0.5.19, @code{g77} emits debugging information for such +members in the form of a constant string specifying the base name of +the aggregate area and the offset of the member in bytes from the start +of the area. +Use the @samp{-fdebug-kludge} option to enable this behavior. +In @code{gdb}, use @samp{set language c} before printing the value +of the member, then @samp{set language fortran} to restore the default +language, since @code{gdb} doesn't provide a way to print a readable +version of a character string in Fortran language mode. + +This kludge will be removed in a future version of @code{g77} that, +in conjunction with a contemporary version of @code{gdb}, +properly supports Fortran-language debugging, including access +to members of @samp{COMMON} areas.) -You know, maybe nobody really needs to use arrays. +@xref{Code Gen Options,,Options for Code Generation Conventions}, +for information on the @samp{-fdebug-kludge} option. -@node Adjustable Arrays -@section Adjustable Arrays (DIMENSION) -@cindex arrays, adjustable -@cindex adjustable arrays -@cindex arrays, automatic -@cindex automatic arrays -@cindex DIMENSION statement -@cindex statements, DIMENSION -@cindex dimensioning arrays -@cindex arrays, dimensioning +Moreover, @code{g77} currently implements a @samp{COMMON} area such that its +type is an array of the C @samp{char} data type. -Adjustable and automatic arrays in Fortran require the implementation -(in this -case, the @code{g77} compiler) to ``memorize'' the expressions that -dimension the arrays each time the procedure is invoked. -This is so that subsequent changes to variables used in those -expressions, made during execution of the procedure, do not -have any effect on the dimensions of those arrays. +So, when debugging, you must know the offset into a @samp{COMMON} area +for a particular item in that area, and you have to take into +account the appropriate multiplier for the respective sizes +of the types (as declared in your code) for the items preceding +the item in question as compared to the size of the @samp{char} type. -For example: +For example, using default implicit typing, the statement @example -REAL ARRAY(5) -DATA ARRAY/5*2/ -CALL X(ARRAY, 5) -END -SUBROUTINE X(A, N) -DIMENSION A(N) -N = 20 -PRINT *, N, A -END +COMMON I(15), R(20), T @end example @noindent -Here, the implementation should, when running the program, print something -like: +results in a public 144-byte @samp{char} array named @samp{_BLNK__} +with @samp{I} placed at @samp{_BLNK__[0]}, @samp{R} at @samp{_BLNK__[60]}, +and @samp{T} at @samp{_BLNK__[140]}. +(This is assuming that the target machine for +the compilation has 4-byte @samp{INTEGER} and @samp{REAL} types.) -@example -20 2. 2. 2. 2. 2. -@end example +@node Local Equivalence Areas +@section Local Equivalence Areas (EQUIVALENCE) +@cindex equivalence areas +@cindex local equivalence areas +@cindex EQUIVALENCE statement +@cindex statements, EQUIVALENCE -@noindent -Note that this shows that while the value of @samp{N} was successfully -changed, the size of the @samp{A} array remained at 5 elements. +@code{g77} treats storage-associated areas involving a @samp{COMMON} +block as explained in the section on common blocks. -To support this, @code{g77} generates code that executes before any user -code (and before the internally generated computed @code{GOTO} to handle -alternate entry points, as described below) that evaluates each -(nonconstant) expression in the list of subscripts for an -array, and saves the result of each such evaluation to be used when -determining the size of the array (instead of re-evaluating the -expressions). +A local @samp{EQUIVALENCE} area is a collection of variables and arrays +connected to each other in any way via @samp{EQUIVALENCE}, none of which are +listed in a @samp{COMMON} statement. -So, in the above example, when @samp{X} is first invoked, code is -executed that copies the value of @samp{N} to a temporary. -And that same temporary serves as the actual high bound for the single -dimension of the @samp{A} array (the low bound being the constant 1). -Since the user program cannot (legitimately) change the value -of the temporary during execution of the procedure, the size -of the array remains constant during each invocation. +Currently, @code{g77} does not emit ``true'' debugging information for +members in a local @samp{EQUIVALENCE} area, due to an apparent bug in the GBE. -For alternate entry points, the code @code{g77} generates takes into -account the possibility that a dummy adjustable array is not actually -passed to the actual entry point being invoked at that time. -In that case, the public procedure implementing the entry point -passes to the master private procedure implementing all the -code for the entry points a @code{NULL} pointer where a pointer to that -adjustable array would be expected. -The @code{g77}-generated code -doesn't attempt to evaluate any of the expressions in the subscripts -for an array if the pointer to that array is @code{NULL} at run time in -such cases. -(Don't depend on this particular implementation -by writing code that purposely passes @code{NULL} pointers where the -callee expects adjustable arrays, even if you know the callee -won't reference the arrays---nor should you pass @code{NULL} pointers -for any dummy arguments used in calculating the bounds of such -arrays or leave undefined any values used for that purpose in -COMMON---because the way @code{g77} implements these things might -change in the future!) +(As of Version 0.5.19, @code{g77} does emit debugging information for such +members in the form of a constant string specifying the base name of +the aggregate area and the offset of the member in bytes from the start +of the area. +Use the @samp{-fdebug-kludge} option to enable this behavior. +In @code{gdb}, use @samp{set language c} before printing the value +of the member, then @samp{set language fortran} to restore the default +language, since @code{gdb} doesn't provide a way to print a readable +version of a character string in Fortran language mode. + +This kludge will be removed in a future version of @code{g77} that, +in conjunction with a contemporary version of @code{gdb}, +properly supports Fortran-language debugging, including access +to members of @samp{EQUIVALENCE} areas.) + +@xref{Code Gen Options,,Options for Code Generation Conventions}, +for information on the @samp{-fdebug-kludge} option. + +Moreover, @code{g77} implements a local @samp{EQUIVALENCE} area such that its +type is an array of the C @samp{char} data type. + +The name @code{g77} gives this array of @samp{char} type is @samp{__g77_equiv_@var{x}}, +where @var{x} is the name of the item that is placed at the beginning (offset 0) +of this array. +If more than one such item is placed at the beginning, @var{x} is +the name that sorts to the top in an alphabetical sort of the list of +such items. + +When debugging, you must therefore access members of @samp{EQUIVALENCE} +areas by specifying the appropriate @samp{__g77_equiv_@var{x}} +array section with the appropriate offset. +See the explanation of debugging @samp{COMMON} blocks +for info applicable to debugging local @samp{EQUIVALENCE} areas. + +(@emph{Note:} @code{g77} version 0.5.18 and earlier chose the name +for @var{x} using a different method when more than one name was +in the list of names of entities placed at the beginning of the +array. +Though the documentation specified that the first name listed in +the @samp{EQUIVALENCE} statements was chosen for @var{x}, @code{g77} +in fact chose the name using a method that was so complicated, +it seemed easier to change it to an alphabetical sort than to describe the +previous method in the documentation.) @node Alternate Entry Points @section Alternate Entry Points (ENTRY) @@ -8353,20 +5339,20 @@ change in the future!) The GBE does not understand the general concept of alternate entry points as Fortran provides via the ENTRY statement. @code{g77} gets around this by using an approach to compiling procedures -having at least one @code{ENTRY} statement that is almost identical to the +having at least one @samp{ENTRY} statement that is almost identical to the approach used by @code{f2c}. (An alternate approach could be used that would probably generate faster, but larger, code that would also be a bit easier to debug.) -Information on how @code{g77} implements @code{ENTRY} is provided for those +Information on how @code{g77} implements @samp{ENTRY} is provided for those trying to debug such code. The choice of implementation seems unlikely to affect code (compiled in other languages) that interfaces to such code. @code{g77} compiles exactly one public procedure for the primary entry -point of a procedure plus each @code{ENTRY} point it specifies, as usual. +point of a procedure plus each @samp{ENTRY} point it specifies, as usual. That is, in terms of the public interface, there is no difference between @@ -8390,7 +5376,7 @@ The difference between the above two cases lies in the code compiled for the @samp{X} and @samp{Y} procedures themselves, plus the fact that, for the second case, an extra internal procedure is compiled. -For every Fortran procedure with at least one @code{ENTRY} +For every Fortran procedure with at least one @samp{ENTRY} statement, @code{g77} compiles an extra procedure named @samp{__g77_masterfun_@var{x}}, where @var{x} is the name of the primary entry point (which, in the above case, @@ -8409,36 +5395,37 @@ It contains a single integer argument named @samp{__g77_which_entrypoint}, passed by value (as in Fortran's @samp{%VAL()} intrinsic), specifying the entry point index---0 for the primary entry point, 1 for the -first entry point (the first @code{ENTRY} statement encountered), 2 for +first entry point (the first @samp{ENTRY} statement encountered), 2 for the second entry point, and so on. -It also contains, for functions returning @code{CHARACTER} and -(when @samp{-ff2c} is in effect) @code{COMPLEX} functions, +It also contains, for functions returning @samp{CHARACTER} and +(when @samp{-ff2c} is in effect) @samp{COMPLEX} functions, and for functions returning different types among the -@code{ENTRY} statements (e.g. @samp{REAL FUNCTION R()} +@samp{ENTRY} statements (e.g. @samp{REAL FUNCTION R()} containing @samp{ENTRY I()}), an argument named @samp{__g77_result} that is expected at run time to contain a pointer to where to store the result of the entry point. -For @code{CHARACTER} functions, this +For @samp{CHARACTER} functions, this storage area is an array of the appropriate number of characters; -for @code{COMPLEX} functions, it is the appropriate area for the return -type; for multiple-return-type functions, it is a union of all the supported return -types (which cannot include @code{CHARACTER}, since combining @code{CHARACTER} -and non-@code{CHARACTER} return types via @code{ENTRY} in a single function +for @samp{COMPLEX} functions, it is the appropriate area for the return +type (currently either @samp{COMPLEX} or @samp{DOUBLE COMPLEX}); for multiple- +return-type functions, it is a union of all the supported return +types (which cannot include @samp{CHARACTER}, since combining @samp{CHARACTER} +and non-@samp{CHARACTER} return types via @samp{ENTRY} in a single function is not supported by @code{g77}). -For @code{CHARACTER} functions, the @samp{__g77_result} argument is followed +For @samp{CHARACTER} functions, the @samp{__g77_result} argument is followed by yet another argument named @samp{__g77_length} that, at run time, specifies the caller's expected length of the returned value. -Note that only @code{CHARACTER*(*)} functions and entry points actually +Note that only @samp{CHARACTER*(*)} functions and entry points actually make use of this argument, even though it is always passed by -all callers of public @code{CHARACTER} functions (since the caller does not -generally know whether such a function is @code{CHARACTER*(*)} or whether +all callers of public @samp{CHARACTER} functions (since the caller does not +generally know whether such a function is @samp{CHARACTER*(*)} or whether there are any other callers that don't have that information). The rest of the argument list is the union of all the arguments specified for all the entry points (in their usual forms, e.g. -@code{CHARACTER} arguments have extra length arguments, all appended at +@samp{CHARACTER} arguments have extra length arguments, all appended at the end of this list). This is considered the ``master list'' of arguments. @@ -8467,7 +5454,7 @@ Getting back to the public procedures (@samp{x} and @samp{Y} in the original example), those procedures are fairly simple. Their interfaces are just like they would be if they were self-contained procedures -(without @code{ENTRY}), of course, since that is what the callers +(without @samp{ENTRY}), of course, since that is what the callers expect. Their code consists of simply calling the private procedure, described above, with the appropriate extra arguments @@ -8477,7 +5464,7 @@ all the supported returnable non-character types). For arguments that are not listed for a given entry point that are listed for other entry points, and therefore that are in the ``master list'' -for the private procedure, null pointers (in C, the @code{NULL} macro) +for the private procedure, null pointers (in C, the @samp{NULL} macro) are passed. Also, for entry points that are part of a multiple-type- returning function, code is compiled after the call of the private @@ -8503,29 +5490,6 @@ as explained above, and the way in which return values are handled might well be different from how they would be handled for an equivalent single-entry function. -@node Alternate Returns -@section Alternate Returns (SUBROUTINE and RETURN) -@cindex subroutines -@cindex alternate returns -@cindex SUBROUTINE statement -@cindex statements, SUBROUTINE -@cindex RETURN statement -@cindex statements, RETURN - -Subroutines with alternate returns (e.g. @samp{SUBROUTINE X(*)} and -@samp{CALL X(*50)}) are implemented by @code{g77} as functions returning -the C @code{int} type. -The actual alternate-return arguments are omitted from the calling sequence. -Instead, the caller uses -the return value to do a rough equivalent of the Fortran -computed-@code{GOTO} statement, as in @samp{GOTO (50), X()} in the -example above (where @samp{X} is quietly declared as an @code{INTEGER(KIND=1)} -function), and the callee just returns whatever integer -is specified in the @code{RETURN} statement for the subroutine -For example, @samp{RETURN 1} is implemented as @samp{X = 1} followed -by @samp{RETURN} -in C, and @samp{RETURN} by itself is @samp{X = 0} and @samp{RETURN}). - @node Assigned Statement Labels @section Assigned Statement Labels (ASSIGN and GOTO) @cindex assigned statement labels @@ -8536,11 +5500,11 @@ in C, and @samp{RETURN} by itself is @samp{X = 0} and @samp{RETURN}). @cindex statements, GOTO For portability to machines where a pointer (such as to a label, -which is how @code{g77} implements @code{ASSIGN} and its relatives, -the assigned-@code{GOTO} and assigned-@code{FORMAT}-I/O statements) -is wider (bitwise) than an @code{INTEGER(KIND=1)}, @code{g77} -uses a different memory location to hold the @code{ASSIGN}ed value of a variable -than it does the numerical value in that variable, unless the +which is how @code{g77} implements @samp{ASSIGN} and its cousin, the assigned +@samp{GOTO}) is wider (bitwise) than an @samp{INTEGER}, @code{g77} does not +necessarily use +the same memory location to hold the @samp{ASSIGN}ed value of a variable +as it does the numerical value in that variable, unless the variable is wide enough (can hold enough bits). In particular, while @code{g77} implements @@ -8550,315 +5514,170 @@ I = 10 @end example @noindent -as, in C notation, @samp{i = 10;}, it implements +as, in C notation, @samp{i = 10;}, it might implement @example ASSIGN 10 TO I -@end example - -@noindent -as, in GNU's extended C notation (for the label syntax), -@samp{__g77_ASSIGN_I = &&L10;} (where @samp{L10} is just a massaging -of the Fortran label @samp{10} to make the syntax C-like; @code{g77} doesn't -actually generate the name @samp{L10} or any other name like that, -since debuggers cannot access labels anyway). - -While this currently means that an @code{ASSIGN} statement does not -overwrite the numeric contents of its target variable, @emph{do not} -write any code depending on this feature. -@code{g77} has already changed this implementation across -versions and might do so in the future. -This information is provided only to make debugging Fortran programs -compiled with the current version of @code{g77} somewhat easier. -If there's no debugger-visible variable named @samp{__g77_ASSIGN_I} -in a program unit that does @samp{ASSIGN 10 TO I}, that probably -means @code{g77} has decided it can store the pointer to the label directly -into @samp{I} itself. - -@xref{Ugly Assigned Labels}, for information on a command-line option -to force @code{g77} to use the same storage for both normal and -assigned-label uses of a variable. - -@node Run-time Library Errors -@section Run-time Library Errors -@cindex IOSTAT= -@cindex error values -@cindex error messages -@cindex messages, run-time -@cindex I/O, errors - -The @code{libf2c} library currently has the following table to relate -error code numbers, returned in @code{IOSTAT=} variables, to messages. -This information should, in future versions of this document, be -expanded upon to include detailed descriptions of each message. - -In line with good coding practices, any of the numbers in the -list below should @emph{not} be directly written into Fortran -code you write. -Instead, make a separate @code{INCLUDE} file that defines -@code{PARAMETER} names for them, and use those in your code, -so you can more easily change the actual numbers in the future. - -The information below is culled from the definition -of @samp{F_err} in @file{f/runtime/libI77/err.c} in the -@code{g77} source tree. - -@example -100: "error in format" -101: "illegal unit number" -102: "formatted io not allowed" -103: "unformatted io not allowed" -104: "direct io not allowed" -105: "sequential io not allowed" -106: "can't backspace file" -107: "null file name" -108: "can't stat file" -109: "unit not connected" -110: "off end of record" -111: "truncation failed in endfile" -112: "incomprehensible list input" -113: "out of free space" -114: "unit not connected" -115: "read unexpected character" -116: "bad logical input field" -117: "bad variable type" -118: "bad namelist name" -119: "variable not in namelist" -120: "no end record" -121: "variable count incorrect" -122: "subscript for scalar variable" -123: "invalid array section" -124: "substring out of bounds" -125: "subscript out of bounds" -126: "can't read file" -127: "can't write file" -128: "'new' file exists" -129: "can't append to file" -130: "non-positive record number" -@end example - -@node Collected Fortran Wisdom -@chapter Collected Fortran Wisdom -@cindex wisdom -@cindex legacy code -@cindex code, legacy -@cindex writing code -@cindex code, writing - -Most users of @code{g77} can be divided into two camps: - -@itemize @bullet -@item -Those writing new Fortran code to be compiled by @code{g77}. - -@item -Those using @code{g77} to compile existing, ``legacy'' code. -@end itemize - -Users writing new code generally understand most of the necessary -aspects of Fortran to write ``mainstream'' code, but often need -help deciding how to handle problems, such as the construction -of libraries containing @code{BLOCK DATA}. - -Users dealing with ``legacy'' code sometimes don't have much -experience with Fortran, but believe that the code they're compiling -already works when compiled by other compilers (and might -not understand why, as is sometimes the case, it doesn't work -when compiled by @code{g77}). - -The following information is designed to help users do a better job -coping with existing, ``legacy'' Fortran code, and with writing -new code as well. - -@menu -* Advantages Over f2c:: If @code{f2c} is so great, why @code{g77}? -* Block Data and Libraries:: How @code{g77} solves a common problem. -* Loops:: Fortran @code{DO} loops surprise many people. -* Working Programs:: Getting programs to work should be done first. -* Overly Convenient Options:: Temptations to avoid, habits to not form. -* Faster Programs:: Everybody wants these, but at what cost? -@end menu - -@node Advantages Over f2c -@section Advantages Over f2c - -Without @code{f2c}, @code{g77} would have taken much longer to -do and probably not been as good for quite a while. -Sometimes people who notice how much @code{g77} depends on, and -documents encouragement to use, @code{f2c} ask why @code{g77} -was created if @code{f2c} already existed. - -This section gives some basic answers to these questions, though it -is not intended to be comprehensive. - -@menu -* Language Extensions:: Features used by Fortran code. -* Compiler Options:: Features helpful during development. -* Compiler Speed:: Speed of the compilation process. -* Program Speed:: Speed of the generated, optimized code. -* Ease of Debugging:: Debugging ease-of-use at the source level. -* Character and Hollerith Constants:: A byte saved is a byte earned. -@end menu - -@node Language Extensions -@subsection Language Extensions - -@code{g77} offers several extensions to the Fortran language that @code{f2c} -doesn't. - -However, @code{f2c} offers a few that @code{g77} doesn't, like -fairly complete support for @code{INTEGER*2}. -It is expected that @code{g77} will offer some or all of these missing -features at some time in the future. -(Version 0.5.18 of @code{g77} offers some rudimentary support for some -of these features.) - -@node Compiler Options -@subsection Compiler Options +@end example -@code{g77} offers a whole bunch of compiler options that @code{f2c} doesn't. +@noindent +as, in GNU's extended C notation (for the label syntax), +@samp{__g77_ASSIGN_I = &&L10;} (where @samp{L10} is just a massaging +of the Fortran label @samp{10} to make the syntax C-like; @code{g77} doesn't +actually generate the name @samp{L10} or any other name like that, +since debuggers cannot access labels anyway). -However, @code{f2c} offers a few that @code{g77} doesn't, like an -option to generate code to check array subscripts at run time. -It is expected that @code{g77} will offer some or all of these -missing options at some time in the future. +While this currently means that an @samp{ASSIGN} statement might not +overwrite the numeric contents of its target variable, @emph{do not} +write any code depending on this feature. +@code{g77} has already changed this implementation across +versions and might do so in the future. +This information is provided only to make debugging Fortran programs +compiled with the current version of @code{g77} somewhat easier. +If there's no debugger-visible variable named @samp{__g77_ASSIGN_I} +in a program unit that does @samp{ASSIGN 10 TO I}, that probably +means @code{g77} has decided it can store the pointer to the label directly +into @samp{I} itself. -@node Compiler Speed -@subsection Compiler Speed +(Currently, @code{g77} always chooses to make the separate variable, +to improve the likelihood that @samp{-O -Wuninitialized} will +diagnose failures to do things like @samp{GOTO I} without +@samp{ASSIGN 10 TO I} despite doing @samp{I=5}.) -Saving the steps of writing and then rereading C code is a big reason -why @code{g77} should be able to compile code much faster than using -@code{f2c} in conjunction with the equivalent invocation of @code{gcc}. +@node Collected Fortran Wisdom +@chapter Collected Fortran Wisdom +@cindex wisdom +@cindex legacy code +@cindex code, legacy +@cindex writing code +@cindex code, writing -However, due to @code{g77}'s youth, lots of self-checking is still being -performed. -As a result, this improvement is as yet unrealized -(though the potential seems to be there for quite a big speedup -in the future). -It is possible that, as of version 0.5.18, @code{g77} -is noticeably faster compiling many Fortran source files than using -@code{f2c} in conjunction with @code{gcc}. +Most users of @code{g77} can be divided into two camps: -@node Program Speed -@subsection Program Speed +@itemize @bullet +@item +Those writing new Fortran code to be compiled by @code{g77}. -@code{g77} has the potential to better optimize code than @code{f2c}, -even when @code{gcc} is used to compile the output of @code{f2c}, -because @code{f2c} must necessarily -translate Fortran into a somewhat lower-level language (C) that cannot -preserve all the information that is potentially useful for optimization, -while @code{g77} can gather, preserve, and transmit that information directly -to the GBE. +@item +Those using @code{g77} to compile existing, ``legacy'' code. +@end itemize -For example, @code{g77} implements @code{ASSIGN} and assigned -@code{GOTO} using direct assignment of pointers to labels and direct -jumps to labels, whereas @code{f2c} maps the assigned labels to -integer values and then uses a C @code{switch} statement to encode -the assigned @code{GOTO} statements. +Users writing new code generally understand most of the necessary +aspects of Fortran to write ``mainstream'' code, but often need +help deciding how to handle problems, such as the construction +of libraries containing @samp{BLOCK DATA}. -However, as is typical, theory and reality don't quite match, at least -not in all cases, so it is still the case that @code{f2c} plus @code{gcc} -can generate code that is faster than @code{g77}. +Users dealing with ``legacy'' code sometimes don't have much +experience with Fortran, but believe that the code they're compiling +already works when compiled by other compilers (and might +not understand why, as is sometimes the case, it doesn't work +when compiled by @code{g77}). -Version 0.5.18 of @code{g77} offered default -settings and options, via patches to the @code{gcc} -back end, that allow for better program speed, though -some of these improvements also affected the performance -of programs translated by @code{f2c} and then compiled -by @code{g77}'s version of @code{gcc}. +The following information is designed to help users do a better job +coping with existing, ``legacy'' Fortran code, and with writing +new code as well. -Version 0.5.20 of @code{g77} offers further performance -improvements, at least one of which (alias analysis) is -not generally applicable to @code{f2c} (though @code{f2c} -could presumably be changed to also take advantage of -this new capability of the @code{gcc} back end, assuming -this is made available in an upcoming release of @code{gcc}). +@menu +* Overly Convenient Options:: Temptations to avoid, habits to not form. +* Block Data and Libraries:: How @code{g77} solves a common problem. +* Faster Programs:: Everybody wants these, but at what cost? +* Working Programs:: Getting programs to work should be done first. +* Loops:: Fortran @samp{DO} loops surprise many people. +* Advantages Over f2c:: If @code{f2c} is so great, why @code{g77}? +@end menu -@node Ease of Debugging -@subsection Ease of Debugging +@node Overly Convenient Options +@section Overly Convenient Command-line Options +@cindex overly convenient options +@cindex options, overly convenient -Because @code{g77} compiles directly to assembler code like @code{gcc}, -instead of translating to an intermediate language (C) as does @code{f2c}, -support for debugging can be better for @code{g77} than @code{f2c}. +These options should be used only as a quick-and-dirty way to determine +how well your program will run under different compilation models +without having to change the source. +Some are more problematic +than others, depending on how portable and maintainable you want the +program to be (and, of course, whether you are allowed to change it +at all is crucial). -However, although @code{g77} might be somewhat more ``native'' in terms of -debugging support than @code{f2c} plus @code{gcc}, there still are a lot -of things ``not quite right''. -Many of the important ones should be resolved in the near future. +You should not continue to use these command-line options to compile +a given program, but rather should make changes to the source code: -For example, @code{g77} doesn't have to worry about reserved names -like @code{f2c} does. -Given @samp{FOR = WHILE}, @code{f2c} must necessarily -translate this to something @emph{other} than -@samp{for = while;}, because C reserves those words. +@table @code +@cindex -finit-local-zero option +@cindex options, -finit-local-zero +@item -finit-local-zero +(This option specifies that any uninitialized local variables +and arrays have default initialization to binary zeros.) -However, @code{g77} does still uses things like an extra level of indirection -for @code{ENTRY}-laden procedures---in this case, because the back end doesn't -yet support multiple entry points. +Many other compilers do this automatically, which means lots of +Fortran code developed with those compilers depends on it. -Another example is that, given +It is safer (and probably +would produce a faster program) to find the variables and arrays that +need such initialization and provide it explicitly via @samp{DATA}, so that +@samp{-finit-local-zero} is not needed. -@example -COMMON A, B -EQUIVALENCE (B, C) -@end example +Consider using @samp{-Wuninitialized} (which requires @samp{-O}) to +find likely candidates, but +do not specify @samp{-finit-local-zero} or @samp{-fno-automatic}, +or this technique won't work. -@noindent -the @code{g77} user should be able to access the variables directly, by name, -without having to traverse C-like structures and unions, while @code{f2c} -is unlikely to ever offer this ability (due to limitations in the -C language). +@cindex -fno-automatic option +@cindex options, -fno-automatic +@item -fno-automatic +(This option specifies that all local variables and arrays +are to be treated as if they were named in @samp{SAVE} statements.) -However, due to apparent bugs in the back end, @code{g77} currently doesn't -take advantage of this facility at all---it doesn't emit any debugging -information for @code{COMMON} and @code{EQUIVALENCE} areas, -other than information -on the array of @code{char} it creates (and, in the case -of local @code{EQUIVALENCE}, names) for each such area. +Many other compilers do this automatically, which means lots of +Fortran code developed with those compilers depends on it. -Yet another example is arrays. -@code{g77} represents them to the debugger -using the same ``dimensionality'' as in the source code, while @code{f2c} -must necessarily convert them all to one-dimensional arrays to fit -into the confines of the C language. -However, the level of support -offered by debuggers for interactive Fortran-style access to arrays -as compiled by @code{g77} can vary widely. -In some cases, it can actually -be an advantage that @code{f2c} converts everything to widely supported -C semantics. +The effect of this is that all non-automatic variables and arrays +are made static, that is, not placed on the stack or in heap storage. +This might cause a buggy program to appear to work better. +If so, rather than relying on this command-line option (and hoping all +compilers provide the equivalent one), add @samp{SAVE} +statements to some or all program unit sources, as appropriate. +Consider using @samp{-Wuninitialized} (which requires @samp{-O}) +to find likely candidates, but +do not specify @samp{-finit-local-zero} or @samp{-fno-automatic}, +or this technique won't work. -In fairness, @code{g77} could do many of the things @code{f2c} does -to get things working at least as well as @code{f2c}---for now, -the developers prefer making @code{g77} work the -way they think it is supposed to, and finding help improving the -other products (the back end of @code{gcc}; @code{gdb}; and so on) -to get things working properly. +The default is @samp{-fautomatic}, which tells @code{g77} to try +and put variables and arrays on the stack (or in fast registers) +where possible and reasonable. +This tends to make programs faster. -@node Character and Hollerith Constants -@subsection Character and Hollerith Constants -@cindex character constants -@cindex constants, character -@cindex Hollerith constants -@cindex constants, Hollerith -@cindex trailing null byte -@cindex null byte, trailing -@cindex zero byte, trailing +@cindex automatic arrays +@cindex arrays, automatic +@emph{Note:} Automatic variables and arrays are not affected +by this option. +These are variables and arrays that are @emph{necessarily} automatic, +either due to explicit statements, or due to the way they are +declared. +Examples include local variables and arrays not given the +@samp{SAVE} attribute in procedures declared @samp{RECURSIVE}, +and local arrays declared with non-constant bounds (automatic +arrays). +Currently, @code{g77} supports only automatic arrays, not +@samp{RECURSIVE} procedures or other means of explicitly +specifying that variables or arrays are automatic. -To avoid the extensive hassle that would be needed to avoid this, -@code{f2c} uses C character constants to encode character and Hollerith -constants. -That means a constant like @samp{'HELLO'} is translated to -@samp{"hello"} in C, which further means that an extra null byte is -present at the end of the constant. -This null byte is superfluous. +@cindex -fugly option +@cindex options, -fugly +@item -fugly +Fix the source code so that @samp{-fno-ugly} will work. +Note that, for many programs, it is difficult to practically +avoid using the features enabled via @samp{-fugly-init}, and these +features pose the lowest risk of writing nonportable code, among the +various ``ugly'' features. -@code{g77} does not generate such null bytes. -This represents significant -savings of resources, such as on systems where @file{/dev/null} or -@file{/dev/zero} represent bottlenecks in the systems' performance, -because @code{g77} simply asks for fewer zeros from the operating -system than @code{f2c}. +@cindex -f@var{group}-intrinsics-hide option +@cindex options, -f@var{group}-intrinsics-hide +@item -f@var{group}-intrinsics-hide +Change the source code to use @samp{EXTERNAL} for any external procedure +that might be the name of an intrinsic. +It is easy to find these using @samp{-f@var{group}-intrinsics-disable}. +@end table @node Block Data and Libraries @section Block Data and Libraries @@ -8866,16 +5685,16 @@ system than @code{f2c}. @cindex BLOCK DATA statement @cindex statements, BLOCK DATA @cindex libraries, containing BLOCK DATA -@cindex @code{f2c} compatibility -@cindex compatibility, @code{f2c} +@cindex f2c compatibility +@cindex compatibility To ensure that block data program units are linked, especially a concern when they are put into libraries, give each one a name (as in @samp{BLOCK DATA FOO}) and make sure there is an @samp{EXTERNAL FOO} statement in every program unit that uses any common block -initialized by the corresponding @code{BLOCK DATA}. -@code{g77} currently compiles a @code{BLOCK DATA} as if it were a -@code{SUBROUTINE}, +initialized by the corresponding @samp{BLOCK DATA}. +@code{g77} currently compiles a @samp{BLOCK DATA} as if it were a +@samp{SUBROUTINE}, that is, it generates an actual procedure having the appropriate name. The procedure does nothing but return immediately if it happens to be called. @@ -8893,7 +5712,7 @@ shipped. issue a warning that @samp{FOO} is not otherwise referenced, and for @samp{BLOCK DATA FOO}, f2c doesn't generate a dummy procedure with the name @samp{FOO}. -The upshot is that you shouldn't mix @code{f2c} and @code{g77} in +The upshot is that you shouldn't mix @samp{f2c} and @code{g77} in this particular case. If you use f2c to compile @samp{BLOCK DATA FOO}, then any @code{g77}-compiled program unit that says @samp{EXTERNAL FOO} @@ -8905,56 +5724,127 @@ using a ``clever'' linker---so clever, it produces a broken program with little or no warning by omitting initializations of global data because they are contained in unreferenced procedures). -The changes you make to your code to make @code{g77} handle this situation, -however, appear to be a widely portable way to handle it. -That is, many systems permit it (as they should, since the -FORTRAN 77 standard permits @samp{EXTERNAL FOO} when @samp{FOO} -is a block data program unit), and of the ones -that might not link @samp{BLOCK DATA FOO} under some circumstances, most of -them appear to do so once @samp{EXTERNAL FOO} is present in the appropriate -program units. +The changes you make to your code to make @code{g77} handle this situation, +however, appear to be a widely portable way to handle it. +That is, many systems permit it (as they should, since the +FORTRAN 77 standard permits @samp{EXTERNAL FOO} when @samp{FOO} +is a block data program unit), and of the ones +that might not link @samp{BLOCK DATA FOO} under some circumstances, most of +them appear to do so once @samp{EXTERNAL FOO} is present in the appropriate +program units. + +@node Faster Programs +@section Faster Programs +@cindex speeding up programs +@cindex programs, speeding up + +Aside from the usual @samp{gcc} options, such as @samp{-O}, +@samp{-ffast-math}, and so on, consider trying: + +@table @code +@cindex -fno-f2c option +@cindex options, -fno-f2c +@item -fno-f2c +@cindex f2c compatibility +@cindex compatibility +Use this if you aren't linking with any code compiled using +@code{f2c}. +(Note that @code{libf2c} is @emph{not} an example of code +that is compiled using @code{f2c}---it is compiled by a C +compiler, usually @code{gcc}.) +@end table + +If you're using @samp{-fno-automatic} already, you probably +should change your code to allow compilation with @samp{-fautomatic} +(the default), to allow the program to run faster. + +Similarly, you should be able to use @samp{-fno-init-local-zero} +(the default) instead of @samp{-finit-local-zero}. +This is because it is rare that every variable affected by these +options in a given program actually needs to +be so affected. + +For example, @samp{-fno-automatic}, which effectively @samp{SAVE}s +every local non-automatic variable and array, affects even things like +@samp{DO} iteration +variables, which rarely need to be @samp{SAVE}d, and this often reduces +run-time performances. +Similarly, @samp{-fno-init-local-zero} forces such +variables to be initialized to zero---when @samp{SAVE}d (such as when +@samp{-fno-automatic}), this by itself generally affects only +startup time for a program, but when not @samp{SAVE}d, +it can slow down the procedure every time it is called. + +@xref{Overly Convenient Options,,Overly Convenient Command-Line Options}, +for information on the @samp{-fno-automatic} and +@samp{-finit-local-zero} options and how to convert +their use into selective changes in your own code. -Here is the recommended approach to modifying a program containing -a program unit such as the following: +@node Working Programs +@section Working Programs -@example -BLOCK DATA FOO -COMMON /VARS/ X, Y, Z -DATA X, Y, Z / 3., 4., 5. / -END -@end example +Getting Fortran programs to work in the first place can be +quite a challenge---even when the programs already work on +other systems, or when using other compilers. -@noindent -If the above program unit might be placed in a library module, then -ensure that every program unit in every program that references that -particular @code{COMMON} area uses the @code{EXTERNAL} statement -to force the area to be initialized. +@code{g77} offers some options that might be useful for +tracking down bugs in such programs. +@xref{Option Summary}, for a summary of these and other +options, and cross-references for each such option to +the pertinent material in this manual. -For example, change a program unit that starts with +@table @code +@item -finit-local-zero +A program that works better when compiled with this option +is depending on a particular system's, or compiler's, tendency +to initialize some variables to zero. +It might be worthwhile finding such cases and fixing them. -@example -INTEGER FUNCTION CURX() -COMMON /VARS/ X, Y, Z -CURX = X -END -@end example +@item -fno-automatic +A program that works better when compiled with this option +is depending on not having to use the @samp{SAVE} statement +as required by the Fortran standard. +It might be worthwhile finding such cases and fixing them. -@noindent -so that it uses the @code{EXTERNAL} statement, as in: +@item -Wimplicit +This might catch failures to properly specify the types of +variables, arrays, and functions in the code. +However, in code that makes heavy use of Fortran's +implicit-typing facility, this option might produce so +many warnings about cases that are working, it would be +hard to find the one or two that represent bugs. -@example -INTEGER FUNCTION CURX() -COMMON /VARS/ X, Y, Z -EXTERNAL FOO -CURX = X -END -@end example +@item -Wunused +This can find bugs involving implicitly typing, sometimes +more easily than using -Wimplicit in code that makes +heavy use of implicit typing. +An unused variable or array might indicate that the +spelling for its declaration is different from that of +its intended uses. -@noindent -That way, @samp{CURX} is compiled by @code{g77} (and many other -compilers) so that the linker knows it must include @samp{FOO}, -the @code{BLOCK DATA} program unit that sets the initial values -for the variables in @samp{VAR}, in the executable program. +@item -Wuninitialized +This can find bugs involving uninitialized variables, which +can in turn result from misspellings in declaration statements. + +@item -Wsurprising +This can find bugs involving expression evaluation or in +the way @samp{DO} loops with non-integral iteration variables +are handled. +Cases found by this option might indicate a difference of +interpretation between the author of the code involved, and +a standard-conforming compiler such as @code{g77}. +Such a difference might produce actual bugs. + +In any case, changing the code to explicitly do what the +programmer might have expected it to do, so @code{g77} and +other compilers are more likely to follow the programmer's +expectations, might be worthwhile, especially if such changes +make the program work better. + +@item -W +It is possible that the ``extra'' warnings enabled by this +option could expose bugs in the code. +@end table @node Loops @section Loops @@ -8963,11 +5853,11 @@ for the variables in @samp{VAR}, in the executable program. @cindex trips, number of @cindex number of trips -The meaning of a @code{DO} loop in Fortran is precisely specified +The meaning of a @samp{DO} loop in Fortran is precisely specified in the Fortran standard@dots{}and is quite different from what many programmers might expect. -In particular, Fortran @code{DO} loops are implemented as if +In particular, Fortran @samp{DO} loops are implemented as if the number of trips through the loop is calculated @emph{before} the loop is entered. @@ -8978,7 +5868,6 @@ The number of trips for a loop is calculated from the @var{start}, DO @var{iter} = @var{start}, @var{end}, @var{increment} @end example -@noindent The trip count is evaluated using a fairly simple formula based on the three values following the @samp{=} in the statement, and it is that trip count that is effectively @@ -9001,14 +5890,14 @@ not executed at all. The type used to @emph{calculate} the trip count the same type as @var{iter}, but the final calculation, and thus the type of the trip -count itself, always is @code{INTEGER(KIND=1)}. +count itself, always is @samp{INTEGER}. @end itemize These two items mean that there are loops that cannot -be written in straightforward fashion using the Fortran @code{DO}. +be written in straightforward fashion using the Fortran @samp{DO}. For example, on a system with the canonical 32-bit two's-complement -implementation of @code{INTEGER(KIND=1)}, the following loop will not work: +implementation of @samp{INTEGER}, the following loop will not work: @example DO I = -2000000000, 2000000000 @@ -9016,9 +5905,9 @@ DO I = -2000000000, 2000000000 @noindent Although the @var{start} and @var{end} values are well within -the range of @code{INTEGER(KIND=1)}, the @emph{trip count} is not. +the range of @samp{INTEGER}, the @emph{trip count} is not. The expected trip count is 40000000001, which is outside -the range of @code{INTEGER(KIND=1)} on many systems. +the range of @samp{INTEGER} on many systems. Instead, the above loop should be constructed this way: @@ -9032,14 +5921,14 @@ END DO @end example @noindent -The simple @code{DO} construct and the @code{EXIT} statement +The simple @samp{DO} construct and the @samp{EXIT} statement (used to leave the innermost loop) are F90 features that @code{g77} supports. -Some Fortran compilers have buggy implementations of @code{DO}, +Some Fortran compilers have buggy implementations of @samp{DO}, in that they don't follow the standard. -They implement @code{DO} as a straightforward translation -to what, in C, would be a @code{for} statement. +They implement @samp{DO} as a straightforward translation +to what, in C, would be a @samp{for} statement. Instead of creating a temporary variable to hold the trip count as calculated at run time, these compilers use the iteration variable @var{iter} to control @@ -9069,9 +5958,9 @@ can never be greater than 2147483647, since incrementing it beyond that value overflows @samp{i}, setting it to -2147483648. This is a large, negative number that still is less than 2147483647. -Another example of unexpected behavior of @code{DO} involves -using a nonintegral iteration variable @var{iter}, that is, -a @code{REAL} variable. +Another example of unexpected behavior of @samp{DO} involves +using a nonintegral iteration variable @var{iter}, such as +a @samp{REAL} or @samp{DOUBLE PRECISION} variable. Consider the following program: @smallexample @@ -9086,8 +5975,8 @@ Consider the following program: @end smallexample @noindent -A C-like view of @code{DO} would hold that the two ``exclamatory'' -@code{PRINT} statements are never executed. +A C-like view of @samp{DO} would hold that the two ``exclamatory'' +@samp{PRINT} are never executed. However, this is the output of running the above program as compiled by @code{g77} on a GNU/Linux ix86 system: @@ -9117,744 +6006,192 @@ of 31 might result, but, nevertheless, @code{g77} is faithfully following the Fortran standard, and the result is not what the author of the sample program above apparently expected. -(Such other systems might, for different values in the @code{DATA} +(Such other systems might, for different values in the @samp{DATA} statement, violate the other programmer's expectation, for example.) Due to this combination of imprecise representation of floating-point values and the often-misunderstood -interpretation of @code{DO} by standard-conforming -compilers such as @code{g77}, use of @code{DO} loops -with @code{REAL} iteration +interpretation of @samp{DO} by standard-conforming +compilers such as @code{g77}, use of @samp{DO} loops +with @samp{REAL} or @samp{DOUBLE PRECISION} iteration variables is not recommended. Such use can be caught by specifying @samp{-Wsurprising}. @xref{Warning Options}, for more information on this option. -@node Working Programs -@section Working Programs +@node Advantages Over f2c +@section Advantages Over f2c -Getting Fortran programs to work in the first place can be -quite a challenge---even when the programs already work on -other systems, or when using other compilers. +Without @code{f2c}, @code{g77} would have taken much longer to +do and probably not been as good for quite a while. +Sometimes people who notice how much @code{g77} depends on, and +documents encouragement to use, @code{f2c} ask why @code{g77} +was created if @code{f2c} already existed. -@code{g77} offers some facilities that might be useful for -tracking down bugs in such programs. +This section gives some basic answers to these questions, though it +is not intended to be comprehensive. @menu -* Not My Type:: -* Variables Assumed To Be Zero:: -* Variables Assumed To Be Saved:: -* Unwanted Variables:: -* Unused Arguments:: -* Surprising Interpretations of Code:: -* Aliasing Assumed To Work:: -* Output Assumed To Flush:: -* Large File Unit Numbers:: +* Language Extensions:: Features used by Fortran code. +* Compiler Options:: Features helpful during development. +* Compiler Speed:: Speed of the compilation process. +* Program Speed:: Speed of the generated, optimized code. +* Ease of Debugging:: Debugging ease-of-use at the source level. +* Character and Hollerith Constants:: A byte saved is a byte earned. @end menu -@node Not My Type -@subsection Not My Type -@cindex mistyped variables -@cindex variables, mistyped -@cindex mistyped functions -@cindex functions, mistyped -@cindex implicit typing - -A fruitful source of bugs in Fortran source code is use, or -mis-use, of Fortran's implicit-typing feature, whereby the -type of a variable, array, or function is determined by the -first character of its name. - -Simple cases of this include statements like @samp{LOGX=9.227}, -without a statement such as @samp{REAL LOGX}. -In this case, @samp{LOGX} is implicitly given @code{INTEGER(KIND=1)} -type, with the result of the assignment being that it is given -the value @samp{9}. - -More involved cases include a function that is defined starting -with a statement like @samp{DOUBLE PRECISION FUNCTION IPS(@dots{})}. -Any caller of this function that does not also declare @samp{IPS} -as type @code{DOUBLE PRECISION} (or, in GNU Fortran, @code{REAL(KIND=2)}) -is likely to assume it returns -@code{INTEGER}, or some other type, leading to invalid results -or even program crashes. - -The @samp{-Wimplicit} option might catch failures to -properly specify the types of -variables, arrays, and functions in the code. - -However, in code that makes heavy use of Fortran's -implicit-typing facility, this option might produce so -many warnings about cases that are working, it would be -hard to find the one or two that represent bugs. -This is why so many experienced Fortran programmers strongly -recommend widespread use of the @code{IMPLICIT NONE} statement, -despite it not being standard FORTRAN 77, to completely turn -off implicit typing. -(@code{g77} supports @code{IMPLICIT NONE}, as do almost all -FORTRAN 77 compilers.) - -Note that @samp{-Wimplicit} catches only implicit typing of -@emph{names}. -It does not catch implicit typing of expressions such -as @samp{X**(2/3)}. -Such expressions can be buggy as well---in fact, @samp{X**(2/3)} -is equivalent to @samp{X**0}, due to the way Fortran expressions -are given types and then evaluated. -(In this particular case, the programmer probably wanted -@samp{X**(2./3.)}.) - -@node Variables Assumed To Be Zero -@subsection Variables Assumed To Be Zero -@cindex zero-initialized variables -@cindex variables assumed to be zero -@cindex uninitialized variables - -Many Fortran programs were developed on systems that provided -automatic initialization of all, or some, variables and arrays -to zero. -As a result, many of these programs depend, sometimes -inadvertently, on this behavior, though to do so violates -the Fortran standards. - -You can ask @code{g77} for this behavior by specifying the -@samp{-finit-local-zero} option when compiling Fortran code. -(You might want to specify @samp{-fno-automatic} as well, -to avoid code-size inflation for non-optimized compilations.) - -Note that a program that works better when compiled with the -@samp{-finit-local-zero} option -is almost certainly depending on a particular system's, -or compiler's, tendency to initialize some variables to zero. -It might be worthwhile finding such cases and fixing them, -using techniques such as compiling with the @samp{-O -Wuninitialized} -options using @code{g77}. - -@node Variables Assumed To Be Saved -@subsection Variables Assumed To Be Saved -@cindex variables retaining values across calls -@cindex saved variables -@cindex static variables - -Many Fortran programs were developed on systems that -saved the values of all, or some, variables and arrays -across procedure calls. -As a result, many of these programs depend, sometimes -inadvertently, on being able to assign a value to a -variable, perform a @code{RETURN} to a calling procedure, -and, upon subsequent invocation, reference the previously -assigned variable to obtain the value. - -They expect this despite not using the @code{SAVE} statement -to specify that the value in a variable is expected to survive -procedure returns and calls. -Depending on variables and arrays to retain values across -procedure calls without using @code{SAVE} to require it violates -the Fortran standards. - -You can ask @code{g77} to assume @code{SAVE} is specified for all -relevant (local) variables and arrays by using the -@samp{-fno-automatic} option. - -Note that a program that works better when compiled with the -@samp{-fno-automatic} option -is almost certainly depending on not having to use -the @code{SAVE} statement as required by the Fortran standard. -It might be worthwhile finding such cases and fixing them, -using techniques such as compiling with the @samp{-O -Wuninitialized} -options using @code{g77}. - -@node Unwanted Variables -@subsection Unwanted Variables - -The @samp{-Wunused} option can find bugs involving -implicit typing, sometimes -more easily than using @samp{-Wimplicit} in code that makes -heavy use of implicit typing. -An unused variable or array might indicate that the -spelling for its declaration is different from that of -its intended uses. - -Other than cases involving typos, unused variables rarely -indicate actual bugs in a program. -However, investigating such cases thoroughly has, on occasion, -led to the discovery of code that had not been completely -written---where the programmer wrote declarations as needed -for the whole algorithm, wrote some or even most of the code -for that algorithm, then got distracted and forgot that the -job was not complete. - -@node Unused Arguments -@subsection Unused Arguments -@cindex unused arguments -@cindex arguments, unused - -As with unused variables, It is possible that unused arguments -to a procedure might indicate a bug. -Compile with @samp{-W -Wunused} option to catch cases of -unused arguments. - -Note that @samp{-W} also enables warnings regarding overflow -of floating-point constants under certain circumstances. - -@node Surprising Interpretations of Code -@subsection Surprising Interpretations of Code - -The @samp{-Wsuprising} option can help find bugs involving -expression evaluation or in -the way @code{DO} loops with non-integral iteration variables -are handled. -Cases found by this option might indicate a difference of -interpretation between the author of the code involved, and -a standard-conforming compiler such as @code{g77}. -Such a difference might produce actual bugs. - -In any case, changing the code to explicitly do what the -programmer might have expected it to do, so @code{g77} and -other compilers are more likely to follow the programmer's -expectations, might be worthwhile, especially if such changes -make the program work better. - -@node Aliasing Assumed To Work -@subsection Aliasing Assumed To Work -@cindex -falias-check option -@cindex options, -falias-check -@cindex -fargument-alias option -@cindex options, -fargument-alias -@cindex -fargument-noalias option -@cindex options, -fargument-noalias -@cindex -fno-argument-noalias-global option -@cindex options, -fno-argument-noalias-global -@cindex aliasing -@cindex anti-aliasing -@cindex overlapping arguments -@cindex overlays -@cindex association, storage -@cindex storage association -@cindex scheduling of reads and writes -@cindex reads and writes, scheduling - -The @samp{-falias-check}, @samp{-fargument-alias}, -@samp{-fargument-noalias}, -and @samp{-fno-argument-noalias-global} options, -introduced in version 0.5.20 and -@code{g77}'s version 2.7.2.2.f.2 of @code{gcc}, -control the assumptions regarding aliasing -(overlapping) -of writes and reads to main memory (core) made -by the @code{gcc} back end. - -They are effective only when compiling with @samp{-O} (specifying -any level other than @samp{-O0}) or with @samp{-falias-check}. - -The default for Fortran code is @samp{-fargument-noalias-global}. -(The default for C code and code written in other C-based languages -is @samp{-fargument-alias}. -These defaults apply regardless of whether you use @code{g77} or -@code{gcc} to compile your code.) - -Note that, on some systems, compiling with @samp{-fforce-addr} in -effect can produce more optimal code when the default aliasing -options are in effect (and when optimization is enabled). - -If your program is not working when compiled with optimization, -it is possible it is violating the Fortran standards (77 and 90) -by relying on the ability to ``safely'' modify variables and -arrays that are aliased, via procedure calls, to other variables -and arrays, without using @code{EQUIVALENCE} to explicitly -set up this kind of aliasing. - -(The FORTRAN 77 standard's prohibition of this sort of -overlap, generally referred to therein as ``storage -assocation'', appears in Sections 15.9.3.6. -This prohibition allows implementations, such as @code{g77}, -to, for example, implement the passing of procedures and -even values in @code{COMMON} via copy operations into local, -perhaps more efficiently accessed temporaries at entry to a -procedure, and, where appropriate, via copy operations back -out to their original locations in memory at exit from that -procedure, without having to take into consideration the -order in which the local copies are updated by the code, -among other things.) - -To test this hypothesis, try compiling your program with -the @samp{-fargument-alias} option, which causes the -compiler to revert to assumptions essentially the same as -made by versions of @code{g77} prior to 0.5.20. - -If the program works using this option, that strongly suggests -that the bug is in your program. -Finding and fixing the bug(s) should result in a program that -is more standard-conforming and that can be compiled by @code{g77} -in a way that results in a faster executable. - -(You might want to try compiling with @samp{-fargument-noalias}, -a kind of half-way point, to see if the problem is limited to -aliasing between dummy arguments and @code{COMMON} variables---this -option assumes that such aliasing is not done, while still allowing -aliasing among dummy arguments.) - -An example of aliasing that is invalid according to the standards -is shown in the following program, which might @emph{not} produce -the expected results when executed: - -@example -I = 1 -CALL FOO(I, I) -PRINT *, I -END - -SUBROUTINE FOO(J, K) -J = J + K -K = J * K -PRINT *, J, K -END -@end example - -The above program attempts to use the temporary aliasing of the -@samp{J} and @samp{K} arguments in @samp{FOO} to effect a -pathological behavior---the simultaneous changing of the values -of @emph{both} @samp{J} and @samp{K} when either one of them -is written. - -The programmer likely expects the program to print these values: - -@example -2 4 -4 -@end example - -However, since the program is not standard-conforming, an -implementation's behavior when running it is undefined, because -subroutine @samp{FOO} modifies at least one of the arguments, -and they are aliased with each other. -(Even if one of the assignment statements was deleted, the -program would still violate these rules. -This kind of on-the-fly aliasing is permitted by the standard -only when none of the aliased items are defined, or written, -while the aliasing is in effect.) - -As a practical example, an optimizing compiler might schedule -the @samp{J =} part of the second line of @samp{FOO} @emph{after} -the reading of @samp{J} and @samp{K} for the @samp{J * K} expression, -resulting in the following output: - -@example -2 2 -2 -@end example - -Essentially, compilers are promised (by the standard and, therefore, -by programmers who write code they claim to be standard-conforming) -that if they cannot detect aliasing via static analysis of a single -program unit's @code{EQUIVALENCE} and @code{COMMON} statements, no -such aliasing exists. -In such cases, compilers are free to assume that an assignment to -one variable will not change the value of another variable, allowing -it to avoid generating code to re-read the value of the other -variable, to re-schedule reads and writes, and so on, to produce -a faster executable. - -The same promise holds true for arrays (as seen by the called -procedure)---an element of one dummy array cannot be aliased -with, or overlap, any element of another dummy array or be -in a @code{COMMON} area known to the procedure. - -(These restrictions apply only when the procedure defines, or -writes to, one of the aliased variables or arrays.) - -Unfortunately, there is no way to find @emph{all} possible cases of -violations of the prohibitions against aliasing in Fortran code. -Static analysis is certainly imperfect, as is run-time analysis, -since neither can catch all violations. -(Static analysis can catch all likely violations, and some that -might never actually happen, while run-time analysis can catch -only those violations that actually happen during a particular -run. -Neither approach can cope with programs mixing Fortran code with -routines written in other languages, however.) - -Currently, @code{g77} provides neither static nor run-time facilities -to detect any cases of this problem, although other products might. -Run-time facilities are more likely to be offered by future -versions of @code{g77}, though patches improving @code{g77} so that -it provides either form of detection are welcome. - -@node Output Assumed To Flush -@subsection Output Assumed To Flush -@cindex ALWAYS_FLUSH -@cindex synchronous write errors -@cindex disk full -@cindex flushing output -@cindex fflush() -@cindex I/O, flushing -@cindex output, flushing -@cindex writes, flushing -@cindex NFS -@cindex network file system - -For several versions prior to 0.5.20, @code{g77} configured its -version of the @code{libf2c} run-time library so that one of -its configuration macros, @samp{ALWAYS_FLUSH}, was defined. - -This was done as a result of a belief that many programs expected -output to be flushed to the operating system (under UNIX, via -the @code{fflush()} library call) with the result that errors, -such as disk full, would be immediately flagged via the -relevant @code{ERR=} and @code{IOSTAT=} mechanism. - -Because of the adverse effects this approach had on the performance -of many programs, @code{g77} no longer configures @code{libf2c} -to always flush output. - -If your program depends on this behavior, either insert the -appropriate @samp{CALL FLUSH} statements, or modify the sources -to the @code{libf2c}, rebuild and reinstall @code{g77}, and -relink your programs with the modified library. - -(Ideally, @code{libf2c} would offer the choice at run-time, so -that a compile-time option to @code{g77} or @code{f2c} could -result in generating the appropriate calls to flushing or -non-flushing library routines.) - -@xref{Always Flush Output}, for information on how to modify -the @code{g77} source tree so that a version of @code{libf2c} -can be built and installed with the @samp{ALWAYS_FLUSH} macro defined. - -@node Large File Unit Numbers -@subsection Large File Unit Numbers -@cindex MXUNIT -@cindex unit numbers -@cindex maximum unit number -@cindex illegal unit number -@cindex increasing maximum unit number - -If your program crashes at run time with a message including -the text @samp{illegal unit number}, that probably is -a message from the run-time library, @code{libf2c}, used, and -distributed with, @code{g77}. - -The message means that your program has attempted to use a -file unit number that is out of the range accepted by -@code{libf2c}. -Normally, this range is 0 through 99, and the high end -of the range is controlled by a @code{libf2c} source-file -macro named @samp{MXUNIT}. - -If you can easily change your program to use unit numbers -in the range 0 through 99, you should do so. - -Otherwise, see @ref{Larger File Unit Numbers}, for information on how -to change @samp{MXUNIT} in @code{libf2c} so you can build and -install a new version of @code{libf2c} that supports the larger -unit numbers you need. - -@emph{Note:} While @code{libf2c} places a limit on the range -of Fortran file-unit numbers, the underlying library and operating -system might impose different kinds of limits. -For example, some systems limit the number of files simultaneously -open by a running program. -Information on how to increase these limits should be found -in your system's documentation. - -@node Overly Convenient Options -@section Overly Convenient Command-line Options -@cindex overly convenient options -@cindex options, overly convenient - -These options should be used only as a quick-and-dirty way to determine -how well your program will run under different compilation models -without having to change the source. -Some are more problematic -than others, depending on how portable and maintainable you want the -program to be (and, of course, whether you are allowed to change it -at all is crucial). - -You should not continue to use these command-line options to compile -a given program, but rather should make changes to the source code: +@node Language Extensions +@subsection Language Extensions -@table @code -@cindex -finit-local-zero option -@cindex options, -finit-local-zero -@item -finit-local-zero -(This option specifies that any uninitialized local variables -and arrays have default initialization to binary zeros.) +@code{g77} offers several extensions to the Fortran language that @code{f2c} +doesn't. -Many other compilers do this automatically, which means lots of -Fortran code developed with those compilers depends on it. +However, @code{f2c} offers a few that @code{g77} doesn't, like +fairly complete support for @samp{INTEGER*2}. +It is expected that @code{g77} will offer some or all of these missing +features at some time in the future. +(Version 0.5.18 of @code{g77} offers some rudimentary support for some +of these features.) -It is safer (and probably -would produce a faster program) to find the variables and arrays that -need such initialization and provide it explicitly via @code{DATA}, so that -@samp{-finit-local-zero} is not needed. +@node Compiler Options +@subsection Compiler Options -Consider using @samp{-Wuninitialized} (which requires @samp{-O}) to -find likely candidates, but -do not specify @samp{-finit-local-zero} or @samp{-fno-automatic}, -or this technique won't work. +@code{g77} offers a whole bunch of compiler options that @code{f2c} doesn't. -@cindex -fno-automatic option -@cindex options, -fno-automatic -@item -fno-automatic -(This option specifies that all local variables and arrays -are to be treated as if they were named in @code{SAVE} statements.) +However, @code{f2c} offers a few that @code{g77} doesn't, like an +option to generate code to check array subscripts at run time. +It is expected that @code{g77} will offer some or all of these +missing options at some time in the future. -Many other compilers do this automatically, which means lots of -Fortran code developed with those compilers depends on it. +@node Compiler Speed +@subsection Compiler Speed -The effect of this is that all non-automatic variables and arrays -are made static, that is, not placed on the stack or in heap storage. -This might cause a buggy program to appear to work better. -If so, rather than relying on this command-line option (and hoping all -compilers provide the equivalent one), add @code{SAVE} -statements to some or all program unit sources, as appropriate. -Consider using @samp{-Wuninitialized} (which requires @samp{-O}) -to find likely candidates, but -do not specify @samp{-finit-local-zero} or @samp{-fno-automatic}, -or this technique won't work. +Saving the steps of writing and then rereading C code is a big reason +why @code{g77} should be able to compile code much faster than using +@code{f2c} in conjunction with the equivalent invocation of @code{gcc}. -The default is @samp{-fautomatic}, which tells @code{g77} to try -and put variables and arrays on the stack (or in fast registers) -where possible and reasonable. -This tends to make programs faster. +However, due to @code{g77}'s youth, lots of self-checking is still being +performed. +As a result, this improvement is as yet unrealized +(though the potential seems to be there for quite a big speedup +in the future). +It is possible that, as of version 0.5.18, @code{g77} +is noticably faster compiling many Fortran source files than using +@code{f2c} in conjunction with @code{gcc}. -@cindex automatic arrays -@cindex arrays, automatic -@emph{Note:} Automatic variables and arrays are not affected -by this option. -These are variables and arrays that are @emph{necessarily} automatic, -either due to explicit statements, or due to the way they are -declared. -Examples include local variables and arrays not given the -@code{SAVE} attribute in procedures declared @code{RECURSIVE}, -and local arrays declared with non-constant bounds (automatic -arrays). -Currently, @code{g77} supports only automatic arrays, not -@code{RECURSIVE} procedures or other means of explicitly -specifying that variables or arrays are automatic. +@node Program Speed +@subsection Program Speed -@cindex -fugly option -@cindex options, -fugly -@item -fugly -Fix the source code so that @samp{-fno-ugly} will work. -Note that, for many programs, it is difficult to practically -avoid using the features enabled via @samp{-fugly-init}, and these -features pose the lowest risk of writing nonportable code, among the -various ``ugly'' features. +@code{g77} has the potential to better optimize code than @code{f2c}, +even when @code{gcc} is used to compile the output of @code{f2c}, +because @code{f2c} must necessarily +translate Fortran into a somewhat lower-level language (C) that cannot +preserve all the information that is potentially useful for optimization, +while @code{g77} can gather, preserve, and transmit that information directly +to the GBE. -@cindex -f@var{group}-intrinsics-hide option -@cindex options, -f@var{group}-intrinsics-hide -@item -f@var{group}-intrinsics-hide -Change the source code to use @code{EXTERNAL} for any external procedure -that might be the name of an intrinsic. -It is easy to find these using @samp{-f@var{group}-intrinsics-disable}. -@end table +For example, @code{g77} implements @samp{ASSIGN} and assigned +@samp{GOTO} using direct assignment of pointers to labels and direct +jumps to labels, whereas @code{f2c} maps the assigned labels to +integer values and then uses a C @samp{switch} statement to encode +the assigned @samp{GOTO} statements. -@node Faster Programs -@section Faster Programs -@cindex speeding up programs -@cindex programs, speeding up +However, as is typical, theory and reality don't quite match, at least +not in all cases, so it is still the case that @code{f2c} plus @code{gcc} +can generate code that is faster than @code{g77}. -Aside from the usual @code{gcc} options, such as @samp{-O}, -@samp{-ffast-math}, and so on, consider trying some of the -following approaches to speed up your program (once you get -it working). +It is hoped that version 0.5.18 of @code{g77} will offer default +settings and options that allow for better program speed, though +it is not yet known whether these same options, when applied to +a @code{gcc} compilation of @code{f2c} output, will improve the +speed of programs compiled using that method as well. -@menu -* Aligned Data:: -* Prefer Automatic Uninitialized Variables:: -* Avoid f2c Compatibility:: -* Use Submodel Options:: -@end menu +@node Ease of Debugging +@subsection Ease of Debugging -@node Aligned Data -@subsection Aligned Data -@cindex data, aligned -@cindex stack, aligned -@cindex aligned data -@cindex aligned stack -@cindex Pentium optimizations -@cindex optimizations, Pentium - -On some systems, such as those with Pentium Pro CPUs, programs -that make heavy use of @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) -might run much slower -than possible due to the compiler not aligning these 64-bit -values to 64-bit boundaries in memory. -(The effect also is present, though -to a lesser extent, on the 586 (Pentium) architecture.) - -The Intel x86 architecture generally ensures that these programs will -work on all its implementations, -but particular implementations (such as Pentium Pro) -perform better with more strict alignment. - -There are a variety of approaches to use to address this problem, -in any combination: +Because @code{g77} compiles directly to assembler code like @code{gcc}, +instead of translating to an intermediate language (C) as does @code{f2c}, +support for debugging can be better for @code{g77} than @code{f2c}. -@itemize @bullet -@item -Order your @code{COMMON} and @code{EQUIVALENCE} areas such -that the variables and arrays with the widest alignment -guidelines come first. - -For example, on most systems, this would mean placing -@code{COMPLEX(KIND=2)}, @code{REAL(KIND=2)}, and -@code{INTEGER(KIND=2)} entities first, followed by @code{REAL(KIND=1)}, -@code{INTEGER(KIND=1)}, and @code{LOGICAL(KIND=1)} entities, then -@code{INTEGER(KIND=6)} entities, and finally @code{CHARACTER} -and @code{INTEGER(KIND=3)} entities. - -The reason to use such placement is it makes it more likely -that your data will be aligned properly, without requiring -you to do detailed analysis of each aggregate (@code{COMMON} -and @code{EQUIVALENCE}) area. - -Specifically, on systems where the above guidelines are -appropriate, placing @code{CHARACTER} entities before -@code{REAL(KIND=2)} entities can work just as well, -but only if the number of bytes occupied by the @code{CHARACTER} -entities is divisible by the recommended alignment for -@code{REAL(KIND=2)}. - -By ordering the placement of entities in aggregate -areas according to the simple guidelines above, you -avoid having to carefully count the number of bytes -occupied by each entity to determine whether the -actual alignment of each subsequent entity meets the -alignment guidelines for the type of that entity. - -@item -Use the (x86-specific) @samp{-malign-double} option when compiling -programs. -This will align only static data (entities in @code{COMMON} or -local entities with the @code{SAVE} attribute), -but it should probably always be -used with Fortran code on the 586 and 686 architectures for best -performance. - -This feature of @samp{-malign-double} means it may actually be best to -use it with @samp{-fno-automatic} even though the latter usually -produces worse code; at least, doing so will tend to produce more -consistent run times. - -Using @samp{-malign-double} and @samp{-fno-automatic} together is -apparently the only way to ensure that all doubles are correctly aligned -on GNU x86 systems without having to change @code{g77} itself as -described in the next item. -(Note that the @code{gcc} C extension @samp{__attribute__ ((aligned (8))} -also won't double-align the datum to which it is applied if that is allocated -on the stack.) -It isn't clear whether this deficiency also applies to -non-GNU based x86 systems (Solaris, DGUX et al), but it probably does. - -@item -Change the definition of the @samp{STACK_BOUNDARY} macro in -@file{gcc/config/i386/i386.h} from @samp{32} to -@samp{(TARGET_ALIGN_DOUBLE ? 64 : 32)}, and rebuild -@code{g77}. -@xref{Installation,,Installing GNU Fortran}, for more information. - -@item -Ensure that @file{crt0.o} or @file{crt1.o} -on your system guarantees a 64-bit -aligned stack for @code{main()}. -Some experimentation might be needed to determine this, and -access to source code to fix this. -While arranging this may typically -get more data properly aligned, it won't, by itself, -ensure they all are. - -One approach to testing this is to write a @code{main()} program -in C or assembler that outputs the address of the stack pointer -(and/or frame pointer), and visually inspect the output to see -if the stack is 64-bit aligned. -If it is, try renaming the executable to longer and shorter names -and running the program again. -If the name of the executable is placed on the stack by @file{crt0.o} -or @file{crt1.o}, -the location of the stack should move, and this might help determine -whether it is kept on a 64-bit boundary. -@end itemize +However, although @code{g77} might be somewhat more ``native'' in terms of +debugging support than @code{f2c} plus @code{gcc}, there still are a lot +of things ``not quite right''. +Many of the important ones should be resolved in the near future. -Yes, this is all more complicated than it should be. -The problems are best solved in @code{gcc} and the -libraries for the operating systems on such systems, -which need to be continuously updated to provide the -best alignment for newly released processors. -Managing this while remaining compatible with ABIs -on various systems can be challenging. +For example, @code{g77} doesn't have to worry about reserved names +like @code{f2c} does. +Given @samp{FOR = WHILE}, @code{f2c} must necessarily +translate this to something @emph{other} than +@samp{for = while;}, because C reserves those words. -@node Prefer Automatic Uninitialized Variables -@subsection Prefer Automatic Uninitialized Variables +However, @code{g77} does still uses things like an extra level of indirection +for @samp{ENTRY}-laden procedures---in this case, because the back end doesn't +yet support multiple entry points. -If you're using @samp{-fno-automatic} already, you probably -should change your code to allow compilation with @samp{-fautomatic} -(the default), to allow the program to run faster. +Another example is that, given -Similarly, you should be able to use @samp{-fno-init-local-zero} -(the default) instead of @samp{-finit-local-zero}. -This is because it is rare that every variable affected by these -options in a given program actually needs to -be so affected. +@example +COMMON A, B +EQUIVALENCE (B, C) +@end example -For example, @samp{-fno-automatic}, which effectively @code{SAVE}s -every local non-automatic variable and array, affects even things like -@code{DO} iteration -variables, which rarely need to be @code{SAVE}d, and this often reduces -run-time performances. -Similarly, @samp{-fno-init-local-zero} forces such -variables to be initialized to zero---when @code{SAVE}d (such as when -@samp{-fno-automatic}), this by itself generally affects only -startup time for a program, but when not @code{SAVE}d, -it can slow down the procedure every time it is called. +@noindent +the @code{g77} user should be able to access the variables directly, by name, +without having to traverse C-like structures and unions, while @code{f2c} +is unlikely to ever offer this ability (due to limitations in the +C language). -@xref{Overly Convenient Options,,Overly Convenient Command-Line Options}, -for information on the @samp{-fno-automatic} and -@samp{-finit-local-zero} options and how to convert -their use into selective changes in your own code. +However, due to apparent bugs in the back end, @code{g77} currently doesn't +take advantage of this facility at all---it doesn't emit any debugging +information for @samp{COMMON} and @samp{EQUIVALENCE} areas, +other than information +on the array of @samp{char} it creates (and, in the case +of local @samp{EQUIVALENCE}, names) for each such area. -@node Avoid f2c Compatibility -@subsection Avoid f2c Compatibility -@cindex -fno-f2c option -@cindex options, -fno-f2c -@cindex @code{f2c} compatibility -@cindex compatibility, @code{f2c} +Yet another example is arrays. +@code{g77} represents them to the debugger +using the same ``dimensionality'' as in the source code, while @code{f2c} +must necessarily convert them all to one-dimensional arrays to fit +into the confines of the C language. +However, the level of support +offered by debuggers for interactive Fortran-style access to arrays +as compiled by @code{g77} can vary widely. +In some cases, it can actually +be an advantage that @code{f2c} converts everything to widely supported +C semantics. -If you aren't linking with any code compiled using -@code{f2c}, try using the @samp{-fno-f2c} option when -compiling @emph{all} the code in your program. -(Note that @code{libf2c} is @emph{not} an example of code -that is compiled using @code{f2c}---it is compiled by a C -compiler, typically @code{gcc}.) - -@node Use Submodel Options -@subsection Use Submodel Options -@cindex Pentium optimizations -@cindex optimizations, Pentium -@cindex 586/686 CPUs -@cindex submodels - -Using an appropriate @samp{-m} option to generate specific code for your -CPU may be worthwhile, though it may mean the executable won't run on -other versions of the CPU that don't support the same instruction set. -@xref{Submodel Options,,Hardware Models and Configurations,gcc,Using and -Porting GNU CC}. - -For recent CPUs that don't have explicit support in -the released version of @code{gcc}, it may still be possible to get -improvements. -For instance, the flags recommended for 586/686 -(Pentium(Pro)) chips for building the Linux kernel are: +In fairness, @code{g77} could do many of the things @code{f2c} does +to get things working at least as well as @code{f2c}---for now, +the maintainers have tended to prefer making @code{g77} work the +way they think it is supposed to, and find help improving the +other products (the GBE of @code{gcc}; @code{gdb}; and so on) +to get things working properly. -@example --m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 --fomit-frame-pointer -@end example +@node Character and Hollerith Constants +@subsection Character and Hollerith Constants +@cindex character constants +@cindex constants, character +@cindex Hollerith constants +@cindex constants, Hollerith +@cindex trailing null byte +@cindex null byte, trailing +@cindex zero byte, trailing + +To avoid the extensive hassle that would be needed to avoid this, +@code{f2c} uses C character constants to encode character and Hollerith +constants. +That means a constant like @samp{'HELLO'} is translated to +@samp{"hello"} in C, which further means that an extra null byte is +present at the end of the constant. +This null byte is superfluous. -@noindent @samp{-fomit-frame-pointer} will, however, inhibit debugging -on x86 systems. +@code{g77} does not generate such null bytes. +This represents significant +savings of resources, such as on systems where @file{/dev/null} or +@file{/dev/zero} represent bottlenecks in the systems' performance, +because @code{g77} simply asks for fewer zeros from the operating +system than @code{f2c}. @node Trouble @chapter Known Causes of Trouble with GNU Fortran @@ -9890,7 +6227,7 @@ gcc,Using and Porting GNU CC}.) * Disappointments:: Regrettable things we can't change. * Non-bugs:: Things we think are right, but some others disagree. * Warnings and Errors:: Which problems in your code get warnings, - and which get errors. + and which get errors. @end menu @node But-bugs @@ -9919,19 +6256,32 @@ users. of Fortran programs, and the programs that compile them, that might be @emph{thought} to indicate bugs. -@menu -* Cannot Link Fortran Programs:: Unresolved references. -* Large Common Blocks:: Problems on older GNU/Linux systems. -* Debugger Problems:: When the debugger crashes. -* NeXTStep Problems:: Misbehaving executables. -* Stack Overflow:: More misbehaving executables. -* Strange Behavior at Run Time:: Executables misbehaving due to - bugs in your program. -* Floating-point Errors:: The results look wrong, but@dots{}. -@end menu +@itemize @bullet +@item +@cindex common blocks, large +@cindex large common blocks +@cindex linker errors +@cindex ld errors +@cindex errors, linker +On some older GNU/Linux systems, programs with common blocks larger +than 16MB cannot be linked without some kind of error +message being produced. + +This is a bug in older versions of @code{ld}, fixed in +more recent versions of @code{binutils}, such as version 2.6. -@node Cannot Link Fortran Programs -@subsection Cannot Link Fortran Programs +@cindex @code{gdb} support +@cindex support, @code{gdb} +@item +There are some known problems when using @code{gdb} on code +compiled by @code{g77}. +Inadequate investigation as of the release of 0.5.16 results in not +knowing which products are the culprit, but @file{gdb-4.14} definitely +crashes when, for example, an attempt is made to print the contents +of a @samp{COMPLEX*16} dummy array, on at least some GNU/Linux machines, plus +some others. + +@item @cindex unresolved reference (various) @cindex linking error for user code @cindex code, user @@ -9951,12 +6301,13 @@ It is unclear at this point whether there are legitimately installed systems where @samp{-lf2c -lm} is insufficient to resolve code produced by @code{g77}. +@item @cindex undefined reference (_main) @cindex linking error for user code @cindex ld error for user code @cindex code, user @cindex ld can't find _main -If your program doesn't link due to unresolved references to names +If your program doesn't link, due to unresolved references to names like @samp{_main}, make sure you're using the @code{g77} command to do the link, since this command ensures that the necessary libraries are loaded by specifying @samp{-lf2c -lm} when it invokes the @code{gcc} @@ -9966,39 +6317,10 @@ more about what actually happens when you use the @code{g77} and @code{gcc} commands.) Also, try specifying @samp{-lc} as the last item on the @code{g77} -command line, in case that helps. - -@node Large Common Blocks -@subsection Large Common Blocks -@cindex common blocks, large -@cindex large common blocks -@cindex linker errors -@cindex ld errors -@cindex errors, linker -On some older GNU/Linux systems, programs with common blocks larger -than 16MB cannot be linked without some kind of error -message being produced. - -This is a bug in older versions of @code{ld}, fixed in -more recent versions of @code{binutils}, such as version 2.6. - -@node Debugger Problems -@subsection Debugger Problems -@cindex @code{gdb} support -@cindex support, @code{gdb} -There are some known problems when using @code{gdb} on code -compiled by @code{g77}. -Inadequate investigation as of the release of 0.5.16 results in not -knowing which products are the culprit, but @file{gdb-4.14} definitely -crashes when, for example, an attempt is made to print the contents -of a @code{COMPLEX(KIND=2)} dummy array, on at least some GNU/Linux machines, plus -some others. +command line, because some systems need it and @code{g77} doesn't do it +automatically. -@node NeXTStep Problems -@subsection NeXTStep Problems -@cindex NeXTStep problems -@cindex bus error -@cindex segmentation violation +@item Developers of Fortran code on NeXTStep (all architectures) have to watch out for the following problem when writing programs with large, statically allocated (i.e. non-stack based) data structures @@ -10046,12 +6368,21 @@ data structures. not enough.) (The above item was contributed by Toon Moene -(@email{toon@@moene.indiv.nluug.nl}).) +(@code{toon@@moene.indiv.nluug.nl}).) + +@item +@code{g77} rejects some particularly nonportable, +silent data-type conversions such as @samp{LOGICAL} +to @samp{REAL} (as in @samp{A=.FALSE.}, where @samp{A} +is type @samp{REAL}), that other compilers might +quietly accept. + +Some of these conversions are accepted by @code{g77} +when the @samp{-fugly} option is specified. -@node Stack Overflow -@subsection Stack Overflow @cindex stack overflow @cindex segmentation violation +@item @code{g77} code might fail at runtime (probably with a ``segmentation violation'') due to overflowing the stack. This happens most often on systems with an environment @@ -10080,7 +6411,7 @@ non-automatic variables and arrays on the stack. However, if your program uses large automatic arrays (for example, has declarations like @samp{REAL A(N)} where @samp{A} is a local array and @samp{N} is a dummy or -@code{COMMON} variable that can have a large value), +@samp{COMMON} variable that can have a large value), neither use of @samp{-fno-automatic}, nor changing the cut-off point for @code{g77} for using the stack, will solve the problem by changing the placement of these @@ -10099,12 +6430,11 @@ same memory area, such that they are effectively combined, then a stack overflow probably indicates a program that is either simply too large for the system, or buggy.) -@node Strange Behavior at Run Time -@subsection Strange Behavior at Run Time @cindex segmentation violation @cindex bus error @cindex overwritten data @cindex data, overwritten +@item @code{g77} code might fail at runtime with ``segmentation violation'', ``bus error'', or even something as subtle as a procedure call overwriting a variable or array element that it is not supposed @@ -10139,117 +6469,7 @@ calling and called procedures. In the meantime, finding and fixing the programming bugs that lead to these behaviors is, ultimately, the user's responsibility, as difficult as that task can sometimes be. - -@node Floating-point Errors -@subsection Floating-point Errors -@cindex floating-point errors -@cindex rounding errors -@cindex inconsistent floating-point results -@cindex results, inconsistent -Some programs appear to produce inconsistent floating-point -results compiled by @code{g77} versus by other compilers. - -Often the reason for this behavior is the fact that floating-point -values are represented on almost all Fortran systems by -@emph{approximations}, and these approximations are inexact -even for apparently simple values like 0.1, 0.2, 0.3, 0.4, 0.6, -0.7, 0.8, 0.9, 1.1, and so on. -Most Fortran systems, including all current ports of @code{g77}, -use binary arithmetic to represent these approximations. - -Therefore, the exact value of any floating-point approximation -as manipulated by @code{g77}-compiled code is representable by -adding some combination of the values 1.0, 0.5, 0.25, 0.125, and -so on (just keep dividing by two) through the precision of the -fraction (typically around 23 bits for @code{REAL(KIND=1)}, 52 for -@code{REAL(KIND=2)}), then multiplying the sum by a integral -power of two (in Fortran, by @samp{2**N}) that typically is between --127 and +128 for @code{REAL(KIND=1)} and -1023 and +1024 for -@code{REAL(KIND=2)}, then multiplying by -1 if the number -is negative. - -So, a value like 0.2 is exactly represented in decimal---since -it is a fraction, @samp{2/10}, with a denomenator that is compatible -with the base of the number system (base 10). -However, @samp{2/10} cannot be represented by any finite number -of sums of any of 1.0, 0.5, 0.25, and so on, so 0.2 cannot -be exactly represented in binary notation. - -(On the other hand, decimal notation can represent any binary -number in a finite number of digits. -Decimal notation cannot do so with ternary, or base-3, -notation, which would represent floating-point numbers as -sums of any of @samp{1/1}, @samp{1/3}, @samp{1/9}, and so on. -After all, no finite number of decimal digits can exactly -represent @samp{1/3}. -Fortunately, few systems use ternary notation.) - -Moreover, differences in the way run-time I/O libraries convert -between these approximations and the decimal representation often -used by programmers and the programs they write can result in -apparent differences between results that do not actually exist, -or exist to such a small degree that they usually are not worth -worrying about. - -For example, consider the following program: - -@example -PRINT *, 0.2 -END -@end example - -When compiled by @code{g77}, the above program might output -@samp{0.20000003}, while another compiler might produce a -executable that outputs @samp{0.2}. - -This particular difference is due to the fact that, currently, -conversion of floating-point values by the @code{libf2c} library, -used by @code{g77}, handles only double-precision values. - -Since @samp{0.2} in the program is a single-precision value, it -is converted to double precision (still in binary notation) -before being converted back to decimal. -The conversion to binary appends _binary_ zero digits to the -original value---which, again, is an inexact approximation of -0.2---resulting in an approximation that is much less exact -than is connoted by the use of double precision. - -(The appending of binary zero digits has essentially the same -effect as taking a particular decimal approximation of -@samp{1/3}, such as @samp{0.3333333}, and appending decimal -zeros to it, producing @samp{0.33333330000000000}. -Treating the resulting decimal approximation as if it really -had 18 or so digits of valid precision would make it seem -a very poor approximation of @samp{1/3}.) - -As a result of converting the single-precision approximation -to double precision by appending binary zeros, the conversion -of the resulting double-precision -value to decimal produces what looks like an incorrect -result, when in fact the result is @emph{inexact}, and -is probably no less inaccurate or imprecise an approximation -of 0.2 than is produced by other compilers that happen to output -the converted value as ``exactly'' @samp{0.2}. -(Some compilers behave in a way that can make them appear -to retain more accuracy across a conversion of a single-precision -constant to double precision. -@xref{Context-Sensitive Constants}, to see why -this practice is illusory and even dangerous.) - -Note that a more exact approximation of the constant is -computed when the program is changed to specify a -double-precision constant: - -@example -PRINT *, 0.2D0 -END -@end example - -Future versions of @code{g77} and/or @code{libf2c} might convert -single-precision values directly to decimal, -instead of converting them to double precision first. -This would tend to result in output that is more consistent -with that produced by some other Fortran implementations. +@end itemize @include bugs.texi @@ -10260,111 +6480,15 @@ This section lists features we know are missing from @code{g77}, and which we want to add someday. (There is no priority implied in the ordering below.) -@menu -GNU Fortran language: -* Better Source Model:: -* Fortran 90 Support:: -* Intrinsics in PARAMETER Statements:: -* SELECT CASE on CHARACTER Type:: -* RECURSIVE Keyword:: -* Popular Non-standard Types:: -* Full Support for Compiler Types:: -* Array Bounds Expressions:: -* POINTER Statements:: -* Sensible Non-standard Constructs:: -* FLUSH Statement:: -* Expressions in FORMAT Statements:: -* Explicit Assembler Code:: - -GNU Fortran dialects: -* Old-style PARAMETER Statements:: -* TYPE and ACCEPT I/O Statements:: -* STRUCTURE UNION RECORD MAP:: -* OPEN CLOSE and INQUIRE Keywords:: -* ENCODE and DECODE:: -* Suppressing Space Padding:: -* Fortran Preprocessor:: -* Bit Operations on Floating-point Data:: - -New facilities: -* POSIX Standard:: -* Floating-point Exception Handling:: -* Nonportable Conversions:: -* Large Automatic Arrays:: -* Support for Threads:: -* Increasing Precision/Range:: - -Better diagnostics: -* Gracefully Handle Sensible Bad Code:: -* Non-standard Conversions:: -* Non-standard Intrinsics:: -* Modifying DO Variable:: -* Better Pedantic Compilation:: -* Warn About Implicit Conversions:: -* Invalid Use of Hollerith Constant:: -* Dummy Array Without Dimensioning Dummy:: -* Ambiguous Dialects:: -* Unused Labels:: -* Informational Messages:: - -Run-time facilities: -* Uninitialized Variables at Run Time:: -* Bounds Checking at Run Time:: - -Debugging: -* Labels Visible to Debugger:: -@end menu - -@node Better Source Model -@subsection Better Source Model - -@code{g77} needs to provide, as the default source-line model, -a ``pure visual'' mode, where -the interpretation of a source program in this mode can be accurately -determined by a user looking at a traditionally displayed rendition -of the program (assuming the user knows whether the program is fixed -or free form). - -The design should assume the user cannot tell tabs from spaces -and cannot see trailing spaces on lines, but has canonical tab stops -and, for fixed-form source, has the ability to always know exactly -where column 72 is (since the Fortran standard itself requires -this for fixed-form source). - -This would change the default treatment of fixed-form source -to not treat lines with tabs as if they were infinitely long---instead, -they would end at column 72 just as if the tabs were replaced -by spaces in the canonical way. - -As part of this, provide common alternate models (Digital, @code{f2c}, -and so on) via command-line options. -This includes allowing arbitrarily long -lines for free-form source as well as fixed-form source and providing -various limits and diagnostics as appropriate. - -@cindex sequence numbers -@cindex columns 73 through 80 -Also, @code{g77} should offer, perhaps even default to, warnings -when characters beyond the last valid column are anything other -than spaces. -This would mean code with ``sequence numbers'' in columns 73 through 80 -would be rejected, and there's a lot of that kind of code around, -but one of the most frequent bugs encountered by new users is -accidentally writing fixed-form source code into and beyond -column 73. -So, maybe the users of old code would be able to more easily handle -having to specify, say, a @code{-Wno-col73to80} option. - -@node Fortran 90 Support -@subsection Fortran 90 Support +@itemize @bullet +@item @cindex Fortran 90 support @cindex support, Fortran 90 - @code{g77} does not support many of the features that distinguish Fortran 90 (and, now, Fortran 95) from ANSI FORTRAN 77. -Some Fortran 90 features are supported, because they +Some Fortran 90 features are listed here, because they make sense to offer even to die-hard users of F77. For example, many of them codify various ways F77 has been extended to meet users' needs during its tenure, @@ -10373,159 +6497,34 @@ way to meet those same needs, even if it offers compatibility with one or more of the ways those needs were met by other F77 compilers in the industry. -Still, many important F90 features are not supported, -because no attempt has been made to research each and -every feature and assess its viability in @code{g77}. -In the meantime, users who need those features must -use Fortran 90 compilers anyway, and the best approach -to adding some F90 features to GNU Fortran might well be -to fund a comprehensive project to create GNU Fortran 95. - -@node Intrinsics in PARAMETER Statements -@subsection Intrinsics in @code{PARAMETER} Statements -@cindex PARAMETER statement -@cindex statements, PARAMETER - -@code{g77} doesn't allow intrinsics in @code{PARAMETER} statements. -This feature is considered to be absolutely vital, even though it -is not standard-conforming, and is scheduled for version 0.6. - -Related to this, @code{g77} doesn't allow non-integral -exponentiation in @code{PARAMETER} statements, such as -@samp{PARAMETER (R=2**.25)}. -It is unlikely @code{g77} will ever support this feature, -as doing it properly requires complete emulation of -a target computer's floating-point facilities when -building @code{g77} as a cross-compiler. -But, if the @code{gcc} back end is enhanced to provide -such a facility, @code{g77} will likely use that facility -in implementing this feature soon afterwards. - -@node SELECT CASE on CHARACTER Type -@subsection @code{SELECT CASE} on @code{CHARACTER} Type - -Character-type selector/cases for @code{SELECT CASE} currently -are not supported. - -@node RECURSIVE Keyword -@subsection @code{RECURSIVE} Keyword -@cindex RECURSIVE keyword -@cindex keywords, RECURSIVE -@cindex recursion, lack of -@cindex lack of recursion - -@code{g77} doesn't support the @code{RECURSIVE} keyword that -F90 compilers do. -Nor does it provide any means for compiling procedures -designed to do recursion. - -All recursive code can be rewritten to not use recursion, -but the result is not pretty. - -@node Increasing Precision/Range -@subsection Increasing Precision/Range -@cindex -r8 -@cindex -i8 -@cindex f2c -@cindex increasing precision -@cindex precision, increasing -@cindex increasing range -@cindex range, increasing -@cindex Toolpack -@cindex Netlib - -Some compilers, such as @code{f2c}, have an option (@samp{-r8} or -similar) that provides automatic treatment of @code{REAL} -entities such that they have twice the storage size, and -a corresponding increase in the range and precision, of what -would normally be the @code{REAL(KIND=1)} (default @code{REAL}) type. -(This affects @code{COMPLEX} the same way.) - -They also typically offer another option (@samp{-i8}) to increase -@code{INTEGER} entities so they are twice as large -(with roughly twice as much range). - -(There are potential pitfalls in using these options.) - -@code{g77} does not yet offer any option that performs these -kinds of transformations. -Part of the problem is the lack of detailed specifications regarding -exactly how these options affect the interpretation of constants, -intrinsics, and so on. - -Until @code{g77} addresses this need, programmers could improve -the portability of their code by modifying it to not require -compile-time options to produce correct results. -Some free tools are available which may help, specifically -in Toolpack (which one would expect to be sound) and the @file{fortran} -section of the Netlib repository. - -Use of preprocessors can provide a fairly portable means -to work around the lack of widely portable methods in the Fortran -language itself (though increasing acceptance of Fortran 90 would -alleviate this problem). - -@node Popular Non-standard Types -@subsection Popular Non-standard Types -@cindex INTEGER*2 support -@cindex LOGICAL*1 support - -@code{g77} doesn't fully support @code{INTEGER*2}, @code{LOGICAL*1}, -and similar. -Version 0.6 will provide full support for this very -popular set of features. -In the meantime, version 0.5.18 provides rudimentary support -for them. - -@node Full Support for Compiler Types -@subsection Full Support for Compiler Types - -@cindex REAL*16 support -@code{g77} doesn't support @code{INTEGER}, @code{REAL}, and @code{COMPLEX} equivalents -for @emph{all} applicable back-end-supported types (@code{char}, @code{short int}, -@code{int}, @code{long int}, @code{long long int}, and @code{long double}). -This means providing intrinsic support, and maybe constant -support (using F90 syntax) as well, and, for most -machines will result in automatic support of @code{INTEGER*1}, -@code{INTEGER*2}, @code{INTEGER*8}, maybe even @code{REAL*16}, -and so on. -This is scheduled for version 0.6. - -@node Array Bounds Expressions -@subsection Array Bounds Expressions -@cindex array elements, in adjustable array bounds -@cindex function references, in adjustable array bounds -@cindex array bounds, adjustable -@cindex DIMENSION statement -@cindex statements, DIMENSION - -@code{g77} doesn't support more general expressions to dimension -arrays, such as array element references, function -references, etc. - -For example, @code{g77} currently does not accept the following: - -@example -SUBROUTINE X(M, N) -INTEGER N(10), M(N(2), N(1)) -@end example - -@node POINTER Statements -@subsection POINTER Statements -@cindex POINTER statement -@cindex statements, POINTER -@cindex Cray pointers +Still, many important F90 features are not listed here, +because no attempt has been made to research each and +every feature and assess its viability in @code{g77}. +In the meantime, users who need those features must +use Fortran 90 compilers anyway, and the best approach +to adding some F90 features to GNU Fortran might well be +to fund a comprehensive project to create GNU Fortran 95. -@code{g77} doesn't support pointers or allocatable objects -(other than automatic arrays). -This set of features is -probably considered just behind intrinsics -in @code{PARAMETER} statements on the list of large, -important things to add to @code{g77}. +@item +@cindex AND intrinsic +@cindex intrinsics, AND +@cindex OR intrinsic +@cindex intrinsics, OR +@cindex SHIFT intrinsic +@cindex intrinsics, SHIFT +@code{g77} does not allow @samp{REAL} and other non-integral types for +arguments to intrinsics like @samp{AND}, @samp{OR}, and @samp{SHIFT}. -@node Sensible Non-standard Constructs -@subsection Sensible Non-standard Constructs +@item +@cindex INTEGER*2 support +@cindex LOGICAL*1 support +@code{g77} doesn't support @samp{INTEGER*2}, @samp{LOGICAL*1}, and similar. +Version 0.6 will provide full support for this extremely +important set of features. +In the meantime, version 0.5.18 provides rudimentary support +for them. +@item @code{g77} rejects things other compilers accept, like @samp{INTRINSIC SQRT,SQRT}. As time permits in the future, some of these things that are easy for @@ -10533,8 +6532,7 @@ humans to read and write and unlikely to be intended to mean something else will be accepted by @code{g77} (though @samp{-fpedantic} should trigger warnings about such non-standard constructs). -Until @code{g77} no longer gratuitously rejects sensible code, -you might as well fix your code +In the meantime, you might as well fix your code to be more standard-conforming and portable. The kind of case that is important to except from the @@ -10542,19 +6540,19 @@ recommendation to change your code is one where following good coding rules would force you to write non-standard code that nevertheless has a clear meaning. -For example, when writing an @code{INCLUDE} file that +For example, when writing an @samp{INCLUDE} file that defines a common block, it might be appropriate to -include a @code{SAVE} statement for the common block +include a @samp{SAVE} statement for the common block (such as @samp{SAVE /CBLOCK/}), so that variables defined in the common block retain their values even when all procedures declaring the common block become inactive (return to their callers). -However, putting @code{SAVE} statements in an @code{INCLUDE} +However, putting @samp{SAVE} statements in an @samp{INCLUDE} file would prevent otherwise standard-conforming code -from also specifying the @code{SAVE} statement, by itself, +from also specifying the @samp{SAVE} statement, by itself, to indicate that all local variables and arrays are to -have the @code{SAVE} attribute. +have the @samp{SAVE} attribute. For this reason, @code{g77} already has been changed to allow this combination, because although the general @@ -10577,100 +6575,42 @@ specification of an attribute), please submit a bug report with an explanation, so we can consider fixing @code{g77} just for cases like yours. -@node FLUSH Statement -@subsection @code{FLUSH} Statement - -@code{g77} could perhaps use a @code{FLUSH} statement that -does what @samp{CALL FLUSH} does, -but that supports @samp{*} as the unit designator (same unit as for -@code{PRINT}) and accepts @code{ERR=} and/or @code{IOSTAT=} -specifiers. - -@node Expressions in FORMAT Statements -@subsection Expressions in @code{FORMAT} Statements -@cindex FORMAT statement -@cindex statements, FORMAT - -@code{g77} doesn't support @samp{FORMAT(I)} and the like. -Supporting this requires a significant redesign or replacement -of @code{libf2c}. - -However, a future version of @code{g77} might support -this construct when the expression is constant. For -example: - -@example - PARAMETER (IWIDTH = 12) -10 FORMAT (I) -@end example - -In the meantime, at least for output (@code{PRINT} and -@code{WRITE}), Fortran code making use of this feature can -be rewritten to avoid it by constructing the @code{FORMAT} -string in a @code{CHARACTER} variable or array, then -using that variable or array in place of the @code{FORMAT} -statement label to do the original @code{PRINT} or @code{WRITE}. - -Many uses of this feature on input can be rewritten this way -as well, but not all can. -For example, this can be rewritten: - -@example - READ 20, I -20 FORMAT (I) -@end example - -However, this cannot, in general, be rewritten, especially -when @code{ERR=} and @code{END=} constructs are employed: - -@example - READ 30, J, I -30 FORMAT (I) -@end example - -@node Explicit Assembler Code -@subsection Explicit Assembler Code - -@code{g77} needs to provide some way, a la @code{gcc}, for @code{g77} -code to specify explicit assembler code. - -@node Old-style PARAMETER Statements -@subsection Old-style PARAMETER Statements +@item @cindex PARAMETER statement @cindex statements, PARAMETER - @code{g77} doesn't accept @samp{PARAMETER I=1}. Supporting this obsolete form of -the @code{PARAMETER} statement would not be particularly hard, as most of the +the @samp{PARAMETER} statement would not be particularly hard, as most of the parsing code is already in place and working. Until time/money is spent implementing it, you might as well fix your code to use the standard form, @samp{PARAMETER (I=1)} (possibly needing -@samp{INTEGER I} preceding the @code{PARAMETER} statement as well, -otherwise, in the obsolete form of @code{PARAMETER}, the +@samp{INTEGER I} preceding the @samp{PARAMETER} statement as well, +otherwise, in the obsolete form of @samp{PARAMETER}, the type of the variable is set from the type of the constant being assigned to it). -@node TYPE and ACCEPT I/O Statements -@subsection @code{TYPE} and @code{ACCEPT} I/O Statements +@item +@cindex POINTER statement +@cindex statements, POINTER +@cindex Cray pointers +@code{g77} doesn't support pointers or allocatable objects. +This set of features is +probably considered just behind @samp{INTEGER*2} and intrinsics +in @samp{PARAMETER} statements on the list of large, +important things to add to @code{g77}. + @cindex TYPE statement @cindex statements, TYPE @cindex ACCEPT statement @cindex statements, ACCEPT - -@code{g77} doesn't support the I/O statements @code{TYPE} and -@code{ACCEPT}. +@item +@code{g77} doesn't support the I/O statements @samp{TYPE} and +@samp{ACCEPT}. These are common extensions that should be easy to support, but also are fairly easy to work around in user code. -Generally, any @samp{TYPE fmt,list} I/O statement can be replaced -by @samp{PRINT fmt,list}. -And, any @samp{ACCEPT fmt,list} statement can be -replaced by @samp{READ fmt,list}. - -@node STRUCTURE UNION RECORD MAP -@subsection @code{STRUCTURE}, @code{UNION}, @code{RECORD}, @code{MAP} @cindex STRUCTURE statement @cindex statements, STRUCTURE @cindex UNION statement @@ -10679,37 +6619,20 @@ replaced by @samp{READ fmt,list}. @cindex statements, RECORD @cindex MAP statement @cindex statements, MAP - -@code{g77} doesn't support @code{STRUCTURE}, @code{UNION}, @code{RECORD}, -@code{MAP}. +@item +@code{g77} doesn't support @samp{STRUCTURE}, @samp{UNION}, @samp{RECORD}, +@samp{MAP}. This set of extensions is quite a bit lower on the list of large, important things to add to @code{g77}, partly because it requires a great deal of work either upgrading or replacing @code{libf2c}. -@node OPEN CLOSE and INQUIRE Keywords -@subsection @code{OPEN}, @code{CLOSE}, and @code{INQUIRE} Keywords -@cindex disposition of files -@cindex OPEN statement -@cindex statements, OPEN -@cindex CLOSE statement -@cindex statements, CLOSE -@cindex INQUIRE statement -@cindex statements, INQUIRE - -@code{g77} doesn't have support for keywords such as @code{DISP='DELETE'} in -the @code{OPEN}, @code{CLOSE}, and @code{INQUIRE} statements. -These extensions are easy to add to @code{g77} itself, but -require much more work on @code{libf2c}. - -@node ENCODE and DECODE -@subsection @code{ENCODE} and @code{DECODE} @cindex ENCODE statement @cindex statements, ENCODE @cindex DECODE statement @cindex statements, DECODE - -@code{g77} doesn't support @code{ENCODE} or @code{DECODE}. +@item +@code{g77} doesn't support @samp{ENCODE} or @samp{DECODE}. These statements are best replaced by READ and WRITE statements involving internal files (CHARACTER variables and arrays). @@ -10724,7 +6647,6 @@ For example, replace a code fragment like 9000 FORMAT (1X, 3(F10.5)) @end example -@noindent with: @example @@ -10745,7 +6667,6 @@ Similarly, replace a code fragment like 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5)) @end example -@noindent with: @example @@ -10756,222 +6677,222 @@ with: 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5)) @end example -It is entirely possible that @code{ENCODE} and @code{DECODE} will +It is entirely possible that @samp{ENCODE} and @samp{DECODE} will be supported by a future version of @code{g77}. -@node Suppressing Space Padding -@subsection Suppressing Space Padding of Source Lines - -@code{g77} should offer VXT-Fortran-style suppression of virtual -spaces at the end of a source line -if an appropriate command-line option is specified. - -This affects cases where -a character constant is continued onto the next line in a fixed-form -source file, as in the following example: - -@example -10 PRINT *,'HOW MANY - 1 SPACES?' -@end example - -@noindent -@code{g77}, and many other compilers, virtually extend -the continued line through column 72 with spaces that become part -of the character constant, but Digital Fortran normally didn't, -leaving only one space between @samp{MANY} and @samp{SPACES?} -in the output of the above statement. - -Fairly recently, at least one version of Digital Fortran -was enhanced to provide the other behavior when a -command-line option is specified, apparently due to demand -from readers of the USENET group @file{comp.lang.fortran} -to offer conformance to this widespread practice in the -industry. -@code{g77} should return the favor by offering conformance -to Digital's approach to handling the above example. - -@node Fortran Preprocessor -@subsection Fortran Preprocessor - -@code{g77} should offer a preprocessor designed specifically -for Fortran to replace @samp{cpp -traditional}. -There are several out there worth evaluating, at least. - -Such a preprocessor would recognize Hollerith constants, -properly parse comments and character constants, and so on. - -@node Bit Operations on Floating-point Data -@subsection Bit Operations on Floating-point Data -@cindex AND intrinsic -@cindex intrinsics, AND -@cindex OR intrinsic -@cindex intrinsics, OR -@cindex SHIFT intrinsic -@cindex intrinsics, SHIFT - -@code{g77} does not allow @code{REAL} and other non-integral types for -arguments to intrinsics like @code{AND}, @code{OR}, and @code{SHIFT}. - -For example, this program is rejected by @code{g77}, because -the intrinsic @code{IAND} does not accept @code{REAL} arguments: - -@example -DATA A/7.54/, B/9.112/ -PRINT *, IAND(A, B) -END -@end example - -@node POSIX Standard -@subsection @code{POSIX} Standard - -@code{g77} should support the POSIX standard for Fortran. - -@node Floating-point Exception Handling -@subsection Floating-point Exception Handling -@cindex floating point exceptions -@cindex exceptions, floating point -@cindex FPE handling -@cindex NaN values - -The @code{gcc} backend and, consequently, @code{g77}, currently provides no -control over whether or not floating-point exceptions are trapped or -ignored. -(Ignoring them typically results in NaN values being -propagated in systems that conform to IEEE 754.)@ -The behaviour is inherited from the system-dependent startup code. - -Most systems provide some C-callable mechanism to change this; this can -be invoked at startup using @code{gcc}'s @code{constructor} attribute. -For example, just compiling and linking the following C code with your -program will turn on exception trapping for the ``common'' exceptions -on an x86-based GNU system: +@cindex disposition of files +@cindex OPEN statement +@cindex statements, OPEN +@cindex CLOSE statement +@cindex statements, CLOSE +@cindex INQUIRE statement +@cindex statements, INQUIRE +@item +There is no support for keywords such as @samp{DISP='DELETE'} in +the @samp{OPEN}, @samp{CLOSE}, and @samp{INQUIRE} statements. +These extensions are easy to add to @code{g77} itself, but +require much more work on @code{libf2c}. -@smallexample -#include -void __attribute__ ((constructor)) -trapfpe () @{ - (void) __setfpucw (_FPU_DEFAULT & - ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM)); -@} -@end smallexample +@cindex PARAMETER statement +@cindex statements, PARAMETER +@item +@code{g77} doesn't allow intrinsics in @samp{PARAMETER} statements. +This feature is considered to be absolutely vital, even though it +is not standard-conforming, and is scheduled for version 0.6. -@node Nonportable Conversions -@subsection Nonportable Conversions -@cindex nonportable conversions -@cindex conversions, nonportable +Related to this, @code{g77} doesn't allow non-integral +exponentiation in @samp{PARAMETER} statements, such as +@samp{PARAMETER (R=2**.25)}. +It is unlikely @code{g77} will ever support this feature, +as doing it properly requires complete emulation of +a target computer's floating-point facilities when +building @code{g77} as a cross-compiler. +But, if the @code{gcc} back end is enhanced to provide +such a facility, @code{g77} will likely use that facility +in implementing this feature soon afterwards. -@code{g77} doesn't accept some particularly nonportable, -silent data-type conversions such as @code{LOGICAL} -to @code{REAL} (as in @samp{A=.FALSE.}, where @samp{A} -is type @code{REAL}), that other compilers might -quietly accept. +@cindex FORMAT statement +@cindex statements, FORMAT +@item +@code{g77} doesn't support @samp{FORMAT(I)} and the like. +Supporting this requires a significant redesign or replacement +of @code{libf2c}. -Some of these conversions are accepted by @code{g77} -when the @samp{-fugly} option is specified. -Perhaps it should accept more or all of them. +@cindex RECURSIVE keyword +@cindex keywords, RECURSIVE +@cindex recursion, lack of +@cindex lack of recursion +@item +@code{g77} doesn't support the @samp{RECURSIVE} keyword that +F90 compilers do. +Nor does it provide any means for compiling procedures +designed to do recursion. -@node Large Automatic Arrays -@subsection Large Automatic Arrays @cindex automatic arrays @cindex arrays, automatic - -Currently, automatic arrays always are allocated on the stack. +@item +Automatic arrays are always allocated on the stack. For situations where the stack cannot be made large enough, @code{g77} should offer a compiler option that specifies allocation of automatic arrays in heap storage. -@node Support for Threads -@subsection Support for Threads @cindex threads @cindex parallel processing - +@item Neither the code produced by @code{g77} nor the @code{libf2c} library are thread-safe, nor does @code{g77} have support for parallel processing (other than the instruction-level parallelism available on some processors). A package such as PVM might help here. -@node Gracefully Handle Sensible Bad Code -@subsection Gracefully Handle Sensible Bad Code +@item +Need option to suppress information messages (notes). +@samp{-w} does this but also suppresses warnings. +The default should be to suppress info messages. -@code{g77} generally should continue processing for -warnings and recoverable (user) errors whenever possible---that -is, it shouldn't gratuitously make bad or useless code. +@item +Provide some way, a la @code{gcc}, for @code{g77} code to specify assembler +code. -For example: +@item +Support @samp{INTEGER}, @samp{REAL}, and @samp{COMPLEX} equivalents +for all applicable back-end-supported types (@samp{char}, @samp{short int}, +@samp{int}, @samp{long int}, @samp{long long int}, and @samp{long double}). +This means providing intrinsic support, and maybe constant +support (using F90 syntax) as well, and, for most +machines will result in automatic support of @samp{INTEGER*1}, +@samp{INTEGER*2}, @samp{INTEGER*8}, and so on. +This is scheduled for version 0.6. -@example -INTRINSIC ZABS -CALL FOO(ZABS) -END -@end example +@item +Provide as the default source-line model a ``pure visual'' mode, where +the interpretation of a source program in this mode can be accurately +determined by a user looking at a traditionally displayed rendition +of the program (assuming the user knows whether the program is fixed +or free form). -@noindent -When compiling the above with @samp{-ff2c-intrinsics-disable}, -@code{g77} should indeed complain about passing @code{ZABS}, -but it still should compile, instead of rejecting -the entire @code{CALL} statement. -(Some of this is related to improving -the compiler internals to improve how statements are analyzed.) +That is, assume the user cannot tell tabs from spaces +and cannot see trailing spaces on lines, but has canonical tab stops +and, for fixed-form source, has the ability to always know exactly +where column 72 is. -@node Non-standard Conversions -@subsection Non-standard Conversions +This would change the default treatment of fixed-form source +to not treat lines with tabs as if they were infinitely long---instead, +they would end at column 72 just as if the tabs were replaced +by spaces in the canonical way. -@samp{-Wconversion} and related should flag places where non-standard -conversions are found. -Perhaps much of this would be part of @samp{-Wugly*}. +As part of this, provide common alternate models (Digital, @code{f2c}, +and so on) via command-line options. +This includes allowing arbitrarily long +lines for free-form source as well as fixed-form source and providing +various limits and diagnostics as appropriate. -@node Non-standard Intrinsics -@subsection Non-standard Intrinsics +@cindex array elements, in adjustable array bounds +@cindex function references, in adjustable array bounds +@cindex array bounds, adjustable +@cindex DIMENSION statement +@cindex statements, DIMENSION +@item +Support more general expressions to dimension +arrays, such as array element references, function +references, etc. + +@item +A @samp{FLUSH} statement that does what many systems provide via +@samp{CALL FLUSH}, +but that supports @samp{*} as the unit designator (same unit as for +@samp{PRINT}). + +@item +Character-type selector/cases for @samp{SELECT CASE}. + +@item +Option to initialize everything not explicitly initialized to ``weird'' +(machine-dependent) values, e.g. NANs, bad (non-@samp{NULL}) pointers, and +largest-magnitude integers. + +@item +Add run-time bounds-checking of array/subscript references a la @code{f2c}. + +@item +Output labels for use by debuggers that know how to support them. +Same with weirder things like construct names. +It is not yet known if any debug formats or debuggers support these. + +@item +Support the POSIX standard for Fortran. + +@item +Support Digital-style lossage of virtual blanks at end of source line +if some command-line option specified. + +This affects cases where +a character constant is continued onto the next line in a fixed-form +source file, as in the following example: + +@example +10 PRINT *,'HOW MANY + 1 SPACES?' +@end example -@code{g77} needs a new option, like @samp{-Wintrinsics}, to warn about use of -non-standard intrinsics without explicit @code{INTRINSIC} statements for them. -This would help find code that might fail silently when ported to another -compiler. +@code{g77}, and many other compilers, virtually extend +the continued line through column 72 with blanks that become part +of the character constant, but Digital Fortran normally didn't, +leaving only one space between @samp{MANY} and @samp{SPACES?} +in the output of the above statement. -@node Modifying DO Variable -@subsection Modifying @code{DO} Variable +Fairly recently, at least one version of Digital Fortran +was enhanced to provide the other behavior when a +command-line option is specified, apparently due to demand +from readers of the USENET group @file{comp.lang.fortran} +to offer conformance to this widespread practice in the +industry. +@code{g77} should return the favor by offering conformance +to Digital's approach to handling the above example. -@code{g77} should warn about modifying @code{DO} variables -via @code{EQUIVALENCE}. -(The internal information gathered to produce this warning -might also be useful in setting the -internal ``doiter'' flag for a variable or even array -reference within a loop, since that might produce faster code someday.) +@item +Consider a preprocessor designed specifically for Fortran to replace +@samp{cpp -traditional}. +There are several out there worth evaluating, at least. -For example, this code is invalid, so @code{g77} should warn about -the invalid assignment to @samp{NOTHER}: +@item +Have @samp{-Wunused} warn about unused labels. -@example -EQUIVALENCE (I, NOTHER) -DO I = 1, 100 - IF (I.EQ. 10) NOTHER = 20 -END DO -@end example +@item +Warn about assigned @samp{GOTO}/@samp{FORMAT} usage without any +@samp{ASSIGN} to variable. +(Actually, use of @samp{-O -Wuninitialized} should +take care of most of these.) -@node Better Pedantic Compilation -@subsection Better Pedantic Compilation +@item +Add @samp{-Wintrinsics} to warn about use of +non-standard intrinsics without explicit @samp{INTRINSIC} statements for them +(to help find code that might fail silently when ported to another +compiler). -@code{g77} needs to support @samp{-fpedantic} more thoroughly, -and use it only to generate +@item +Support @samp{-fpedantic} more thoroughly, and use it only to generate warnings instead of rejecting constructs outright. Have it warn: if a variable that dimensions an array is not a dummy or placed -explicitly in @code{COMMON} (F77 does not allow it to be -placed in @code{COMMON} via @code{EQUIVALENCE}); if specification statements +explicitly in @samp{COMMON} (F77 does not allow it to be +placed in @samp{COMMON} via @samp{EQUIVALENCE}); if specification statements follow statement-function-definition statements; about all sorts of syntactic extensions. -@node Warn About Implicit Conversions -@subsection Warn About Implicit Conversions +@item +Warn about modifying @samp{DO} variables via @samp{EQUIVALENCE}. +(This test might be useful in setting the +internal ``doiter'' flag for a variable or even array +reference within a loop, since that might produce faster code someday.) -@code{g77} needs a @samp{-Wpromotions} option to warn if source code appears +@item +Add @samp{-Wpromotions} to warn if source code appears to expect automatic, silent, and -somewhat dangerous compiler-assisted conversion of @code{REAL(KIND=1)} -constants to @code{REAL(KIND=2)} based on context. +somewhat dangerous compiler-assisted conversion of @samp{REAL} +constants to @samp{DOUBLE PRECISION} based on context. -For example, it would warn about cases like this: +For example, warn about cases like this: @example DOUBLE PRECISION FOO @@ -10979,91 +6900,99 @@ PARAMETER (TZPHI = 9.435784839284958) FOO = TZPHI * 3D0 @end example -@node Invalid Use of Hollerith Constant -@subsection Invalid Use of Hollerith Constant - -@code{g77} should disallow statements like @samp{RETURN 2HAB}, -which are invalid in both source forms -(unlike @samp{RETURN (2HAB)}, -which probably still makes no sense but at least can -be reliably parsed). -Fixed-form processing rejects it, but not free-form, except -in a way that is a bit difficult to understand. - -@node Dummy Array Without Dimensioning Dummy -@subsection Dummy Array Without Dimensioning Dummy - -@code{g77} should complain when a list of dummy arguments containing an -adjustable dummy array does -not also contain every variable listed in the dimension list of the -adjustable array. - -Currently, @code{g77} does complain about a variable that -dimensions an array but doesn't appear in any dummy list or @code{COMMON} -area, but this needs to be extended to catch cases where it doesn't appear in -every dummy list that also lists any arrays it dimensions. +@item +Generally continue processing for warnings and recoverable (user) +errors whenever possible---don't gratuitously make bad code. -For example, @code{g77} should warn about the entry point @samp{ALT} -below, since it includes @samp{ARRAY} but not @samp{ISIZE} in its -list of arguments: +For example: @example -SUBROUTINE PRIMARY(ARRAY, ISIZE) -REAL ARRAY(ISIZE) -ENTRY ALT(ARRAY) +INTRINSIC ZABS +CALL FOO(ZABS) +END @end example -@node Ambiguous Dialects -@subsection Ambiguous Dialects - -@code{g77} needs a set of options such as @samp{-Wugly*}, @samp{-Wautomatic}, -@samp{-Wvxt}, @samp{-Wf90}, and so on. -These would warn about places in the user's source where ambiguities -are found, helpful in resolving ambiguities in the program's -dialect or dialects. - -@node Unused Labels -@subsection Unused Labels - -@code{g77} should warn about unused labels when @samp{-Wunused} is in effect. +When compiling the above with @samp{-ff2c-intrinsics-disable}, +@code{g77} should indeed complain about passing @samp{ZABS}, +but it still should compile, instead of rejecting +the entire @samp{CALL} statement. +(Some of this is related to improving +the compiler internals to improve how statements are analyzed.) -@node Informational Messages -@subsection Informational Messages +@item +If @samp{-fno-ugly}, reject badly designed trailing-radix quoted (typeless) +numbers, such as @samp{'123'O}. -@code{g77} needs an option to suppress information messages (notes). -@samp{-w} does this but also suppresses warnings. -The default should be to suppress info messages. +@item +Add @samp{-Wugly*}, @samp{-Wautomatic}, @samp{-Wvxt-not-f90}, @samp{-Wf90}, +and so on. +These would warn about places in the user's source where ambiguities +are found. -Perhaps info messages should simply be eliminated. +One especially interesting case that @samp{-Wf90} would catch +is use of @samp{REAL(Z)}, where @samp{Z} is @samp{DOUBLE COMPLEX}. +Apparently, traditional extended F77 compilers treat this as +what all compilers should agree is @samp{REAL(REAL(Z))}, while +F90 compilers are required to treat @samp{REAL(Z)} as the same +as @samp{DBLE(Z)}, returning a @samp{DOUBLE PRECISION} result +rather than a @samp{REAL} result. -@node Uninitialized Variables at Run Time -@subsection Uninitialized Variables at Run Time +@item +@samp{-Wconversion} and related should flag places where non-standard +conversions are found. +Perhaps much of this would be part of @samp{-Wugly*}. -@code{g77} needs an option to initialize everything (not otherwise -explicitly initialized) to ``weird'' -(machine-dependent) values, e.g. NaNs, bad (non-@code{NULL}) pointers, and -largest-magnitude integers, would help track down references to -some kinds of uninitialized variables at run time. +@item +Complain when list of dummies containing an adjustable dummy array does +not also contain every variable listed in the dimension list of the +adjustable array. -Note that use of the options @samp{-O -Wuninitialized} can catch -many such bugs at compile time. +Currently, @code{g77} does complain about a variable that +dimensions an array but doesn't appear in any dummy list or @samp{COMMON} +area, but this needs to be extended to catch cases where it doesn't appear in +every dummy list that also lists any arrays it dimensions. -@node Bounds Checking at Run Time -@subsection Bounds Checking at Run Time +@item +Make sure things like @samp{RETURN 2HAB} are invalid in both source forms +(must be @samp{RETURN (2HAB)}, +which probably still makes no sense but at least can +be reliably parsed). +Fixed form rejects it, but not free form, except +in a way that is a bit difficult to understand. -@code{g77} should offer run-time bounds-checking of array/subscript references -in a fashion similar to @code{f2c}. +@item +The sort of routines usually found in the BSD-ish @code{libU77} should be +provided in addition to the few utility routines in @code{libf2c}. +Much of this work has already been done, and is awaiting +integration into @code{g77}. -Note that @code{g77} already warns about references to out-of-bounds -elements of arrays when it detects these at compile time. +@cindex floating point exceptions +@cindex exceptions, floating point +@cindex FPE handling +@cindex NaN values +@item +The GCC backend and, consequently, @code{g77} currently provides no +control over whether or not floating point exceptions are trapped or +ignored. +(Ignoring them typically results in NaN values being +propagated in systems that conform to IEEE 754). +The behaviour is inherited from the system-dependent startup code. -@node Labels Visible to Debugger -@subsection Labels Visible to Debugger +Most systems provide some C-callable mechanism to change this; this can +be invoked at startup using GCC's @samp{constructor} attribute. +For example, just compiling and linking the following C with your +program will turn on exception trapping for the ``common'' exceptions +on an x86-based GNU system: -@code{g77} should output debugging information for statements labels, -for use by debuggers that know how to support them. -Same with weirder things like construct names. -It is not yet known if any debug formats or debuggers support these. +@smallexample +#include +void __attribute__ ((constructor)) +trapfpe () @{ + (void) __setfpucw (_FPU_DEFAULT & + ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM)); +@} +@end smallexample +@end itemize @node Disappointments @section Disappointments and Misunderstandings @@ -11072,50 +7001,37 @@ These problems are perhaps regrettable, but we don't know any practical way around them for now. @menu -* Mangling of Names:: @samp{SUBROUTINE FOO} is given - external name @samp{foo_}. +* Limitation on Implicit Declarations:: No @samp{IMPLICIT CHARACTER*(*)}. * Multiple Definitions of External Names:: No doing both @samp{COMMON /FOO/} and @samp{SUBROUTINE FOO}. -* Limitation on Implicit Declarations:: No @samp{IMPLICIT CHARACTER*(*)}. +* Mangling of Names:: @samp{SUBROUTINE FOO} is given + external name @samp{foo_}. @end menu -@node Mangling of Names -@subsection Mangling of Names in Source Code -@cindex naming issues -@cindex external names -@cindex common blocks -@cindex name space -@cindex underscores - -The current external-interface design, which includes naming of -external procedures, COMMON blocks, and the library interface, -has various usability problems, including things like adding -underscores where not really necessary (and preventing easier -inter-language operability) and yet not providing complete -namespace freedom for user C code linked with Fortran apps (due -to the naming of functions in the library, among other things). +@cindex IMPLICIT CHARACTER*(*) statement +@cindex statements, IMPLICIT CHARACTER*(*) +@node Limitation on Implicit Declarations +@subsection Limitation on Implicit Declarations -Project GNU should at least get all this ``right'' for systems -it fully controls, such as the Hurd, and provide defaults and -options for compatibility with existing systems and interoperability -with popular existing compilers. +@code{g77} disallows @samp{IMPLICIT CHARACTER*(*)}. +This is not standard-conforming. -@node Multiple Definitions of External Names -@subsection Multiple Definitions of External Names @cindex block data @cindex BLOCK DATA statement @cindex statements, BLOCK DATA @cindex COMMON statement @cindex statements, COMMON @cindex naming conflicts +@node Multiple Definitions of External Names +@subsection Multiple Definitions of External Names @code{g77} doesn't allow a common block and an external procedure or -@code{BLOCK DATA} to have the same name. +@samp{BLOCK DATA} to have the same name. Some systems allow this, but @code{g77} does not, to be compatible with @code{f2c}. @code{g77} could special-case the way it handles -@code{BLOCK DATA}, since it is not compatible with @code{f2c} in this +@samp{BLOCK DATA}, since it is not compatible with @code{f2c} in this particular area (necessarily, since @code{g77} offers an important feature here), but it is likely that such special-casing would be very annoying to people @@ -11125,24 +7041,37 @@ the result would be that @code{g77} would treat these references as requests to force-load BLOCK DATA program units. In that case, if @code{g77} modified -names of @code{BLOCK DATA} so they could have the same names as -@code{COMMON}, users +names of @samp{BLOCK DATA} so they could have the same names as +@samp{COMMON}, users would find that their programs wouldn't link because the @samp{FOO} procedure didn't have its name translated the same way. (Strictly speaking, @code{g77} could emit a null-but-externally-satisfying definition of @samp{FOO} with its name transformed as if it had been a -@code{BLOCK DATA}, but that probably invites more trouble than it's +@samp{BLOCK DATA}, but that probably invites more trouble than it's worth.) -@node Limitation on Implicit Declarations -@subsection Limitation on Implicit Declarations -@cindex IMPLICIT CHARACTER*(*) statement -@cindex statements, IMPLICIT CHARACTER*(*) +@cindex naming issues +@cindex external names +@cindex COMMON block names +@cindex name space +@cindex underscores +@node Mangling of Names +@subsection Mangling of Names in Source Code -@code{g77} disallows @code{IMPLICIT CHARACTER*(*)}. -This is not standard-conforming. +The current external-interface design, which includes naming of +external procedures, COMMON blocks, and the library interface, +has various usability problems, including things like adding +underscores where not really necessary (and preventing easier +inter-language operability) and yet not providing complete +namespace freedom for user C code linked with Fortran apps (due +to the naming of functions in the library, among other things). + +Project GNU should at least get all this ``right'' for systems +it fully controls, such as the Hurd, and provide defaults and +options for compatibility with existing systems and interoperability +with popular existing compilers. @node Non-bugs @section Certain Changes We Don't Want to Make @@ -11153,23 +7082,23 @@ we do not make because we think GNU Fortran is better without them. @menu * Backslash in Constants:: Why @samp{'\\'} is a constant that is one, not two, characters long. -* Initializing Before Specifying:: Why @samp{DATA VAR/1/} can't precede - @samp{COMMON VAR}. -* Context-Sensitive Intrinsicness:: Why @samp{CALL SQRT} won't work. * Context-Sensitive Constants:: Why @samp{9.435784839284958} is a - single-precision constant, + single-precision (@samp{REAL}) constant, and might be interpreted as @samp{9.435785} or similar. * Equivalence Versus Equality:: Why @samp{.TRUE. .EQ. .TRUE.} won't work. +* Context-Sensitive Intrinsicness:: Why @samp{CALL SQRT} won't work. +* Initializing Before Specifying:: Why @samp{DATA VAR/1/} can't precede + @samp{COMMON VAR}. * Order of Side Effects:: Why @samp{J = IFUNC() - IFUNC()} might not behave as expected. @end menu -@node Backslash in Constants -@subsection Backslash in Constants @cindex backslash @cindex f77 support @cindex support, f77 +@node Backslash in Constants +@subsection Backslash in Constants In the opinion of many experienced Fortran users, @samp{-fno-backslash} should be the default, not @samp{-fbackslash}, @@ -11232,147 +7161,67 @@ One suggestion has been to configure the default for @samp{-fbackslash} (and perhaps other options as well) based on the configuration of @code{g77}. -This is technically quite straightforward, but will be avoided -even in cases where not configuring defaults to be -dependent on a particular configuration greatly inconveniences -some users of legacy code. - -Many users appreciate the GNU compilers because they provide an -environment that is uniform across machines. -These users would be -inconvenienced if the compiler treated things like the -format of the source code differently on certain machines. - -Occasionally users write programs intended only for a particular machine -type. -On these occasions, the users would benefit if the GNU Fortran compiler -were to support by default the same dialect as the other compilers on -that machine. -But such applications are rare. -And users writing a -program to run on more than one type of machine cannot possibly benefit -from this kind of compatibility. -(This is consistent with the design goals for @code{gcc}. -To change them for @code{g77}, you must first change them -for @code{gcc}. -Do not ask the maintainers of @code{g77} to do this for you, -or to disassociate @code{g77} from the widely understood, if -not widely agreed-upon, goals for GNU compilers in general.) - -This is why GNU Fortran does and will treat backslashes in the same -fashion on all types of machines (by default). -@xref{Direction of Language Development}, for more information on -this overall philosophy guiding the development of the GNU Fortran -language. - -Of course, users strongly concerned about portability should indicate -explicitly in their build procedures which options are expected -by their source code, or write source code that has as few such -expectations as possible. - -For example, avoid writing code that depends on backslash (@samp{\}) -being interpreted either way in particular, such as by -starting a program unit with: - -@example -CHARACTER BACKSL -PARAMETER (BACKSL = '\\') -@end example - -@noindent -Then, use concatenation of @samp{BACKSL} anyplace a backslash -is desired. -In this way, users can write programs which have the same meaning -in many Fortran dialects. - -(However, this technique does not work for Hollerith constants---which -is just as well, since the only generally portable uses for Hollerith -constants are in places where character constants can and should -be used instead, for readability.) - -@node Initializing Before Specifying -@subsection Initializing Before Specifying -@cindex initialization, statement placement -@cindex placing initialization statements - -@code{g77} does not allow @samp{DATA VAR/1/} to appear in the -source code before @samp{COMMON VAR}, -@samp{DIMENSION VAR(10)}, @samp{INTEGER VAR}, and so on. -In general, @code{g77} requires initialization of a variable -or array to be specified @emph{after} all other specifications -of attributes (type, size, placement, and so on) of that variable -or array are specified (though @emph{confirmation} of data type is -permitted). - -It is @emph{possible} @code{g77} will someday allow all of this, -even though it is not allowed by the FORTRAN 77 standard. - -Then again, maybe it is better to have -@code{g77} always require placement of @code{DATA} -so that it can possibly immediately write constants -to the output file, thus saving time and space. - -That is, @samp{DATA A/1000000*1/} should perhaps always -be immediately writable to canonical assembler, unless it's already known -to be in a @code{COMMON} area following as-yet-uninitialized stuff, -and to do this it cannot be followed by @samp{COMMON A}. - -@node Context-Sensitive Intrinsicness -@subsection Context-Sensitive Intrinsicness -@cindex intrinsics, context-sensitive -@cindex context-sensitive intrinsics - -@code{g77} treats procedure references to @emph{possible} intrinsic -names as always enabling their intrinsic nature, regardless of -whether the @emph{form} of the reference is valid for that -intrinsic. - -For example, @samp{CALL SQRT} is interpreted by @code{g77} as -an invalid reference to the @code{SQRT} intrinsic function, -because the reference is a subroutine invocation. - -First, @code{g77} recognizes the statement @samp{CALL SQRT} -as a reference to a @emph{procedure} named @samp{SQRT}, not -to a @emph{variable} with that name (as it would for a statement -such as @samp{V = SQRT}). +This is technically quite straightforward, but will be avoided +even in cases where not configuring defaults to be +dependent on a particular configuration greatly inconveniences +some users of legacy code. -Next, @code{g77} establishes that, in the program unit being compiled, -@code{SQRT} is an intrinsic---not a subroutine that -happens to have the same name as an intrinsic (as would be -the case if, for example, @samp{EXTERNAL SQRT} was present). +Many users appreciate the GNU compilers because they provide an +environment that is uniform across machines. +These users would be +inconvenienced if the compiler treated things like the +format of the source code differently on certain machines. -Finally, @code{g77} recognizes that the @emph{form} of the -reference is invalid for that particular intrinsic. -That is, it recognizes that it is invalid for an intrinsic -@emph{function}, such as @code{SQRT}, to be invoked as -a @emph{subroutine}. +Occasionally users write programs intended only for a particular machine +type. +On these occasions, the users would benefit if the GNU Fortran compiler +were to support by default the same dialect as the other compilers on +that machine. +But such applications are rare. +And users writing a +program to run on more than one type of machine cannot possibly benefit +from this kind of compatibility. +(This is consistent with the design goals for @code{gcc}. +To change them for @code{g77}, you must first change them +for @code{gcc}. +Do not ask the maintainers of @code{g77} to do this for you, +or to disassociate @code{g77} from the widely understood, if +not widely agreed-upon, goals for GNU compilers in general.) -At that point, @code{g77} issues a diagnostic. +This is why GNU Fortran does and will treat backslashes in the same +fashion on all types of machines (by default). -Some users claim that it is ``obvious'' that @samp{CALL SQRT} -references an external subroutine of their own, not an -intrinsic function. +Of course, users strongly concerned about portability should indicate +explicitly in their build procedures which options are expected +by their source code, or write source code that has as few such +expectations as possible. -However, @code{g77} knows about intrinsic -subroutines, not just functions, and is able to support both having -the same names, for example. +For example, avoid writing code that depends on backslash (@samp{\}) +being interpreted either way in particular, such as by +starting a program unit with: -As a result of this, @code{g77} rejects calls -to intrinsics that are not subroutines, and function invocations -of intrinsics that are not functions, just as it (and most compilers) -rejects invocations of intrinsics with the wrong number (or types) -of arguments. +@example +CHARACTER BACKSL +PARAMETER (BACKSL = '\\') +@end example -So, use the @samp{EXTERNAL SQRT} statement in a program unit that calls -a user-written subroutine named @samp{SQRT}. +Then, use concatenation of @samp{BACKSL} anyplace a backslash +is desired. +(However, this technique does not work for Hollerith constants---which +is good, since the only generally portable uses for Hollerith +constants are in places where character constants can and should +be used instead, for readability.) + +In this way, users can write programs which have the same meaning +in many Fortran dialects. -@node Context-Sensitive Constants -@subsection Context-Sensitive Constants @cindex constants, context-sensitive @cindex context-sensitive constants +@node Context-Sensitive Constants +@subsection Context-Sensitive Constants @code{g77} does not use context to determine the types of -constants or named constants (@code{PARAMETER}), except +constants or named constants (@samp{PARAMETER}), except for (non-standard) typeless constants such as @samp{'123'O}. For example, consider the following statement: @@ -11381,10 +7230,9 @@ For example, consider the following statement: PRINT *, 9.435784839284958 * 2D0 @end example -@noindent @code{g77} will interpret the (truncated) constant -@samp{9.435784839284958} as a @code{REAL(KIND=1)}, not @code{REAL(KIND=2)}, -constant, because the suffix @code{D0} is not specified. +@samp{9.435784839284958} as a @samp{REAL}, not @samp{DOUBLE PRECISION}, +constant, because the suffix @samp{D0} is not specified. As a result, the output of the above statement when compiled by @code{g77} will appear to have ``less precision'' @@ -11415,7 +7263,6 @@ PRINT *, CLOSE - FIVE END @end example -@noindent Running the above program should result in the same value being printed three times. @@ -11438,7 +7285,7 @@ in some compilers, to named constants. Since programmers often are encouraged to replace manifest constants or permanently-assigned variables with named -constants (@code{PARAMETER} in Fortran), and might need +constants (@samp{PARAMETER} in Fortran), and might need to replace some constants with variables having the same values for pertinent portions of code, it is important that compilers treat code so modified in the @@ -11453,23 +7300,23 @@ interpret constants' types based on context, so anything @code{g77} can do to help flag cases of this in such code could be very helpful. -@node Equivalence Versus Equality -@subsection Equivalence Versus Equality @cindex .EQV., with integer operands @cindex comparing logical expressions @cindex logical expressions, comparing +@node Equivalence Versus Equality +@subsection Equivalence Versus Equality -Use of @code{.EQ.} and @code{.NE.} on @code{LOGICAL} operands +Use of @samp{.EQ.} and @samp{.NE.} on @samp{LOGICAL} operands is not supported, except via @samp{-fugly}, which is not recommended except for legacy code (where the behavior expected by the @emph{code} is assumed). -Legacy code should be changed, as resources permit, to use @code{.EQV.} -and @code{.NEQV.} instead, as these are permitted by the various +Legacy code should be changed, as resources permit, to use @samp{.EQV.} +and @samp{.NEQV.} instead, as these are permitted by the various Fortran standards. -New code should never be written expecting @code{.EQ.} or @code{.NE.} -to work if either of its operands is @code{LOGICAL}. +New code should never be written expecting @samp{.EQ.} or @samp{.NE.} +to work if either of its operands is @samp{LOGICAL}. The problem with supporting this ``feature'' is that there is unlikely to be consensus on how it works, as illustrated by the @@ -11482,23 +7329,23 @@ IF (L.AND.M.EQ.N) PRINT *,'L.AND.M.EQ.N' END @end example -The issue raised by the above sample program is: what is the -precedence of @code{.EQ.} (and @code{.NE.}) when applied to -@code{LOGICAL} operands? +The issue raised by the above sample program is, what is the +precedence of @samp{.EQ.} (and @samp{.NE.}) when applied to +@samp{LOGICAL} operands? Some programmers will argue that it is the same as the precedence -for @code{.EQ.} when applied to numeric (such as @code{INTEGER}) +for @samp{.EQ.} when applied to numeric (such as @samp{INTEGER}) operands. By this interpretation, the subexpression @samp{M.EQ.N} must be evaluated first in the above program, resulting in a program that, -when run, does not execute the @code{PRINT} statement. +when run, does not execute the @samp{PRINT} statement. Other programmers will argue that the precedence is the same as -the precedence for @code{.EQV.}, which is restricted by the standards -to @code{LOGICAL} operands. +the precedence for @samp{.EQV.}, which is restricted by the standards +to @samp{LOGICAL} operands. By this interpretation, the subexpression @samp{L.AND.M} must be evaluated first, resulting in a program that @emph{does} execute -the @code{PRINT} statement. +the @samp{PRINT} statement. Assigning arbitrary semantic interpretations to syntactic expressions that might legitimately have more than one ``obvious'' interpretation @@ -11506,7 +7353,7 @@ is generally unwise. The creators of the various Fortran standards have done a good job in this case, requiring a distinct set of operators (which have their -own distinct precedence) to compare @code{LOGICAL} operands. +own distinct precedence) to compare @samp{LOGICAL} operands. This requirement results in expression syntax with more certain precedence (without requiring substantial context), making it easier for programmers to read existing code. @@ -11518,10 +7365,86 @@ that were well-designed in the first place. you, without knowing more context, whether the @samp{&} and @samp{-} operators are infix (binary) or unary!) -@node Order of Side Effects -@subsection Order of Side Effects +@cindex intrinsics, context-sensitive +@cindex context-sensitive intrinsics +@node Context-Sensitive Intrinsicness +@subsection Context-Sensitive Intrinsicness + +@code{g77} treats procedure references to @emph{possible} intrinsic +names as always enabling their intrinsic nature, regardless of +whether the @emph{form} of the reference is valid for that +intrinsic. + +For example, @samp{CALL SQRT} is interpreted by @code{g77} as +an invalid reference to the @samp{SQRT} intrinsic function, +because the reference is a subroutine invocation. + +First, @code{g77} recognizes the statement @samp{CALL SQRT} +as a reference to a @emph{procedure} named @samp{SQRT}, not +to a @emph{variable} with that name (as it would for a statement +such as @samp{V = SQRT}). + +Next, @code{g77} establishes that, in the program unit being compiled, +@samp{SQRT} is an intrinsic---not a subroutine that +happens to have the same name as an intrinsic (as would be +the case if, for example, @samp{EXTERNAL SQRT} was present). + +Finally, @code{g77} recognizes that the @emph{form} of the +reference is invalid for that particular intrinsic. +That is, it recognizes that it is invalid for an intrinsic +@emph{function}, such as @samp{SQRT}, to be invoked as +a @emph{subroutine}. + +At that point, @code{g77} issues a diagnostic. + +Some users claim that it is ``obvious'' that @samp{CALL SQRT} +references an external subroutine of their own, not an +intrinsic function. + +However, @code{g77} knows about intrinsic +subroutines, not just functions, and is able to support both having +the same names, for example. + +As a result of this, @code{g77} rejects calls +to intrinsics that are not subroutines, and function invocations +of intrinsics that are not functions, just as it (and most compilers) +rejects invocations of intrinsics with the wrong number (or types) +of arguments. + +So, use the @samp{EXTERNAL SQRT} statement in a program unit that calls +a user-written subroutine named @samp{SQRT}. + +@cindex initialization, statement placement +@cindex placing initialization statements +@node Initializing Before Specifying +@subsection Initializing Before Specifying + +@code{g77} does not allow @samp{DATA VAR/1/} to appear in the +source code before @samp{COMMON VAR}, +@samp{DIMENSION VAR(10)}, @samp{INTEGER VAR}, and so on. +In general, @code{g77} requires initialization of a variable +or array to be specified @emph{after} all other specifications +of attributes (type, size, placement, and so on) of that variable +or array are specified (though @emph{confirmation} of data type is +permitted). + +It is @emph{possible} @code{g77} will someday allow all of this, +even though it is not allowed by the FORTRAN 77 standard. + +Then again, maybe it is better to have +@code{g77} always require placement of @samp{DATA} +so that it can possibly immediately write constants +to the output file, thus saving time and space. + +That is, @samp{DATA A/1000000*1/} should perhaps always +be immediately writable to canonical assembler, unless it's already known +to be in a @samp{COMMON} area following as-yet-uninitialized stuff, +and to do this it cannot be followed by @samp{COMMON A}. + @cindex side effects, order of evaluation @cindex order of evaluation, side effects +@node Order of Side Effects +@subsection Order of Side Effects @code{g77} does not necessarily produce code that, when run, performs side effects (such as those performed by function invocations) @@ -11537,7 +7460,6 @@ from one compiler to another: J = IFUNC() - IFUNC() @end example -@noindent There is no guarantee that @samp{IFUNC} will be evaluated in any particular order. Either invocation might happen first. @@ -11637,23 +7559,7 @@ Please consider offering useful answers to these questions! @itemize @bullet @item -How do system administrators and users manage multiple incompatible -Fortran compilers on their systems? -How can @code{g77} contribute to this, or at least avoiding -intefering with it? - -Currently, @code{g77} provides rudimentary ways to choose whether to -overwrite portions of other Fortran compilation systems -(such as the @code{f77} command and the @code{libf2c} library). -Is this sufficient? -What happens when users choose not to overwrite these---does -@code{g77} work properly in all such installations, picking -up its own versions, or does it pick up the existing ``alien'' -versions it didn't overwrite with its own, possibly leading -to subtle bugs? - -@item -@code{LOC()} and other intrinsics are probably somewhat misclassified. +@samp{LOC()} and other intrinsics are probably somewhat misclassified. Is the a need for more precise classification of intrinsics, and if so, what are the appropriate groupings? Is there a need to individually @@ -11675,7 +7581,7 @@ If it isn't known, then you should report the problem. Reporting a bug might help you by bringing a solution to your problem, or it might not. (If it does not, look in the service directory; see -@ref{Service}.)@ +@ref{Service}.) In any case, the principal function of a bug report is to help the entire community by making the next version of GNU Fortran work better. @@ -11690,18 +7596,14 @@ In order for a bug report to serve its purpose, you must include the information that makes for fixing the bug. @menu -* Criteria: Bug Criteria. Have you really found a bug? -* Where: Bug Lists. Where to send your bug report. +* Criteria: Bug Criteria. Have you really found a bug? +* Where: Bug Lists. Where to send your bug report. * Reporting: Bug Reporting. How to report a bug effectively. * Patches: Sending Patches. How to send a patch for GNU Fortran. +* Known: Trouble. Known problems. +* Help: Service. Where to ask for help. @end menu -@xref{Trouble,,Known Causes of Trouble with GNU Fortran}, -for information on problems we already know about. - -@xref{Service,,How To Get Help with GNU Fortran}, -for information on where to ask for help. - @node Bug Criteria @section Have You Found a Bug? @cindex bug criteria @@ -11773,7 +7675,7 @@ for improvement of GNU Fortran are welcome in any case. @section Where to Report Bugs @cindex bug report mailing lists @kindex fortran@@gnu.ai.mit.edu -Send bug reports for GNU Fortran to @email{fortran@@gnu.ai.mit.edu}. +Send bug reports for GNU Fortran to @samp{fortran@@gnu.ai.mit.edu}. Often people think of posting bug reports to a newsgroup instead of mailing them. @@ -11900,17 +7802,14 @@ frequently depend on every little detail of the function they happen in. @item @cindex included files -@cindex INCLUDE directive -@cindex directive, INCLUDE -@cindex #include directive -@cindex directive, #include +@cindex INCLUDE statement +@cindex statements, INCLUDE Note that you should include with your bug report any files -included by the source file -(via the @code{#include} or @code{INCLUDE} directive) -that you send, and any files they include, and so on. +included by the source file (via the @samp{INCLUDE} statement) +that you send, and any files they @samp{INCLUDE}, +and so on. -It is not necessary to replace -the @code{#include} and @code{INCLUDE} directives +It is not necessary to replace the @samp{INCLUDE} statements with the actual files in the version of the source file that you send, but it might make submitting the bug report easier in the end. @@ -12103,13 +8002,13 @@ unless we have an identical system---and if we do have one, we should be able to reproduce the crash ourselves. @end itemize -@node Sending Patches +@node Sending Patches,, Bug Reporting, Bugs @section Sending Patches for GNU Fortran If you would like to write bug fixes or improvements for the GNU Fortran compiler, that is very helpful. Send suggested fixes to the bug report -mailing list, @email{fortran@@gnu.ai.mit.edu}. +mailing list, @code{fortran@@gnu.ai.mit.edu}. Please follow these guidelines so we can study your patches efficiently. If you don't follow these guidelines, your information might still be @@ -12173,7 +8072,7 @@ study the diffs to decide whether we want to install them. Unidiff format is better than contextless diffs, but not as easy to read as @samp{-c} format. -If you have GNU @code{diff}, use @samp{diff -cp}, which shows the name of the +If you have GNU diff, use @samp{diff -cp}, which shows the name of the function that each change occurs in. (The maintainer of GNU Fortran currently uses @samp{diff -rcp2N}.) @@ -12234,7 +8133,7 @@ The service directory is found in the file named @file{SERVICE} in the GNU CC distribution. @item -Send a message to @email{fortran@@gnu.ai.mit.edu}. +Send a message to @code{fortran@@gnu.ai.mit.edu}. @end itemize @end ifset @@ -12387,7 +8286,7 @@ memory pools and, where feasible, use obstacks to implement them. @item Skip over uninitialized portions of aggregate areas (arrays, -@code{COMMON} areas, @code{EQUIVALENCE} areas) so zeros need not be output. +@samp{COMMON} areas, @samp{EQUIVALENCE} areas) so zeros need not be output. This would reduce memory usage for large initialized aggregate areas, even ones with only one initialized element. @@ -12403,7 +8302,7 @@ This would allow ripping out of the statement-confirmation, symbol retraction/confirmation, and diagnostic inhibition mechanisms. Plus, it would result in much-improved diagnostics. -For example, @samp{CALL some-intrinsic(@dots{})}, where the intrinsic +For example, @samp{CALL some-intrinsic(...)}, where the intrinsic is not a subroutine intrinsic, would result actual error instead of the unimplemented-statement catch-all. @@ -12433,7 +8332,7 @@ Maybe type-conversion, where necessary, can be speeded up as well in cases like the one shown (converting the @samp{2} into @samp{2.}). @item -If analysis shows it to be worthwhile, optimize @file{lex.c}. +If analysis shows it to be worthwhile, optimize @samp{lex.c}. @item Consider redesigning @file{lex.c} to not need any feedback @@ -12453,6 +8352,17 @@ However, perhaps this work can be done in parallel during the feature-adding work. @itemize @bullet +@item +Get the back end to produce at least as good code involving array +references as does @code{f2c} plus @code{gcc}. +(@emph{Note:} 0.5.18, with its improvements to the GBE for +versions 2.7.1 and 2.7.2 of @code{gcc}, should succeed at +doing this. +Please submit any cases where @code{g77} cannot be made to +generate as optimal code as @code{f2c} in combination with +the same version of @code{gcc}, but only for versions 2.7.1 and +greater of @code{gcc}.) + @item Do the equivalent of the trick of putting @samp{extern inline} in front of every function definition in @code{libf2c} and #include'ing the resulting @@ -12466,7 +8376,7 @@ and it's clear that types line up and @samp{CHAR_VAR} is addressable or not a @samp{VAR_DECL}, make @samp{CHAR_VAR}, not a temporary, be the receiver for @samp{CHAR_FUNC}. -(This is now done for @code{COMPLEX} variables.) +(This is now done for @samp{COMPLEX} variables.) @item Design and implement Fortran-specific optimizations that don't @@ -12484,7 +8394,8 @@ and so on) to general computing (array/section implementations of various intrinsics, implementation of commonly performed loops that aren't likely to be optimally compiled otherwise, etc.). -Among the important things the library would do are: +Among +the important things the library would do are: @itemize @bullet @item @@ -12492,7 +8403,7 @@ Be a one-stop-shop-type library, hence shareable and usable by all, in that what are now library-build-time options in @code{libf2c} would be moved at least to the @code{g77} compile phase, if not to finer grains (such as choosing how -list-directed I/O formatting is done by default at @code{OPEN} time, for +list-directed I/O formatting is done by default at @samp{OPEN} time, for preconnected units via options or even statements in the main program unit, maybe even on a per-I/O basis with appropriate pragma-like devices). @@ -12500,20 +8411,20 @@ devices). @item Probably requiring the new library design, change interface to -normally have @code{COMPLEX} functions return their values in the way -@code{gcc} would if they were declared @code{__complex__ float}, +normally have @samp{COMPLEX} functions return their values in the way +@code{gcc} would if they were declared @samp{__complex__ float}, rather than using -the mechanism currently used by @code{CHARACTER} functions (whereby the +the mechanism currently used by @samp{CHARACTER} functions (whereby the functions are compiled as returning void and their first arg is a pointer to where to store the result). (Don't append underscores to -external names for @code{COMPLEX} functions in some cases once @code{g77} uses +external names for @samp{COMPLEX} functions in some cases once @code{g77} uses @code{gcc} rather than @code{f2c} calling conventions.) @item Do something useful with @samp{doiter} references where possible. For example, @samp{CALL FOO(I)} cannot modify @samp{I} if within -a @code{DO} loop that uses @samp{I} as the +a @samp{DO} loop that uses @samp{I} as the iteration variable, and the back end might find that info useful in determining whether it needs to read @samp{I} back into a register after the call. @@ -12542,7 +8453,7 @@ conflicts, while making debugger more straightforward. Also, it should make multi-language applications more feasible, such as by providing -Fortran intrinsics that get Fortran unit numbers given C @code{FILE *} +Fortran intrinsics that get Fortran unit numbers given C @samp{FILE *} descriptors. @item @@ -12550,7 +8461,7 @@ Possibly related to a new library, @code{g77} should produce the equivalent of a @code{gcc} @samp{main(argc, argv)} function when it compiles a main program unit, instead of compiling something that must be called by a library -implementation of @code{main()}. +implementation of @samp{main()}. This would do many useful things such as provide more flexibility in terms of setting up exception handling, @@ -12579,37 +8490,25 @@ so that some popular extensions can be more easily supported. @itemize @bullet @item -Look through all the documentation on the GNU Fortran language, -dialects, compiler, missing features, bugs, and so on. -Many mentions of incomplete or missing features are -sprinkled throughout. -It is not worth repeating them here. - -@item -Consider adding a @code{NUMERIC} type to designate typeless numeric constants, +Consider adding a @samp{NUMERIC} type to designate typeless numeric constants, named and unnamed. The idea is to provide a forward-looking, effective -replacement for things like the old-style @code{PARAMETER} statement +replacement for things like the old-style @samp{PARAMETER} statement when people really need typelessness in a maintainable, portable, clearly documented way. -Maybe @code{TYPELESS} would include @code{CHARACTER}, @code{POINTER}, +Maybe @samp{TYPELESS} would include @samp{CHARACTER}, @samp{POINTER}, and whatever else might come along. (This is not really a call for polymorphism per se, just an ability to express limited, syntactic polymorphism.) @item -Support @samp{OPEN(@dots{},KEY=(@dots{}),@dots{})}. - -@item -Support arbitrary file unit numbers, instead of limiting them -to 0 through @samp{MXUNIT-1}. -(This is a @code{libf2c} issue.) +Support @samp{OPEN(...,KEY=(...),...)}. @item @samp{OPEN(NOSPANBLOCKS,@dots{})} is treated as @samp{OPEN(UNIT=NOSPANBLOCKS,@dots{})}, so a -later @code{UNIT=} in the first example is invalid. +later @samp{UNIT=} in the first example is invalid. Make sure this is what users of this feature would expect. @item @@ -12621,10 +8520,10 @@ as whether general expressions separated by an apostrophe are supported, or maybe the record number can be a general expression, and so on. @item -Support @code{STRUCTURE}, @code{UNION}, @code{MAP}, and @code{RECORD} +Support @samp{STRUCTURE}, @samp{UNION}, @samp{MAP}, and @samp{RECORD} fully. Currently there is no support at all -for @code{%FILL} in @code{STRUCTURE} and related syntax, +for @samp{%FILL} in @samp{STRUCTURE} and related syntax, whereas the rest of the stuff has at least some parsing support. This requires either major @@ -12632,11 +8531,11 @@ changes to @code{libf2c} or its replacement. @item F90 and @code{g77} probably disagree about label scoping relative to -@code{INTERFACE} and @code{END INTERFACE}, and their contained +@samp{INTERFACE} and @samp{END INTERFACE}, and their contained procedure interface bodies (blocks?). @item -@code{ENTRY} doesn't support F90 @code{RESULT()} yet, +@samp{ENTRY} doesn't support F90 @samp{RESULT()} yet, since that was added after S8.112. @item @@ -12645,11 +8544,11 @@ with the final form of the standard (it was vague at S8.112). @item It seems to be an ``open'' question whether a file, immediately after being -@code{OPEN}ed,is positioned at the beginning, the end, or wherever---it +@samp{OPEN}ed,is positioned at the beginning, the end, or wherever---it might be nice to offer an option of opening to ``undefined'' status, requiring an explicit absolute-positioning operation to be performed before any -other (besides @code{CLOSE}) to assist in making applications port to systems -(some IBM?) that @code{OPEN} to the end of a file or some such thing. +other (besides @samp{CLOSE}) to assist in making applications port to systems +(some IBM?) that @samp{OPEN} to the end of a file or some such thing. @end itemize @node Machine Model @@ -12665,9 +8564,9 @@ Switch to using @samp{REAL_VALUE_TYPE} to represent floating-point constants exclusively so the target float format need not be required. This means changing the way @code{g77} handles initialization of aggregate areas -having more than one type, such as @code{REAL} and @code{INTEGER}, +having more than one type, such as @samp{REAL} and @samp{INTEGER}, because currently -it initializes them as if they were arrays of @code{char} and uses the +it initializes them as if they were arrays of @samp{char} and uses the bit patterns of the constants of the various types in them to determine what to stuff in elements of the arrays. @@ -12687,8 +8586,6 @@ libraries are installed) after building. @section Internals Documentation Better info on how @code{g77} works and how to port it is needed. -Much of this should be done only after the redesign planned for -0.6 is complete. @node Internals Improvements @section Internals Improvements @@ -12704,7 +8601,7 @@ For example, anything a caller can check, semantically, let it do so, rather than having @file{expr.c} do it. (Exceptions might include things like -diagnosing @samp{FOO(I--K:)=BAR} where @samp{FOO} is a @code{PARAMETER}---if +diagnosing @samp{FOO(I--K:)=BAR} where @samp{FOO} is a @samp{PARAMETER}---if it seems important to preserve the left-to-right-in-source order of production of diagnostics.) @@ -12735,7 +8632,7 @@ available instead (a good argument for wishing this could have written all this stuff in C++, perhaps). On the other hand, it's questionable whether this sort of improvement is really necessary, given the availability of -tools such as Emacs and Perl, which make finding any +tools such as Emacs and perl, which making finding any address-taking of structure members easy enough? @item @@ -12752,14 +8649,14 @@ of access macros in @samp{.h} files) so they can be tailored to catch code writing into a @samp{RETURNS()} or reading from a @samp{SETS()}. @item -Decorate throughout with @code{const} and other such stuff. +Decorate throughout with @samp{const} and other such stuff. @item All F90 notational derivations in the source code are still based on the S8.112 version of the draft standard. Probably should update to the official standard, or put documentation of the rules as used -in the code@dots{}uh@dots{}in the code. +in the code...uh...in the code. @item Some @samp{ffebld_new} calls (those outside of @file{ffeexpr.c} or @@ -12774,7 +8671,7 @@ Some @samp{ffebld_list_new} (or whatever) calls might not be matched by (It definitely is not a problem just yet.) @item -Probably not doing clean things when we fail to @code{EQUIVALENCE} something +Probably not doing clean things when we fail to @samp{EQUIVALENCE} something due to alignment/mismatch or other problems---they end up without @samp{ffestorag} objects, so maybe the backend (and other parts of the front end) can notice that and handle like an @samp{opANY} (do what it wants, just @@ -12793,9 +8690,14 @@ clutter. @itemize @bullet @item -When @code{FUNCTION} and @code{ENTRY} point types disagree (@code{CHARACTER} +Implement non-F90 messages (especially avoid mentioning F90 things @code{g77} +doesn't yet support). +Much of this has been done as of 0.5.14. + +@item +When @samp{FUNCTION} and @samp{ENTRY} point types disagree (@samp{CHARACTER} lengths, type classes, and so on), -@samp{ANY}-ize the offending @code{ENTRY} point and any @emph{new} dummies +@samp{ANY}-ize the offending @samp{ENTRY} point and any @emph{new} dummies it specifies. @item @@ -12811,255 +8713,12 @@ DATA (X(I), J= 1, 20) /20*5/ END @end example -@noindent -(The @code{CONTINUE} statement ensures the @code{DATA} statement +(The @samp{CONTINUE} statement ensures the @samp{DATA} statement is processed in the context of executable, not specification, statements.) @end itemize @end ifset -@ifset USING -@node Diagnostics -@chapter Diagnostics -@cindex diagnostics - -Some diagnostics produced by @code{g77} require sufficient explanation -that the explanations are given below, and the diagnostics themselves -identify the appropriate explanation. - -Identification uses the GNU Info format---specifically, the @code{info} -command that displays the explanation is given in within square -brackets in the diagnostic. -For example: - -@example -foo.f:5: Invalid statement [info -f g77 M FOOEY] -@end example - -More details about the above diagnostic is found in the @code{g77} Info -documentation, menu item @samp{M}, submenu item @samp{FOOEY}, -which is displayed by typing the UNIX command -@samp{info -f g77 M FOOEY}. - -Other Info readers, such as EMACS, may be just as easily used to display -the pertinent node. -In the above example, @samp{g77} is the Info document name, -@samp{M} is the top-level menu item to select, -and, in that node (named @samp{Diagnostics}, the name of -this chapter, which is the very text you're reading now), -@samp{FOOEY} is the menu item to select. - -@iftex -In this printed version of the @code{g77} manual, the above example -points to a section, below, entitled @samp{FOOEY}---though, of course, -as the above is just a sample, no such section exists. -@end iftex - -@menu -* CMPAMBIG:: Ambiguous use of intrinsic. -@end menu - -@node CMPAMBIG -@section @code{CMPAMBIG} - -@noindent -@example -Ambiguous use of intrinsic @var{intrinsic} @dots{} -@end example - -The type of the argument to the invocation of the @var{intrinsic} -intrinsic is a @code{COMPLEX} type other than @code{COMPLEX(KIND=1)}. -Typically, it is @code{COMPLEX(KIND=2)}, also known as -@code{DOUBLE COMPLEX}. - -The interpretation of this invocation depends on the particular -dialect of Fortran for which the code was written. -Some dialects convert the real part of the argument to -@code{REAL(KIND=1)}, thus losing precision; other dialects, -and Fortran 90, do no such conversion. - -So, GNU Fortran rejects such invocations except under certain -circumstances, to avoid making an incorrect assumption that results -in generating the wrong code. - -To determine the dialect of the program unit, perhaps even whether -that particular invocation is properly coded, determine how the -result of the intrinsic is used. - -The result of @var{intrinsic} is expected (by the original programmer) -to be @code{REAL(KIND=1)} (the non-Fortran-90 interpretation) if: - -@itemize @bullet -@item -It is passed as an argument to a procedure that explicitly or -implicitly declares that argument @code{REAL(KIND=1)}. - -For example, -a procedure with no @code{DOUBLE PRECISION} or @code{IMPLICIT DOUBLE PRECISION} -statement specifying the dummy argument corresponding to an -actual argument of @samp{REAL(Z)}, where @samp{Z} is declared -@code{DOUBLE COMPLEX}, strongly suggests that the programmer -expected @samp{REAL(Z)} to return @code{REAL(KIND=1)} instead -of @code{REAL(KIND=2)}. - -@item -It is used in a context that would otherwise not include -any @code{REAL(KIND=2)} but where treating the @var{intrinsic} -invocation as @code{REAL(KIND=2)} would result in unnecessary -promotions and (typically) more expensive operations on the -wider type. - -For example: - -@example -DOUBLE COMPLEX Z -@dots{} -R(1) = T * REAL(Z) -@end example - -The above example suggests the programmer expected the real part -of @samp{Z} to be converted to @code{REAL(KIND=1)} before being -multiplied by @samp{T} (presumed, along with @samp{R} above, to -be type @code{REAL(KIND=1)}). - -Otherwise, the conversion would have to be delayed until after -the multiplication, requiring not only an extra conversion -(of @samp{T} to @code{REAL(KIND=2)}), but a (typically) more -expensive multiplication (a double-precision multiplication instead -of a single-precision one). -@end itemize - -The result of @var{intrinsic} is expected (by the original programmer) -to be @code{REAL(KIND=2)} (the Fortran 90 interpretation) if: - -@itemize @bullet -@item -It is passed as an argument to a procedure that explicitly or -implicitly declares that argument @code{REAL(KIND=2)}. - -For example, a procedure specifying a @code{DOUBLE PRECISION} -dummy argument corresponding to an -actual argument of @samp{REAL(Z)}, where @samp{Z} is declared -@code{DOUBLE COMPLEX}, strongly suggests that the programmer -expected @samp{REAL(Z)} to return @code{REAL(KIND=2)} instead -of @code{REAL(KIND=1)}. - -@item -It is used in an expression context that includes -other @code{REAL(KIND=2)} operands, -or is assigned to a @code{REAL(KIND=2)} variable or array element. - -For example: - -@example -DOUBLE COMPLEX Z -DOUBLE PRECISION R, T -@dots{} -R(1) = T * REAL(Z) -@end example - -The above example suggests the programmer expected the real part -of @samp{Z} to @emph{not} be converted to @code{REAL(KIND=1)} -by the @code{REAL()} intrinsic. - -Otherwise, the conversion would have to be immediately followed -by a conversion back to @code{REAL(KIND=2)}, losing -the original, full precision of the real part of @code{Z}, -before being multiplied by @samp{T}. -@end itemize - -Once you have determined whether a particular invocation of @var{intrinsic} -expects the Fortran 90 interpretation, you can: - -@itemize @bullet -@item -Change it to @samp{DBLE(@var{intrinsic}(@var{expr}))}, -if it expected the Fortran 90 interpretation. - -This assumes @var{expr} is @code{COMPLEX(KIND=2)}---if it is -some other type, such as @code{COMPLEX*32}, you should use the -appropriate intrinsic, such as the one to convert to @code{REAL*16} -(perhaps @code{DBLEQ()}), in place of @code{DBLE()}. - -@item -Change it to @samp{REAL(@var{intrinsic}(@var{expr}))}, -otherwise. -This converts to @code{REAL(KIND=1)} in all working -Fortran compilers. -@end itemize - -If you don't want to change the code, and you are certain that all -ambiguous invocations of @var{intrinsic} in the source file have -the same expectation regarding interpretation, you can: - -@itemize @bullet -@item -Compile with the @code{g77} option @samp{-ff90}, to enable the -Fortran 90 interpretation. - -@item -Compile with the @code{g77} options @samp{-fno-f90 -fugly-complex}, -to enable the non-Fortran-90 interpretations. -@end itemize - -@xref{REAL() and AIMAG() of Complex}, for more information on this -issue. - -Note: If the above suggestions don't produce enough evidence -as to whether a particular program expects the Fortran 90 -interpretation of this ambiguous invocation of @var{intrinsic}, -there is one more thing you can try. - -If you have access to most or all the compilers used on the -program to create successfully tested and deployed executables, -read the documentation for, and @emph{also} test out, each compiler -to determine how it treats the @var{intrinsic} intrinsic in -this case. -(If all the compilers don't agree on an interpretation, there -might be lurking bugs in the deployed versions of the program.) - -The following sample program might help: - -@cindex JCB003 program -@smallexample - PROGRAM JCB003 -C -C Written by James Craig Burley 1997-02-23. -C Contact via Internet email: burley@@gnu.ai.mit.edu -C -C Determine how compilers handle non-standard REAL -C and AIMAG on DOUBLE COMPLEX operands. -C - DOUBLE COMPLEX Z - REAL R - Z = (3.3D0, 4.4D0) - R = Z - CALL DUMDUM(Z, R) - R = REAL(Z) - R - IF (R .NE. 0.) PRINT *, 'REAL() is Fortran 90' - IF (R .EQ. 0.) PRINT *, 'REAL() is not Fortran 90' - R = 4.4D0 - CALL DUMDUM(Z, R) - R = AIMAG(Z) - R - IF (R .NE. 0.) PRINT *, 'AIMAG() is Fortran 90' - IF (R .EQ. 0.) PRINT *, 'AIMAG() is not Fortran 90' - END -C -C Just to make sure compiler doesn't use naive flow -C analysis to optimize away careful work above, -C which might invalidate results.... -C - SUBROUTINE DUMDUM(Z, R) - DOUBLE COMPLEX Z - REAL R - END -@end smallexample - -If the above program prints contradictory results on a -particular compiler, run away! - -@end ifset - @node Index @unnumbered Index diff --git a/gnu/usr.bin/gcc/f/gbe/2.6.3.diff b/gnu/usr.bin/gcc/f/gbe/2.6.3.diff new file mode 100644 index 00000000000..8ceee52de91 --- /dev/null +++ b/gnu/usr.bin/gcc/f/gbe/2.6.3.diff @@ -0,0 +1,186 @@ +*** gcc-2.6.3/Makefile.in Fri Dec 2 16:03:09 1994 +--- g77-2.6.3-0.5.16/Makefile.in Thu Aug 10 04:01:02 1995 +*************** ENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUB +*** 118,121 **** +--- 118,126 ---- + ENQUIRE_LDFLAGS = $(LDFLAGS) + ++ # NEXT FOUR LINES ADDED BY g77 PATCH ONLY TO ENABLE COMPATIBILITY WITH 2.7.x. ++ # Sed command to transform gcc to installed name. Overwritten by configure. ++ program_transform_name = -e s,x,x, ++ program_transform_cross_name = -e s,^,$(target)-, ++ + # Tools to use when building a cross-compiler. + # These are used because `configure' appends `cross-make' +*************** infodir = $(prefix)/info +*** 176,179 **** +--- 181,188 ---- + # Extension (if any) to put in installed man-page filename. + manext = .1 ++ # NEXT THREE LINES ADDED BY g77 PATCH ONLY TO ENABLE COMPATIBILITY WITH 2.7.x. ++ objext = .o ++ exeext = ++ + # Directory in which to put man pages. + mandir = $(prefix)/man/man1 +*************** c-common.o : c-common.c $(CONFIG_H) $(TR +*** 1010,1014 **** + # Language-independent files. + +! gcc.o: gcc.c $(CONFIG_H) multilib.h config.status + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \ +--- 1019,1023 ---- + # Language-independent files. + +! gcc.o: gcc.c $(CONFIG_H) multilib.h config.status f/lang-specs.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \ +*************** stor-layout.o : stor-layout.c $(CONFIG_H +*** 1032,1036 **** + fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h + toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h input.h \ +! insn-attr.h xcoffout.h defaults.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(MAYBE_TARGET_DEFAULT) $(MAYBE_USE_COLLECT2) \ +--- 1041,1045 ---- + fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h + toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h input.h \ +! insn-attr.h xcoffout.h defaults.h f/lang-options.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(MAYBE_TARGET_DEFAULT) $(MAYBE_USE_COLLECT2) \ +*** gcc-2.6.3/fold-const.c Fri Dec 2 16:03:43 1994 +--- g77-2.6.3-0.5.16/fold-const.c Thu Aug 10 04:01:03 1995 +*************** eval_subst (arg, old0, new0, old1, new1) +*** 1938,1943 **** +--- 1938,1948 ---- + switch (code) + { ++ /* ??? Disable this since the SAVE_EXPR might already be in use outside ++ the expression. There may be no way to make this work, but it needs ++ to be looked at again for 2.6. */ ++ #if 0 + case SAVE_EXPR: + return eval_subst (TREE_OPERAND (arg, 0), old0, new0, old1, new1); ++ #endif + + case COMPOUND_EXPR: +*************** fold (expr) +*** 3953,3958 **** +--- 3958,3968 ---- + tree xarg0 = arg0; + ++ /* ??? Disable this since the SAVE_EXPR might already be in use outside ++ the expression. There may be no way to make this work, but it needs ++ to be looked at again for 2.6. */ ++ #if 0 + if (TREE_CODE (xarg0) == SAVE_EXPR) + have_save_expr = 1, xarg0 = TREE_OPERAND (xarg0, 0); ++ #endif + + STRIP_NOPS (xarg0); +*************** fold (expr) +*** 3971,3976 **** +--- 3981,3991 ---- + } + ++ /* ??? Disable this since the SAVE_EXPR might already be in use outside ++ the expression. There may be no way to make this work, but it needs ++ to be looked at again for 2.6. */ ++ #if 0 + if (TREE_CODE (xarg0) == SAVE_EXPR) + have_save_expr = 1, xarg0 = TREE_OPERAND (xarg0, 0); ++ #endif + + STRIP_NOPS (xarg0); +*** gcc-2.6.3/gcc.c Mon Nov 7 11:01:43 1994 +--- g77-2.6.3-0.5.16/gcc.c Thu Aug 10 04:01:03 1995 +*************** static struct compiler default_compilers +*** 712,715 **** +--- 712,716 ---- + %{c:%W{o*}%{!o*:-o %w%b.o}}\ + %{!c:-o %d%w%u.o} %{!pipe:%g.s} %A\n}}}}}} "}, ++ #include "f/lang-specs.h" + /* Mark end of table */ + {0, 0} +*** gcc-2.6.3/obstack.c Sat Nov 12 06:40:02 1994 +--- g77-2.6.3-0.5.16/obstack.c Thu Aug 10 04:01:04 1995 +*************** Foundation, 675 Mass Ave, Cambridge, MA +*** 27,33 **** + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, +! it is simpler to just do this in the source for each such file. */ + +! #if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +--- 27,40 ---- + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, +! it is simpler to just do this in the source for each such file. + +! Actually, don't comment this code out after all. Else, unless the +! inlining set up by obstack.h also is commented out (and replaced by +! including the system's ), bugs will result on a system +! with an older obstack (with older and different inlining) installed. +! And for now it doesn't seem worth having obstack.h #include , +! as above, just to get __GNU_LIBRARY__ defined, for example. */ +! +! #if defined (_LIBC) || !defined (__GNU_LIBRARY__) || 1 + + +*** gcc-2.6.3/stor-layout.c Thu Oct 20 09:41:02 1994 +--- g77-2.6.3-0.5.16/stor-layout.c Thu Aug 10 04:01:04 1995 +*************** get_pending_sizes () +*** 80,83 **** +--- 80,93 ---- + } + ++ void ++ put_pending_sizes (chain) ++ tree chain; ++ { ++ if (pending_sizes) ++ abort (); ++ ++ pending_sizes = chain; ++ } ++ + /* Given a size SIZE that isn't constant, return a SAVE_EXPR + to serve as the actual size-expression for a type or decl. */ +*** gcc-2.6.3/toplev.c Tue Oct 25 16:09:12 1994 +--- g77-2.6.3-0.5.16/toplev.c Thu Aug 10 04:01:05 1995 +*************** char *lang_options[] = +*** 725,728 **** +--- 725,730 ---- + "-Wno-protocol", + ++ #include "f/lang-options.h" ++ + /* This is for GNAT and is temporary. */ + "-gnat", +*** gcc-2.6.3/tree.c Fri Dec 2 16:03:49 1994 +--- g77-2.6.3-0.5.16/tree.c Thu Aug 10 04:01:05 1995 +*************** save_expr (expr) +*** 1984,1988 **** + + if (TREE_CONSTANT (t) || (TREE_READONLY (t) && ! TREE_SIDE_EFFECTS (t)) +! || TREE_CODE (t) == SAVE_EXPR) + return t; + +--- 1984,1988 ---- + + if (TREE_CONSTANT (t) || (TREE_READONLY (t) && ! TREE_SIDE_EFFECTS (t)) +! || TREE_CODE (t) == SAVE_EXPR || TREE_CODE (t) == ERROR_MARK) + return t; + +*** gcc-2.6.3/tree.h Thu Sep 8 14:25:41 1994 +--- g77-2.6.3-0.5.16/tree.h Thu Aug 10 04:01:06 1995 +*************** extern tree size_int PROTO((unsigned)) +*** 1245,1248 **** +--- 1245,1249 ---- + extern tree round_up PROTO((tree, int)); + extern tree get_pending_sizes PROTO((void)); ++ extern void put_pending_sizes PROTO((tree)); + + /* Type for sizes of data-type. */ diff --git a/gnu/usr.bin/gcc/f/gbe/2.7.0.diff b/gnu/usr.bin/gcc/f/gbe/2.7.0.diff new file mode 100644 index 00000000000..e69de29bb2d diff --git a/gnu/usr.bin/gcc/f/gbe/2.7.1.diff b/gnu/usr.bin/gcc/f/gbe/2.7.1.diff new file mode 100644 index 00000000000..e69de29bb2d diff --git a/gnu/usr.bin/gcc/f/gbe/2.7.2.1.diff b/gnu/usr.bin/gcc/f/gbe/2.7.2.1.diff new file mode 100644 index 00000000000..95b84789fd6 --- /dev/null +++ b/gnu/usr.bin/gcc/f/gbe/2.7.2.1.diff @@ -0,0 +1,246 @@ +IMPORTANT: After applying this patch, you must rebuild the +Info documentation derived from the Texinfo files in the +gcc distribution, as this patch does not include patches +to any derived files (due to differences in the way gcc +version 2.7.2.1 is obtained by users). Use the following +command sequence after applying this patch: + + cd gcc-2.7.2.1; make -f Makefile.in gcc.info + +If that fails due to `makeinfo' not being installed, obtain +texinfo-3.9.tar.gz from a GNU distribution site, unpack, +build, and install it, and try the above command sequence +again. + + +diff -rcp2N gcc-2.7.2.1/flags.h gcc-2.7.2.1.f.1/flags.h +*** gcc-2.7.2.1/flags.h Thu Jun 15 07:34:11 1995 +--- gcc-2.7.2.1.f.1/flags.h Mon Nov 11 15:02:26 1996 +*************** extern int flag_unroll_loops; +*** 204,207 **** +--- 204,221 ---- + extern int flag_unroll_all_loops; + ++ /* Nonzero forces all invariant computations in loops to be moved ++ outside the loop. */ ++ ++ extern int flag_move_all_movables; ++ ++ /* Nonzero forces all general induction variables in loops to be ++ strength reduced. */ ++ ++ extern int flag_reduce_all_givs; ++ ++ /* Nonzero gets another run of loop_optimize performed. */ ++ ++ extern int flag_rerun_loop_opt; ++ + /* Nonzero for -fcse-follow-jumps: + have cse follow jumps to do a more extensive job. */ +diff -rcp2N gcc-2.7.2.1/gcc.texi gcc-2.7.2.1.f.1/gcc.texi +*** gcc-2.7.2.1/gcc.texi Mon Nov 11 14:54:07 1996 +--- gcc-2.7.2.1.f.1/gcc.texi Mon Nov 11 15:04:26 1996 +*************** original English. +*** 149,152 **** +--- 149,153 ---- + @sp 3 + @center Last updated 29 June 1996 ++ @center (Revised for GNU Fortran 1996-03-06) + @sp 1 + @c The version number appears twice more in this file. +diff -rcp2N gcc-2.7.2.1/invoke.texi gcc-2.7.2.1.f.1/invoke.texi +*** gcc-2.7.2.1/invoke.texi Tue Oct 3 11:40:43 1995 +--- gcc-2.7.2.1.f.1/invoke.texi Mon Nov 11 15:02:33 1996 +*************** in the following sections. +*** 149,152 **** +--- 149,153 ---- + -fschedule-insns2 -fstrength-reduce -fthread-jumps + -funroll-all-loops -funroll-loops ++ -fmove-all-movables -freduce-all-givs -frerun-loop-opt + -O -O0 -O1 -O2 -O3 + @end smallexample +*************** Perform the optimization of loop unrolli +*** 1940,1943 **** +--- 1941,1985 ---- + and usually makes programs run more slowly. @samp{-funroll-all-loops} + implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}. ++ ++ @item -fmove-all-movables ++ Forces all invariant computations in loops to be moved ++ outside the loop. ++ This option is provided primarily to improve performance ++ for some Fortran code, though it might improve code written ++ in other languages. ++ ++ @emph{Note:} When compiling programs written in Fortran, ++ this option is enabled by default. ++ ++ Analysis of Fortran code optimization and the resulting ++ optimizations triggered by this option, and the ++ @samp{-freduce-all-givs} and @samp{-frerun-loop-opt} ++ options as well, were ++ contributed by Toon Moene (@code{toon@@moene.indiv.nluug.nl}). ++ ++ Please let us (@code{fortran@@gnu.ai.mit.edu}) ++ know how use of these options affects ++ the performance of your production code. ++ We're very interested in code that runs @emph{slower} ++ when these options are @emph{enabled}. ++ ++ @item -freduce-all-givs ++ Forces all general-induction variables in loops to be ++ strength-reduced. ++ This option is provided primarily to improve performance ++ for some Fortran code, though it might improve code written ++ in other languages. ++ ++ @emph{Note:} When compiling programs written in Fortran, ++ this option is enabled by default. ++ ++ @item -frerun-loop-opt ++ Runs loop optimizations a second time. ++ This option is provided primarily to improve performance ++ for some Fortran code, though it might improve code written ++ in other languages. ++ ++ @emph{Note:} When compiling programs written in Fortran, ++ this option is enabled by default. + + @item -fno-peephole +diff -rcp2N gcc-2.7.2.1/loop.c gcc-2.7.2.1.f.1/loop.c +*** gcc-2.7.2.1/loop.c Mon Nov 11 14:54:08 1996 +--- gcc-2.7.2.1.f.1/loop.c Mon Nov 11 15:02:33 1996 +*************** move_movables (movables, threshold, insn +*** 1629,1632 **** +--- 1629,1633 ---- + + if (already_moved[regno] ++ || flag_move_all_movables + || (threshold * savings * m->lifetime) >= insn_count + || (m->forces && m->forces->done +*************** strength_reduce (scan_start, end, loop_t +*** 3821,3826 **** + exit. */ + +! if (v->lifetime * threshold * benefit < insn_count +! && ! bl->reversed) + { + if (loop_dump_stream) +--- 3822,3827 ---- + exit. */ + +! if ( ! flag_reduce_all_givs && v->lifetime * threshold * benefit < insn_count +! && ! bl->reversed ) + { + if (loop_dump_stream) +diff -rcp2N gcc-2.7.2.1/toplev.c gcc-2.7.2.1.f.1/toplev.c +*** gcc-2.7.2.1/toplev.c Fri Oct 20 17:56:35 1995 +--- gcc-2.7.2.1.f.1/toplev.c Mon Nov 11 15:02:33 1996 +*************** int flag_unroll_loops; +*** 388,391 **** +--- 388,405 ---- + int flag_unroll_all_loops; + ++ /* Nonzero forces all invariant computations in loops to be moved ++ outside the loop. */ ++ ++ int flag_move_all_movables = 0; ++ ++ /* Nonzero forces all general induction variables in loops to be ++ strength reduced. */ ++ ++ int flag_reduce_all_givs = 0; ++ ++ /* Nonzero gets another run of loop_optimize performed. */ ++ ++ int flag_rerun_loop_opt = 0; ++ + /* Nonzero for -fwritable-strings: + store string constants in data segment and don't uniquize them. */ +*************** struct { char *string; int *variable; in +*** 542,545 **** +--- 556,562 ---- + {"unroll-loops", &flag_unroll_loops, 1}, + {"unroll-all-loops", &flag_unroll_all_loops, 1}, ++ {"move-all-movables", &flag_move_all_movables, 1}, ++ {"reduce-all-givs", &flag_reduce_all_givs, 1}, ++ {"rerun-loop-opt", &flag_rerun_loop_opt, 1}, + {"writable-strings", &flag_writable_strings, 1}, + {"peephole", &flag_no_peephole, 0}, +*************** rest_of_compilation (decl) +*** 2894,2897 **** +--- 2911,2916 ---- + { + loop_optimize (insns, loop_dump_file); ++ if (flag_rerun_loop_opt) ++ loop_optimize (insns, loop_dump_file); + }); + } +diff -rcp2N gcc-2.7.2.1/tree.c gcc-2.7.2.1.f.1/tree.c +*** gcc-2.7.2.1/tree.c Sun Oct 1 21:26:56 1995 +--- gcc-2.7.2.1.f.1/tree.c Mon Nov 11 15:02:33 1996 +*************** saveable_tree_cons (purpose, value, chai +*** 1965,1968 **** +--- 1965,1992 ---- + } + ++ /* Try to find out whether the type for which the size is to be determined ++ is an ARRAY(of ARRAY(of ARRAY ... of something with a constant size ++ which is an integral multiple of BITS_PER_UNIT)). ++ In that case, the size in bytes can be determined using an EXACT_DIV_EXPR. ++ */ ++ enum tree_code ++ which_div_expr(type) ++ tree type; ++ { ++ tree t; ++ ++ if (TREE_CODE (type) != POINTER_TYPE && TREE_CODE (type) != ARRAY_TYPE) ++ return CEIL_DIV_EXPR; ++ ++ for (t = TREE_TYPE (type); TREE_CODE (t) == ARRAY_TYPE; t = TREE_TYPE (t)) ++ ; ++ ++ if (TYPE_SIZE (t) != 0 && TREE_CODE (TYPE_SIZE (t)) == INTEGER_CST && ++ TREE_INT_CST_LOW (TYPE_SIZE (t)) % BITS_PER_UNIT == 0) ++ return EXACT_DIV_EXPR; ++ else ++ return CEIL_DIV_EXPR; ++ } ++ + /* Return the size nominally occupied by an object of type TYPE + when it resides in memory. The value is measured in units of bytes, +*************** size_in_bytes (type) +*** 1985,1989 **** + return integer_zero_node; + } +! t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), + size_int (BITS_PER_UNIT)); + if (TREE_CODE (t) == INTEGER_CST) +--- 2009,2013 ---- + return integer_zero_node; + } +! t = size_binop (which_div_expr (type), TYPE_SIZE (type), + size_int (BITS_PER_UNIT)); + if (TREE_CODE (t) == INTEGER_CST) +*************** int_size_in_bytes (type) +*** 2009,2013 **** + if (TREE_INT_CST_HIGH (TYPE_SIZE (type)) != 0) + { +! tree t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), + size_int (BITS_PER_UNIT)); + return TREE_INT_CST_LOW (t); +--- 2033,2037 ---- + if (TREE_INT_CST_HIGH (TYPE_SIZE (type)) != 0) + { +! tree t = size_binop (which_div_expr (type), TYPE_SIZE (type), + size_int (BITS_PER_UNIT)); + return TREE_INT_CST_LOW (t); +diff -rcp2N gcc-2.7.2.1/version.c gcc-2.7.2.1.f.1/version.c +*** gcc-2.7.2.1/version.c Mon Nov 11 14:54:09 1996 +--- gcc-2.7.2.1.f.1/version.c Mon Nov 11 15:02:34 1996 +*************** +*** 1 **** +! char *version_string = "2.7.2.1"; +--- 1 ---- +! char *version_string = "2.7.2.1.f.1"; diff --git a/gnu/usr.bin/gcc/f/gbe/2.7.2.diff b/gnu/usr.bin/gcc/f/gbe/2.7.2.diff new file mode 100644 index 00000000000..4b27bae56d5 --- /dev/null +++ b/gnu/usr.bin/gcc/f/gbe/2.7.2.diff @@ -0,0 +1,801 @@ +*** gcc-2.7.2/flags.h Thu Jun 15 07:34:11 1995 +--- g77-new/flags.h Wed Mar 6 10:32:55 1996 +*************** extern int flag_unroll_loops; +*** 204,207 **** +--- 204,221 ---- + extern int flag_unroll_all_loops; + ++ /* Nonzero forces all invariant computations in loops to be moved ++ outside the loop. */ ++ ++ extern int flag_move_all_movables; ++ ++ /* Nonzero forces all general induction variables in loops to be ++ strength reduced. */ ++ ++ extern int flag_reduce_all_givs; ++ ++ /* Nonzero gets another run of loop_optimize performed. */ ++ ++ extern int flag_rerun_loop_opt; ++ + /* Nonzero for -fcse-follow-jumps: + have cse follow jumps to do a more extensive job. */ +*** gcc-2.7.2/gcc.info Wed Mar 6 10:23:38 1996 +--- g77-new/gcc.info Fri Mar 15 02:17:17 1996 +*************** Indirect: +*** 34,60 **** + gcc.info-1: 1382 + gcc.info-2: 42854 +! gcc.info-3: 80578 +! gcc.info-4: 127608 +! gcc.info-5: 173792 +! gcc.info-6: 214726 +! gcc.info-7: 235436 +! gcc.info-8: 285158 +! gcc.info-9: 333642 +! gcc.info-10: 382691 +! gcc.info-11: 419654 +! gcc.info-12: 468472 +! gcc.info-13: 517503 +! gcc.info-14: 564845 +! gcc.info-15: 604398 +! gcc.info-16: 654371 +! gcc.info-17: 703324 +! gcc.info-18: 751502 +! gcc.info-19: 797360 +! gcc.info-20: 846162 +! gcc.info-21: 890260 +! gcc.info-22: 933466 +! gcc.info-23: 982355 +! gcc.info-24: 1032258 +! gcc.info-25: 1067513 +  + Tag Table: +--- 34,60 ---- + gcc.info-1: 1382 + gcc.info-2: 42854 +! gcc.info-3: 80645 +! gcc.info-4: 129158 +! gcc.info-5: 175342 +! gcc.info-6: 216276 +! gcc.info-7: 236986 +! gcc.info-8: 286708 +! gcc.info-9: 335192 +! gcc.info-10: 384241 +! gcc.info-11: 421204 +! gcc.info-12: 470022 +! gcc.info-13: 519053 +! gcc.info-14: 566395 +! gcc.info-15: 605948 +! gcc.info-16: 655921 +! gcc.info-17: 704874 +! gcc.info-18: 753052 +! gcc.info-19: 798910 +! gcc.info-20: 847712 +! gcc.info-21: 891810 +! gcc.info-22: 935016 +! gcc.info-23: 983905 +! gcc.info-24: 1033808 +! gcc.info-25: 1069063 +  + Tag Table: +*************** Node: G++ and GCC37258 +*** 68,297 **** + Node: Invoking GCC39475 + Node: Option Summary42854 +! Node: Overall Options53305 +! Node: Invoking G++57868 +! Node: C Dialect Options59742 +! Node: C++ Dialect Options69842 +! Node: Warning Options80578 +! Node: Debugging Options95513 +! Node: Optimize Options105094 +! Node: Preprocessor Options115596 +! Node: Assembler Options122059 +! Node: Link Options122426 +! Node: Directory Options127608 +! Node: Target Options131100 +! Node: Submodel Options134757 +! Node: M680x0 Options136138 +! Node: VAX Options139647 +! Node: SPARC Options140182 +! Node: Convex Options146602 +! Node: AMD29K Options148783 +! Node: ARM Options151814 +! Node: M88K Options153231 +! Node: RS/6000 and PowerPC Options161178 +! Node: RT Options172088 +! Node: MIPS Options173792 +! Node: i386 Options181418 +! Node: HPPA Options186857 +! Node: Intel 960 Options189953 +! Node: DEC Alpha Options192563 +! Node: Clipper Options194235 +! Node: H8/300 Options194634 +! Node: System V Options195079 +! Node: Code Gen Options195765 +! Node: Environment Variables204274 +! Node: Running Protoize208497 +! Node: Installation214726 +! Node: Configurations235436 +! Node: Other Dir271347 +! Node: Cross-Compiler273063 +! Node: Steps of Cross274894 +! Node: Configure Cross276012 +! Node: Tools and Libraries276649 +! Node: Cross Runtime279092 +! Node: Cross Headers283173 +! Node: Build Cross285158 +! Node: Sun Install287034 +! Node: VMS Install288166 +! Node: Collect2298095 +! Node: Header Dirs300804 +! Node: C Extensions302218 +! Node: Statement Exprs305497 +! Node: Local Labels307391 +! Node: Labels as Values309453 +! Node: Nested Functions311318 +! Node: Constructing Calls315174 +! Node: Naming Types317231 +! Node: Typeof318325 +! Node: Lvalues320190 +! Node: Conditionals322630 +! Node: Long Long323521 +! Node: Complex324965 +! Node: Zero Length326827 +! Node: Variable Length327501 +! Node: Macro Varargs330026 +! Node: Subscripting332129 +! Node: Pointer Arith332612 +! Node: Initializers333177 +! Node: Constructors333642 +! Node: Labeled Elements335336 +! Node: Case Ranges337965 +! Node: Cast to Union338646 +! Node: Function Attributes339724 +! Node: Function Prototypes348987 +! Node: C++ Comments350786 +! Node: Dollar Signs351322 +! Node: Character Escapes352102 +! Node: Alignment352383 +! Node: Variable Attributes353855 +! Node: Type Attributes361763 +! Node: Inline368282 +! Node: Extended Asm372159 +! Node: Asm Labels382691 +! Node: Explicit Reg Vars384010 +! Node: Global Reg Vars385258 +! Node: Local Reg Vars389823 +! Node: Alternate Keywords391415 +! Node: Incomplete Enums392817 +! Node: Function Names393573 +! Node: C++ Extensions394824 +! Node: Naming Results396061 +! Node: Min and Max399375 +! Node: Destructors and Goto400825 +! Node: C++ Interface401375 +! Node: Template Instantiation406598 +! Node: C++ Signatures412330 +! Node: Trouble416674 +! Node: Actual Bugs418385 +! Node: Installation Problems419654 +! Node: Cross-Compiler Problems433440 +! Node: Interoperation434911 +! Node: External Bugs448275 +! Node: Incompatibilities450407 +! Node: Fixed Headers458957 +! Node: Standard Libraries461299 +! Node: Disappointments462546 +! Node: C++ Misunderstandings466771 +! Node: Static Definitions467418 +! Node: Temporaries468472 +! Node: Protoize Caveats470676 +! Node: Non-bugs474632 +! Node: Warnings and Errors483592 +! Node: Bugs485362 +! Node: Bug Criteria486722 +! Node: Bug Lists489152 +! Node: Bug Reporting490545 +! Node: Sending Patches502963 +! Node: Service508350 +! Node: VMS508911 +! Node: Include Files and VMS509304 +! Node: Global Declarations513194 +! Node: VMS Misc517503 +! Node: Portability521829 +! Node: Interface523592 +! Node: Passes528225 +! Node: RTL545568 +! Node: RTL Objects547456 +! Node: Accessors550500 +! Node: Flags555826 +! Node: Machine Modes564845 +! Node: Constants572479 +! Node: Regs and Memory577667 +! Node: Arithmetic589377 +! Node: Comparisons595275 +! Node: Bit Fields599337 +! Node: Conversions600701 +! Node: RTL Declarations603589 +! Node: Side Effects604398 +! Node: Incdec616945 +! Node: Assembler619461 +! Node: Insns620983 +! Node: Calls641836 +! Node: Sharing644431 +! Node: Reading RTL647507 +! Node: Machine Desc648446 +! Node: Patterns650299 +! Node: Example653243 +! Node: RTL Template654371 +! Node: Output Template666569 +! Node: Output Statement670530 +! Node: Constraints674243 +! Node: Simple Constraints675246 +! Node: Multi-Alternative686679 +! Node: Class Preferences689515 +! Node: Modifiers690395 +! Node: Machine Constraints693555 +! Node: No Constraints702203 +! Node: Standard Names703324 +! Node: Pattern Ordering731232 +! Node: Dependent Patterns732458 +! Node: Jump Patterns735273 +! Node: Insn Canonicalizations741089 +! Node: Peephole Definitions744584 +! Node: Expander Definitions751502 +! Node: Insn Splitting758948 +! Node: Insn Attributes765962 +! Node: Defining Attributes767009 +! Node: Expressions769021 +! Node: Tagging Insns775333 +! Node: Attr Example779696 +! Node: Insn Lengths782072 +! Node: Constant Attributes785436 +! Node: Delay Slots786596 +! Node: Function Units789807 +! Node: Target Macros795477 +! Node: Driver797360 +! Node: Run-time Target809090 +! Node: Storage Layout814977 +! Node: Type Layout828925 +! Node: Registers835348 +! Node: Register Basics836328 +! Node: Allocation Order840365 +! Node: Values in Registers841783 +! Node: Leaf Functions846162 +! Node: Stack Registers848637 +! Node: Obsolete Register Macros849470 +! Node: Register Classes852165 +! Node: Stack and Calling871700 +! Node: Frame Layout872136 +! Node: Frame Registers875576 +! Node: Elimination879386 +! Node: Stack Arguments883642 +! Node: Register Arguments890260 +! Node: Scalar Return898935 +! Node: Aggregate Return902898 +! Node: Caller Saves906613 +! Node: Function Entry907763 +! Node: Profiling916691 +! Node: Varargs919595 +! Node: Trampolines927004 +! Node: Library Calls933466 +! Node: Addressing Modes941524 +! Node: Condition Code949112 +! Node: Costs955311 +! Node: Sections963690 +! Node: PIC968479 +! Node: Assembler Format971189 +! Node: File Framework972194 +! Node: Data Output976431 +! Node: Uninitialized Data982355 +! Node: Label Output985062 +! Node: Initialization994456 +! Node: Macros for Initialization1000599 +! Node: Instruction Output1005196 +! Node: Dispatch Tables1013191 +! Node: Alignment Output1015568 +! Node: Debugging Info1017308 +! Node: All Debuggers1017917 +! Node: DBX Options1020331 +! Node: DBX Hooks1025216 +! Node: File Names and DBX1028555 +! Node: SDB and DWARF1030528 +! Node: Cross-compilation1032258 +! Node: Misc1038705 +! Node: Config1055831 +! Node: Fragments1063276 +! Node: Target Fragment1063873 +! Node: Host Fragment1066911 +! Node: Index1067513 +  + End Tag Table +--- 68,297 ---- + Node: Invoking GCC39475 + Node: Option Summary42854 +! Node: Overall Options53372 +! Node: Invoking G++57935 +! Node: C Dialect Options59809 +! Node: C++ Dialect Options69909 +! Node: Warning Options80645 +! Node: Debugging Options95580 +! Node: Optimize Options105161 +! Node: Preprocessor Options117146 +! Node: Assembler Options123609 +! Node: Link Options123976 +! Node: Directory Options129158 +! Node: Target Options132650 +! Node: Submodel Options136307 +! Node: M680x0 Options137688 +! Node: VAX Options141197 +! Node: SPARC Options141732 +! Node: Convex Options148152 +! Node: AMD29K Options150333 +! Node: ARM Options153364 +! Node: M88K Options154781 +! Node: RS/6000 and PowerPC Options162728 +! Node: RT Options173638 +! Node: MIPS Options175342 +! Node: i386 Options182968 +! Node: HPPA Options188407 +! Node: Intel 960 Options191503 +! Node: DEC Alpha Options194113 +! Node: Clipper Options195785 +! Node: H8/300 Options196184 +! Node: System V Options196629 +! Node: Code Gen Options197315 +! Node: Environment Variables205824 +! Node: Running Protoize210047 +! Node: Installation216276 +! Node: Configurations236986 +! Node: Other Dir272897 +! Node: Cross-Compiler274613 +! Node: Steps of Cross276444 +! Node: Configure Cross277562 +! Node: Tools and Libraries278199 +! Node: Cross Runtime280642 +! Node: Cross Headers284723 +! Node: Build Cross286708 +! Node: Sun Install288584 +! Node: VMS Install289716 +! Node: Collect2299645 +! Node: Header Dirs302354 +! Node: C Extensions303768 +! Node: Statement Exprs307047 +! Node: Local Labels308941 +! Node: Labels as Values311003 +! Node: Nested Functions312868 +! Node: Constructing Calls316724 +! Node: Naming Types318781 +! Node: Typeof319875 +! Node: Lvalues321740 +! Node: Conditionals324180 +! Node: Long Long325071 +! Node: Complex326515 +! Node: Zero Length328377 +! Node: Variable Length329051 +! Node: Macro Varargs331576 +! Node: Subscripting333679 +! Node: Pointer Arith334162 +! Node: Initializers334727 +! Node: Constructors335192 +! Node: Labeled Elements336886 +! Node: Case Ranges339515 +! Node: Cast to Union340196 +! Node: Function Attributes341274 +! Node: Function Prototypes350537 +! Node: C++ Comments352336 +! Node: Dollar Signs352872 +! Node: Character Escapes353652 +! Node: Alignment353933 +! Node: Variable Attributes355405 +! Node: Type Attributes363313 +! Node: Inline369832 +! Node: Extended Asm373709 +! Node: Asm Labels384241 +! Node: Explicit Reg Vars385560 +! Node: Global Reg Vars386808 +! Node: Local Reg Vars391373 +! Node: Alternate Keywords392965 +! Node: Incomplete Enums394367 +! Node: Function Names395123 +! Node: C++ Extensions396374 +! Node: Naming Results397611 +! Node: Min and Max400925 +! Node: Destructors and Goto402375 +! Node: C++ Interface402925 +! Node: Template Instantiation408148 +! Node: C++ Signatures413880 +! Node: Trouble418224 +! Node: Actual Bugs419935 +! Node: Installation Problems421204 +! Node: Cross-Compiler Problems434990 +! Node: Interoperation436461 +! Node: External Bugs449825 +! Node: Incompatibilities451957 +! Node: Fixed Headers460507 +! Node: Standard Libraries462849 +! Node: Disappointments464096 +! Node: C++ Misunderstandings468321 +! Node: Static Definitions468968 +! Node: Temporaries470022 +! Node: Protoize Caveats472226 +! Node: Non-bugs476182 +! Node: Warnings and Errors485142 +! Node: Bugs486912 +! Node: Bug Criteria488272 +! Node: Bug Lists490702 +! Node: Bug Reporting492095 +! Node: Sending Patches504513 +! Node: Service509900 +! Node: VMS510461 +! Node: Include Files and VMS510854 +! Node: Global Declarations514744 +! Node: VMS Misc519053 +! Node: Portability523379 +! Node: Interface525142 +! Node: Passes529775 +! Node: RTL547118 +! Node: RTL Objects549006 +! Node: Accessors552050 +! Node: Flags557376 +! Node: Machine Modes566395 +! Node: Constants574029 +! Node: Regs and Memory579217 +! Node: Arithmetic590927 +! Node: Comparisons596825 +! Node: Bit Fields600887 +! Node: Conversions602251 +! Node: RTL Declarations605139 +! Node: Side Effects605948 +! Node: Incdec618495 +! Node: Assembler621011 +! Node: Insns622533 +! Node: Calls643386 +! Node: Sharing645981 +! Node: Reading RTL649057 +! Node: Machine Desc649996 +! Node: Patterns651849 +! Node: Example654793 +! Node: RTL Template655921 +! Node: Output Template668119 +! Node: Output Statement672080 +! Node: Constraints675793 +! Node: Simple Constraints676796 +! Node: Multi-Alternative688229 +! Node: Class Preferences691065 +! Node: Modifiers691945 +! Node: Machine Constraints695105 +! Node: No Constraints703753 +! Node: Standard Names704874 +! Node: Pattern Ordering732782 +! Node: Dependent Patterns734008 +! Node: Jump Patterns736823 +! Node: Insn Canonicalizations742639 +! Node: Peephole Definitions746134 +! Node: Expander Definitions753052 +! Node: Insn Splitting760498 +! Node: Insn Attributes767512 +! Node: Defining Attributes768559 +! Node: Expressions770571 +! Node: Tagging Insns776883 +! Node: Attr Example781246 +! Node: Insn Lengths783622 +! Node: Constant Attributes786986 +! Node: Delay Slots788146 +! Node: Function Units791357 +! Node: Target Macros797027 +! Node: Driver798910 +! Node: Run-time Target810640 +! Node: Storage Layout816527 +! Node: Type Layout830475 +! Node: Registers836898 +! Node: Register Basics837878 +! Node: Allocation Order841915 +! Node: Values in Registers843333 +! Node: Leaf Functions847712 +! Node: Stack Registers850187 +! Node: Obsolete Register Macros851020 +! Node: Register Classes853715 +! Node: Stack and Calling873250 +! Node: Frame Layout873686 +! Node: Frame Registers877126 +! Node: Elimination880936 +! Node: Stack Arguments885192 +! Node: Register Arguments891810 +! Node: Scalar Return900485 +! Node: Aggregate Return904448 +! Node: Caller Saves908163 +! Node: Function Entry909313 +! Node: Profiling918241 +! Node: Varargs921145 +! Node: Trampolines928554 +! Node: Library Calls935016 +! Node: Addressing Modes943074 +! Node: Condition Code950662 +! Node: Costs956861 +! Node: Sections965240 +! Node: PIC970029 +! Node: Assembler Format972739 +! Node: File Framework973744 +! Node: Data Output977981 +! Node: Uninitialized Data983905 +! Node: Label Output986612 +! Node: Initialization996006 +! Node: Macros for Initialization1002149 +! Node: Instruction Output1006746 +! Node: Dispatch Tables1014741 +! Node: Alignment Output1017118 +! Node: Debugging Info1018858 +! Node: All Debuggers1019467 +! Node: DBX Options1021881 +! Node: DBX Hooks1026766 +! Node: File Names and DBX1030105 +! Node: SDB and DWARF1032078 +! Node: Cross-compilation1033808 +! Node: Misc1040255 +! Node: Config1057381 +! Node: Fragments1064826 +! Node: Target Fragment1065423 +! Node: Host Fragment1068461 +! Node: Index1069063 +  + End Tag Table +*** gcc-2.7.2/gcc.info-2 Wed Mar 6 10:23:35 1996 +--- g77-new/gcc.info-2 Fri Mar 15 02:17:16 1996 +*************** are in the following sections. +*** 92,95 **** +--- 92,96 ---- + -fschedule-insns2 -fstrength-reduce -fthread-jumps + -funroll-all-loops -funroll-loops ++ -fmove-all-movables -freduce-all-givs -frerun-loop-opt + -O -O0 -O1 -O2 -O3 + +*** gcc-2.7.2/gcc.info-3 Wed Mar 6 10:23:35 1996 +--- g77-new/gcc.info-3 Fri Mar 15 02:17:16 1996 +*************** of optimizations to be performed is desi +*** 907,910 **** +--- 907,946 ---- + `-frerun-cse-after-loop'. + ++ `-fmove-all-movables' ++ Forces all invariant computations in loops to be moved outside the ++ loop. This option is provided primarily to improve performance ++ for some Fortran code, though it might improve code written in ++ other languages. ++ ++ *Note:* When compiling programs written in Fortran, this option is ++ enabled by default. ++ ++ Analysis of Fortran code optimization and the resulting ++ optimizations triggered by this option, and the ++ `-freduce-all-givs' and `-frerun-loop-opt' options as well, were ++ contributed by Toon Moene (`toon@moene.indiv.nluug.nl'). ++ ++ Please let us (`fortran@gnu.ai.mit.edu') know how use of these ++ options affects the performance of your production code. We're ++ very interested in code that runs *slower* when these options are ++ *enabled*. ++ ++ `-freduce-all-givs' ++ Forces all general-induction variables in loops to be ++ strength-reduced. This option is provided primarily to improve ++ performance for some Fortran code, though it might improve code ++ written in other languages. ++ ++ *Note:* When compiling programs written in Fortran, this option is ++ enabled by default. ++ ++ `-frerun-loop-opt' ++ Runs loop optimizations a second time. This option is provided ++ primarily to improve performance for some Fortran code, though it ++ might improve code written in other languages. ++ ++ *Note:* When compiling programs written in Fortran, this option is ++ enabled by default. ++ + `-fno-peephole' + Disable any machine-specific peephole optimizations. +*** gcc-2.7.2/gcc.texi Wed Mar 6 10:20:58 1996 +--- g77-new/gcc.texi Wed Mar 6 14:30:40 1996 +*************** original English. +*** 149,152 **** +--- 149,153 ---- + @sp 3 + @center Last updated 26 November 1995 ++ @center (Revised for GNU Fortran 1996-03-06) + @sp 1 + @c The version number appears twice more in this file. +*** gcc-2.7.2/invoke.texi Tue Oct 3 11:40:43 1995 +--- g77-new/invoke.texi Fri Mar 15 01:49:11 1996 +*************** in the following sections. +*** 149,152 **** +--- 149,153 ---- + -fschedule-insns2 -fstrength-reduce -fthread-jumps + -funroll-all-loops -funroll-loops ++ -fmove-all-movables -freduce-all-givs -frerun-loop-opt + -O -O0 -O1 -O2 -O3 + @end smallexample +*************** Perform the optimization of loop unrolli +*** 1940,1943 **** +--- 1941,1985 ---- + and usually makes programs run more slowly. @samp{-funroll-all-loops} + implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}. ++ ++ @item -fmove-all-movables ++ Forces all invariant computations in loops to be moved ++ outside the loop. ++ This option is provided primarily to improve performance ++ for some Fortran code, though it might improve code written ++ in other languages. ++ ++ @emph{Note:} When compiling programs written in Fortran, ++ this option is enabled by default. ++ ++ Analysis of Fortran code optimization and the resulting ++ optimizations triggered by this option, and the ++ @samp{-freduce-all-givs} and @samp{-frerun-loop-opt} ++ options as well, were ++ contributed by Toon Moene (@code{toon@@moene.indiv.nluug.nl}). ++ ++ Please let us (@code{fortran@@gnu.ai.mit.edu}) ++ know how use of these options affects ++ the performance of your production code. ++ We're very interested in code that runs @emph{slower} ++ when these options are @emph{enabled}. ++ ++ @item -freduce-all-givs ++ Forces all general-induction variables in loops to be ++ strength-reduced. ++ This option is provided primarily to improve performance ++ for some Fortran code, though it might improve code written ++ in other languages. ++ ++ @emph{Note:} When compiling programs written in Fortran, ++ this option is enabled by default. ++ ++ @item -frerun-loop-opt ++ Runs loop optimizations a second time. ++ This option is provided primarily to improve performance ++ for some Fortran code, though it might improve code written ++ in other languages. ++ ++ @emph{Note:} When compiling programs written in Fortran, ++ this option is enabled by default. + + @item -fno-peephole +*** gcc-2.7.2/loop.c Tue Oct 3 12:17:16 1995 +--- g77-new/loop.c Wed Mar 6 10:32:58 1996 +*************** move_movables (movables, threshold, insn +*** 1629,1632 **** +--- 1629,1633 ---- + + if (already_moved[regno] ++ || flag_move_all_movables + || (threshold * savings * m->lifetime) >= insn_count + || (m->forces && m->forces->done +*************** strength_reduce (scan_start, end, loop_t +*** 3821,3826 **** + exit. */ + +! if (v->lifetime * threshold * benefit < insn_count +! && ! bl->reversed) + { + if (loop_dump_stream) +--- 3822,3827 ---- + exit. */ + +! if ( ! flag_reduce_all_givs && v->lifetime * threshold * benefit < insn_count +! && ! bl->reversed ) + { + if (loop_dump_stream) +*** gcc-2.7.2/toplev.c Fri Oct 20 17:56:35 1995 +--- g77-new/toplev.c Wed Mar 6 10:32:59 1996 +*************** int flag_unroll_loops; +*** 388,391 **** +--- 388,405 ---- + int flag_unroll_all_loops; + ++ /* Nonzero forces all invariant computations in loops to be moved ++ outside the loop. */ ++ ++ int flag_move_all_movables = 0; ++ ++ /* Nonzero forces all general induction variables in loops to be ++ strength reduced. */ ++ ++ int flag_reduce_all_givs = 0; ++ ++ /* Nonzero gets another run of loop_optimize performed. */ ++ ++ int flag_rerun_loop_opt = 0; ++ + /* Nonzero for -fwritable-strings: + store string constants in data segment and don't uniquize them. */ +*************** struct { char *string; int *variable; in +*** 542,545 **** +--- 556,562 ---- + {"unroll-loops", &flag_unroll_loops, 1}, + {"unroll-all-loops", &flag_unroll_all_loops, 1}, ++ {"move-all-movables", &flag_move_all_movables, 1}, ++ {"reduce-all-givs", &flag_reduce_all_givs, 1}, ++ {"rerun-loop-opt", &flag_rerun_loop_opt, 1}, + {"writable-strings", &flag_writable_strings, 1}, + {"peephole", &flag_no_peephole, 0}, +*************** rest_of_compilation (decl) +*** 2894,2897 **** +--- 2911,2916 ---- + { + loop_optimize (insns, loop_dump_file); ++ if (flag_rerun_loop_opt) ++ loop_optimize (insns, loop_dump_file); + }); + } +*** gcc-2.7.2/tree.c Sun Oct 1 21:26:56 1995 +--- g77-new/tree.c Wed Mar 6 10:33:00 1996 +*************** saveable_tree_cons (purpose, value, chai +*** 1965,1968 **** +--- 1965,1992 ---- + } + ++ /* Try to find out whether the type for which the size is to be determined ++ is an ARRAY(of ARRAY(of ARRAY ... of something with a constant size ++ which is an integral multiple of BITS_PER_UNIT)). ++ In that case, the size in bytes can be determined using an EXACT_DIV_EXPR. ++ */ ++ enum tree_code ++ which_div_expr(type) ++ tree type; ++ { ++ tree t; ++ ++ if (TREE_CODE (type) != POINTER_TYPE && TREE_CODE (type) != ARRAY_TYPE) ++ return CEIL_DIV_EXPR; ++ ++ for (t = TREE_TYPE (type); TREE_CODE (t) == ARRAY_TYPE; t = TREE_TYPE (t)) ++ ; ++ ++ if (TYPE_SIZE (t) != 0 && TREE_CODE (TYPE_SIZE (t)) == INTEGER_CST && ++ TREE_INT_CST_LOW (TYPE_SIZE (t)) % BITS_PER_UNIT == 0) ++ return EXACT_DIV_EXPR; ++ else ++ return CEIL_DIV_EXPR; ++ } ++ + /* Return the size nominally occupied by an object of type TYPE + when it resides in memory. The value is measured in units of bytes, +*************** size_in_bytes (type) +*** 1985,1989 **** + return integer_zero_node; + } +! t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), + size_int (BITS_PER_UNIT)); + if (TREE_CODE (t) == INTEGER_CST) +--- 2009,2013 ---- + return integer_zero_node; + } +! t = size_binop (which_div_expr (type), TYPE_SIZE (type), + size_int (BITS_PER_UNIT)); + if (TREE_CODE (t) == INTEGER_CST) +*************** int_size_in_bytes (type) +*** 2009,2013 **** + if (TREE_INT_CST_HIGH (TYPE_SIZE (type)) != 0) + { +! tree t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), + size_int (BITS_PER_UNIT)); + return TREE_INT_CST_LOW (t); +--- 2033,2037 ---- + if (TREE_INT_CST_HIGH (TYPE_SIZE (type)) != 0) + { +! tree t = size_binop (which_div_expr (type), TYPE_SIZE (type), + size_int (BITS_PER_UNIT)); + return TREE_INT_CST_LOW (t); +*** gcc-2.7.2/version.c Wed Mar 6 10:21:01 1996 +--- g77-new/version.c Mon Mar 25 21:17:27 1996 +*************** +*** 1 **** +! char *version_string = "2.7.2"; +--- 1 ---- +! char *version_string = "2.7.2.f.1"; diff --git a/gnu/usr.bin/gcc/f/gbe/README b/gnu/usr.bin/gcc/f/gbe/README index 90fc29f183e..1752b600aed 100644 --- a/gnu/usr.bin/gcc/f/gbe/README +++ b/gnu/usr.bin/gcc/f/gbe/README @@ -1,27 +1,28 @@ -970223 +961207 This directory contains .diff files for various GNU CC distributions supported by this version of GNU Fortran. The name of a file includes which gcc version to which it applies. -For example, 2.7.2.2.diff is the patch file for gcc version 2.7.2.2. +For example, 2.7.2.1.diff is the patch file for gcc version 2.7.2.1. -To apply a .diff file to, say, gcc 2.7.2.2, one might use the following +To apply a .diff file to, say, gcc 2.7.2, one might use the following command (where the current directory contains the gcc source distribution after merging into it the g77 source distribution, which would be -named gcc-2.7.2.2 in this example): +named gcc-2.7.2 in this example): - patch -p1 -d gcc-2.7.2.2 < gcc-2.7.2.2/f/gbe/2.7.2.2.diff + patch -p1 -d gcc-2.7.2 < gcc-2.7.2/f/gbe/2.7.2.diff -This version of g77 is best combined with gcc versions 2.7.2.2. +This version of g77 is best combined with gcc versions 2.7.2 or 2.7.2.1. -However, note that applying any of these patches does _not_ update -the gcc.info* files that constitute the Info documentation for gcc. -Therefore, after applying the patch, you must rebuild the Info -documentation yourself via: +However, note that applying the patch for version 2.7.2.1 +does _not_ update the gcc.info* files that constitute the Info +documentation for gcc. Therefore, after applying the 2.7.2.1.diff +patch to the gcc-2.7.2.1 source directory, you must rebuild the +Info documentation yourself via: - cd gcc; make -f Makefile.in gcc.info + cd gcc-2.7.2.1; make -f Makefile.in gcc.info If the above command doesn't work because you don't have makeinfo installed, you are STRONGLY encouraged to obtain the most recent @@ -29,8 +30,15 @@ version of the GNU texinfo package (texinfo-3.9.tar.gz as of this writing), build, and install it, then try the above command (as makeinfo is part of texinfo). +(The 2.7.2.1 patch omits the gcc.info* patches because your gcc-2.7.2.1 +might have one of at least two different versions of these gcc.info* +files, depending on how you obtained the gcc source directory -- by +unpacking gcc-2.7.2.1.tar.gz directly, or by applying a patch to upgrade +a copy of gcc-2.7.2.) + This distribution of g77 is not supported for versions of gcc prior -to 2.7.2.2. +to 2.6.2. The 2.6.3 patch file should work for version 2.6.2, but +you should probably use gcc-2.6.3 in any case if that is possible. If you are using a version of gcc more recent than the most recent .diff file's version, try the most recent .diff ONLY @@ -41,5 +49,5 @@ a more major release like gcc-2.8.0 or gcc-3.0.0, and you shouldn't try it. If the .diff file is missing, don't bother asking `fortran@gnu.ai.mit.edu' for it -- it is certainly being worked on. In the meantime, watch the usual place -(ftp://alpha.gnu.ai.mit.edu:g77.plan) for information on support -for the recent versions of gcc. +(`info -f g77') for information on support for the recent +versions of gcc. diff --git a/gnu/usr.bin/gcc/f/global.c b/gnu/usr.bin/gcc/f/global.c index 94d7c7b6d40..41b9e37c7ad 100644 --- a/gnu/usr.bin/gcc/f/global.c +++ b/gnu/usr.bin/gcc/f/global.c @@ -348,27 +348,6 @@ ffeglobal_pad_common (ffesymbol s, ffetargetAlign pad, ffewhereLine wl, } } -/* Return a global for a promoted symbol (one that has heretofore - been assumed to be local, but since discovered to be global). */ - -ffeglobal -ffeglobal_promoted (ffesymbol s) -{ -#if FFEGLOBAL_ENABLED - ffename n; - ffeglobal g; - - assert (ffesymbol_global (s) == NULL); - - n = ffename_find (ffeglobal_filewide_, ffename_token (ffesymbol_name (s))); - g = ffename_global (n); - - return g; -#else - return NULL; -#endif -} - /* ffeglobal_save_common -- Check SAVE status of common area ffesymbol s; // the common area diff --git a/gnu/usr.bin/gcc/f/global.h b/gnu/usr.bin/gcc/f/global.h index e28b944ffef..5e9a76124ac 100644 --- a/gnu/usr.bin/gcc/f/global.h +++ b/gnu/usr.bin/gcc/f/global.h @@ -93,7 +93,6 @@ void ffeglobal_new_progunit_ (ffesymbol s, ffelexToken t, ffeglobalType type); void ffeglobal_new_common (ffesymbol s, ffelexToken t, bool blank); void ffeglobal_pad_common (ffesymbol s, ffetargetAlign pad, ffewhereLine wl, ffewhereColumn wc); -ffeglobal ffeglobal_promoted (ffesymbol s); void ffeglobal_save_common (ffesymbol s, bool save, ffewhereLine wl, ffewhereColumn wc); bool ffeglobal_size_common (ffesymbol s, long size); diff --git a/gnu/usr.bin/gcc/f/install.texi b/gnu/usr.bin/gcc/f/install.texi index 04e498517e6..08ee8003ffc 100644 --- a/gnu/usr.bin/gcc/f/install.texi +++ b/gnu/usr.bin/gcc/f/install.texi @@ -1,11 +1,11 @@ -@c Copyright (C) 1995-1997 Free Software Foundation, Inc. +@c Copyright (C) 1995, 1996 Free Software Foundation, Inc. @c This is part of the G77 manual. @c For copying conditions, see the file g77.texi. @c The text of this file appears in the file INSTALL @c in the G77 distribution, as well as in the G77 manual. -@c 1997-02-25 +@c 1996-12-01 @ifclear INSTALLONLY @node Installation @@ -13,6 +13,15 @@ @end ifclear @cindex installing GNU Fortran +@menu +* Prerequisites:: Make sure your system is ready for @code{g77}. +* Problems Installing:: Known trouble areas. +* Quick Start:: The easier procedure for non-experts. +* Complete Installation:: For experts, or those who want to be: the details. +* Distributing Binaries:: If you plan on distributing your @code{g77}. +* Settings:: Some notes on @code{g77} internals. +@end menu + The following information describes how to install @code{g77}. The information in this file generally pertains to dealing @@ -27,15 +36,6 @@ Nevertheless, efforts to make @code{g77} easier to both build and install from source and package up as a binary distribution are ongoing. -@menu -* Prerequisites:: Make sure your system is ready for @code{g77}. -* Problems Installing:: Known trouble areas. -* Settings:: Changing @code{g77} internals before building. -* Quick Start:: The easier procedure for non-experts. -* Complete Installation:: For experts, or those who want to be: the details. -* Distributing Binaries:: If you plan on distributing your @code{g77}. -@end menu - @node Prerequisites @section Prerequisites @cindex prerequisites @@ -61,15 +61,15 @@ There are GNU versions of all these available---in fact, a complete GNU UNIX system can be put together on most systems, if desired. -@item @file{gcc-2.7.2.2.tar.gz} +@item @file{gcc-2.7.2.tar.gz} You need to have this, or some other applicable, version of @code{gcc} on your system. The version should be an exact copy of a distribution from the FSF. It is approximately 7MB large. -If you've already unpacked @file{gcc-2.7.2.2.tar.gz} into a -directory (named @file{gcc-2.7.2.2}) called the @dfn{source tree} +If you've already unpacked @file{gcc-2.7.2.tar.gz} into a +directory (named @file{gcc-2.7.2}) called the @dfn{source tree} for @code{gcc}, you can delete the distribution itself, but you'll need to remember to skip any instructions to unpack this distribution. @@ -78,7 +78,7 @@ Without an applicable @code{gcc} source tree, you cannot build @code{g77}. You can obtain an FSF distribution of @code{gcc} from the FSF. -@item @file{g77-0.5.20.tar.gz} +@item @file{g77-0.5.19.tar.gz} You probably have already unpacked this distribution, or you are reading an advanced copy of this manual, which is contained in this distribution. @@ -187,79 +187,15 @@ either @code{gcc} or @code{g77}. @node General Problems @subsection General Problems -These problems can occur on most or all systems. - -@menu -* GNU C Required:: Why even ANSI C is not enough. -* Patching GNU CC Necessary:: Why @code{gcc} must be patched first. -* Building GNU CC Necessary:: Why you can't build @emph{just} Fortran. -* Missing strtoul:: If linking @code{f771} fails due to an - unresolved reference to @code{strtoul}. -* Object File Differences:: It's okay that @samp{make compare} will - flag @file{f/zzz.o}. -* Cleanup Kills Stage Directories:: A minor nit for @code{g77} developers. -@end menu - -@node GNU C Required -@subsubsection GNU C Required -@cindex GNU C required -@cindex requirements, GNU C - -Compiling @code{g77} requires GNU C, not just ANSI C. -Fixing this wouldn't -be very hard (just tedious), but the code using GNU extensions to -the C language is expected to be rewritten for 0.6 anyway, -so there are no plans for an interim fix. - -This requirement does not mean you must already have @code{gcc} -installed to build @code{g77}. -As long as you have a working C compiler, you can use a -bootstrap build to automate the process of first building -@code{gcc} using the working C compiler you have, then building -@code{g77} and rebuilding @code{gcc} using that just-built @code{gcc}, -and so on. - -@node Patching GNU CC Necessary -@subsubsection Patching GNU CC Necessary -@cindex patch files -@cindex GBE - -@code{g77} currently requires application of a patch file to the gcc compiler -tree. -The necessary patches should be folded in to the mainline gcc distribution. - -Some combinations -of versions of @code{g77} and @code{gcc} might actually @emph{require} no -patches, but the patch files will be provided anyway as long as -there are more changes expected in subsequent releases. -These patch files might contain -unnecessary, but possibly helpful, patches. -As a result, it is possible this issue might never be -resolved, except by eliminating the need for the person -configuring @code{g77} to apply a patch by hand, by going -to a more automated approach (such as configure-time patching). - -@node Building GNU CC Necessary -@subsubsection Building GNU CC Necessary -@cindex gcc, building -@cindex building gcc - -It should be possible to build the runtime without building @code{cc1} -and other non-Fortran items, but, for now, an easy way to do that -is not yet established. - -@node Missing strtoul -@subsubsection Missing strtoul -@cindex strtoul +@itemize @bullet +@item @cindex _strtoul @cindex undefined reference (_strtoul) @cindex f771, linking error for @cindex linking error for f771 @cindex ld error for f771 @cindex ld can't find _strtoul -@cindex SunOS4 - -On SunOS4 systems, linking the @code{f771} program produces +On SunOS systems, linking the @code{f771} program produces an error message concerning an undefined symbol named @samp{_strtoul}. @@ -281,45 +217,60 @@ that appeared to have conforming ANSI C environments, and it was decided that, lacking resources to more fully investigate the problem, it was better to not punish users of those systems either by requiring them to work around the problem by hand or -by always substituting an incomplete @code{strtoul()} implementation +by always substituting an incomplete @samp{strtoul()} implementation when their systems had a complete, working one. Unfortunately, this meant inconveniencing users of systems not -having @code{strtoul()}, but they're using obsolete (and generally +having @samp{strtoul()}, but they're using obsolete (and generally unsupported) systems anyway. -@node Object File Differences -@subsubsection Object File Differences -@cindex zzz.o -@cindex zzz.c -@cindex object file, differences -@cindex differences between object files -@cindex make compare - -A comparison of object files after building Stage 3 during a -bootstrap build will result in @file{gcc/f/zzz.o} being flagged -as different from the Stage 2 version. -That is because it -contains a string with an expansion of the @code{__TIME__} macro, -which expands to the current time of day. -It is nothing to worry about, since -@file{gcc/f/zzz.c} doesn't contain any actual code. -It does allow you to override its use of @code{__DATE__} and -@code{__TIME__} by defining macros for the compilation---see the -source code for details. - -@node Cleanup Kills Stage Directories -@subsubsection Cleanup Kills Stage Directories -@cindex stage directories -@cindex make clean - +@item It'd be helpful if @code{g77}'s @file{Makefile.in} or @file{Make-lang.in} would create the various @file{stage@var{n}} directories and their -subdirectories, so developers and expert installers wouldn't have to -reconfigure after cleaning up. +subdirectories, so expert installers wouldn't have to reconfigure +after cleaning up. + +@item +Improvements to the way @code{libf2c} is built could make +building @code{g77} as a cross-compiler easier---for example, +passing and using @samp{LD} and @samp{AR} in the appropriate +ways. + +@cindex patch files +@cindex GBE +@item +@code{g77} currently requires application of a patch file to the gcc compiler +tree. +The necessary patches should be folded in to the mainline gcc distribution. + +Some combinations +of versions of @code{g77} and @code{gcc} might actually @emph{require} no +patches, but the patch files will be provided anyway as long as +there are more changes expected in subsequent releases. +These patch files might contain +unnecessary, but possibly helpful, patches. +As a result, it is possible this issue might never be +resolved, except by eliminating the need for the person +configuring @code{g77} to apply a patch by hand, by going +to a more automated approach (such as configure-time patching). + +@item +It should be possible to build the runtime without building @code{cc1} +and other non-Fortran items, but, for now, an easy way to do that +is not yet established. + +@cindex GNU C required +@cindex requirements, GNU C +@item +Compiling @code{g77} requires GNU C, not just ANSI C. +Fixing this wouldn't +be very hard (just tedious), but the code using GNU extensions to +the C language is expected to be rewritten for 0.6 anyway, +so there are no plans for an interim fix. +@end itemize @node Cross-compiler Problems @subsection Cross-compiler Problems -@cindex cross-compiler, problems +@cindex cross-compilation @code{g77} has been in alpha testing since September of 1992, and in public beta testing since February of 1995. @@ -360,12 +311,6 @@ for certain combinations of machines. For example, it might not know how to handle floating-point constants. -@item -Improvements to the way @code{libf2c} is built could make -building @code{g77} as a cross-compiler easier---for example, -passing and using @samp{LD} and @samp{AR} in the appropriate -ways. - @item There are still some challenges putting together the right run-time libraries (needed by @code{libf2c}) for a target @@ -374,235 +319,6 @@ system, depending on the systems involved in the configuration. @code{gcc} in particular.) @end itemize -@node Settings -@section Changing Settings Before Building - -Here are some internal @code{g77} settings that can be changed -by editing source files in @file{gcc/f/} before building. - -This information, and perhaps even these settings, represent -stop-gap solutions to problems people doing various ports -of @code{g77} have encountered. -As such, none of the following information is expected to -be pertinent in future versions of @code{g77}. - -@menu -* Larger File Unit Numbers:: Raising @samp{MXUNIT}. -* Always Flush Output:: Synchronizing write errors. -* Maximum Stackable Size:: Large arrays are forced off the stack frame. -* Floating-point Bit Patterns:: Possible programs building cross-compiler. -* Large Initialization:: Large arrays with @code{DATA} initialization. -* Alpha Problems Fixed:: Problems 64-bit systems like Alphas now fixed? -@end menu - -@node Larger File Unit Numbers -@subsection Larger File Unit Numbers -@cindex MXUNIT -@cindex unit numbers -@cindex maximum unit number -@cindex illegal unit number -@cindex increasing maximum unit number - -As distributed, whether as part of @code{f2c} or @code{g77}, -@code{libf2c} accepts file unit numbers only in the range -0 through 99. -For example, a statement such as @samp{WRITE (UNIT=100)} causes -a run-time crash in @code{libf2c}, because the unit number, -100, is out of range. - -If you know that Fortran programs at your installation require -the use of unit numbers higher than 99, you can change the -value of the @samp{MXUNIT} macro, which represents the maximum unit -number, to an appropriately higher value. - -To do this, edit the file @file{f/runtime/libI77/fio.h} in your -@code{g77} source tree, changing the following line: - -@example -#define MXUNIT 100 -@end example - -Change the line so that the value of @samp{MXUNIT} is defined to be -at least one @emph{greater} than the maximum unit number used by -the Fortran programs on your system. - -(For example, a program that does @samp{WRITE (UNIT=255)} would require -@samp{MXUNIT} set to at least 256 to avoid crashing.) - -Then build or rebuild @code{g77} as appropriate. - -@emph{Note:} Changing this macro has @emph{no} effect on other limits -your system might place on the number of files open at the same time. -That is, the macro might allow a program to do @samp{WRITE (UNIT=100)}, -but the library and operating system underlying @code{libf2c} might -disallow it if many other files have already been opened (via @code{OPEN} or -implicitly via @code{READ}, @code{WRITE}, and so on). -Information on how to increase these other limits should be found -in your system's documentation. - -@node Always Flush Output -@subsection Always Flush Output -@cindex ALWAYS_FLUSH -@cindex synchronous write errors -@cindex disk full -@cindex flushing output -@cindex fflush() -@cindex I/O, flushing -@cindex output, flushing -@cindex writes, flushing -@cindex NFS -@cindex network file system - -Some Fortran programs require output -(writes) to be flushed to the operating system (under UNIX, -via the @code{fflush()} library call) so that errors, -such as disk full, are immediately flagged via the relevant -@code{ERR=} and @code{IOSTAT=} mechanism, instead of such -errors being flagged later as subsequent writes occur, forcing -the previously written data to disk, or when the file is -closed. - -Essentially, the difference can be viewed as synchronous error -reporting (immediate flagging of errors during writes) versus -asynchronous, or, more precisely, buffered error reporting -(detection of errors might be delayed). - -@code{libf2c} supports flagging write errors immediately when -it is built with the @samp{ALWAYS_FLUSH} macro defined. -This results in a @code{libf2c} that runs slower, sometimes -quite a bit slower, under certain circumstances---for example, -accessing files via the networked file system NFS---but the -effect can be more reliable, robust file I/O. - -If you know that Fortran programs requiring this level of precision -of error reporting are to be compiled using the -version of @code{g77} you are building, you might wish to -modify the @code{g77} source tree so that the version of -@code{libf2c} is built with the @samp{ALWAYS_FLUSH} macro -defined, enabling this behavior. - -To do this, find this line in @file{f/runtime/configure.in} in -your @code{g77} source tree: - -@example -dnl AC_DEFINE(ALWAYS_FLUSH) -@end example - -Remove the leading @samp{dnl@w{ }}, so the line begins with -@samp{AC_DEFINE(}, and run @code{autoconf} in that file's directory. -(Or, if you don't have @code{autoconf}, you can modify @file{f2c.h.in} -in the same directory to include the line @samp{#define ALWAYS_FLUSH} -after @samp{#define F2C_INCLUDE}.) - -Then build or rebuild @code{g77} as appropriate. - -@node Maximum Stackable Size -@subsection Maximum Stackable Size -@vindex FFECOM_sizeMAXSTACKITEM -@cindex code, stack variables -@cindex maximum stackable size -@cindex stack allocation -@cindex segmentation violation -@code{g77}, on most machines, puts many variables and arrays on the stack -where possible, and can be configured (by changing -@samp{FFECOM_sizeMAXSTACKITEM} in @file{gcc/f/com.c}) to force -smaller-sized entities into static storage (saving -on stack space) or permit larger-sized entities to be put on the -stack (which can improve run-time performance, as it presents -more opportunities for the GBE to optimize the generated code). - -@emph{Note:} Putting more variables and arrays on the stack -might cause problems due to system-dependent limits on stack size. -Also, the value of @samp{FFECOM_sizeMAXSTACKITEM} has no -effect on automatic variables and arrays. -@xref{But-bugs}, for more information. - -@node Floating-point Bit Patterns -@subsection Floating-point Bit Patterns - -@cindex cross-compiler, building -@cindex floating-point bit patterns -@cindex bit patterns -The @code{g77} build will crash if an attempt is made to build -it as a cross-compiler -for a target when @code{g77} cannot reliably determine the bit pattern of -floating-point constants for the target. -Planned improvements for g77-0.6 -will give it the capabilities it needs to not have to crash the build -but rather generate correct code for the target. -(Currently, @code{g77} -would generate bad code under such circumstances if it didn't crash -during the build, e.g. when compiling a source file that does -something like @samp{EQUIVALENCE (I,R)} and @samp{DATA R/9.43578/}.) - -@node Large Initialization -@subsection Initialization of Large Aggregate Areas - -@cindex speed, compiler -@cindex slow compiler -@cindex memory utilization -@cindex large initialization -@cindex aggregate initialization -A warning message is issued when @code{g77} sees code that provides -initial values (e.g. via @code{DATA}) to an aggregate area (@code{COMMON} -or @code{EQUIVALENCE}, or even a large enough array or @code{CHARACTER} -variable) -that is large enough to increase @code{g77}'s compile time by roughly -a factor of 10. - -This size currently is quite small, since @code{g77} -currently has a known bug requiring too much memory -and time to handle such cases. -In @file{gcc/f/data.c}, the macro -@samp{FFEDATA_sizeTOO_BIG_INIT_} is defined -to the minimum size for the warning to appear. -The size is specified in storage units, -which can be bytes, words, or whatever, on a case-by-case basis. - -After changing this macro definition, you must -(of course) rebuild and reinstall @code{g77} for -the change to take effect. - -Note that, as of version 0.5.18, improvements have -reduced the scope of the problem for @emph{sparse} -initialization of large arrays, especially those -with large, contiguous uninitialized areas. -However, the warning is issued at a point prior to -when @code{g77} knows whether the initialization is sparse, -and delaying the warning could mean it is produced -too late to be helpful. - -Therefore, the macro definition should not be adjusted to -reflect sparse cases. -Instead, adjust it to generate the warning when densely -initialized arrays begin to cause responses noticeably slower -than linear performance would suggest. - -@node Alpha Problems Fixed -@subsection Alpha Problems Fixed - -@cindex Alpha, support -@cindex 64-bit systems -@code{g77} used to warn when it was used to compile Fortran code -for a target configuration that is not basically a 32-bit -machine (such as an Alpha, which is a 64-bit machine, especially -if it has a 64-bit operating system running on it). -That was because @code{g77} was known to not work -properly on such configurations. - -As of version 0.5.20, @code{g77} is believed to work well -enough on such systems. -So, the warning is no longer needed or provided. - -However, support for 64-bit systems, especially in -areas such as cross-compilation and handling of -intrinsics, is still incomplete. -The symptoms -are believed to be compile-time diagnostics rather -than the generation of bad code. -It is hoped that version 0.6 will completely support 64-bit -systems. - @node Quick Start @section Quick Start @cindex quick start @@ -629,18 +345,10 @@ already reside in @file{/usr/FSF}, a naming convention used by the author of @code{g77} on his own system: @example -/usr/FSF/gcc-2.7.2.2.tar.gz -/usr/FSF/g77-0.5.20.tar.gz +/usr/FSF/gcc-2.7.2.tar.gz +/usr/FSF/g77-0.5.19.tar.gz @end example -@c (You can use @file{gcc-2.7.2.1.tar.gz} instead, or -@c the equivalent of it obtained by applying the -@c patch distributed as @file{gcc-2.7.2-2.7.2.1.diff.gz} -@c to version 2.7.2 of @code{gcc}, -@c if you remember to make the appropriate adjustments in the -@c instructions below.) - -@cindex SunOS4 Users of the following systems should not blindly follow these quick-start instructions, because of problems their systems have coping with straightforward installation of @@ -648,7 +356,9 @@ systems have coping with straightforward installation of @itemize @bullet @item -SunOS4 +SunOS +@item +Alpha @end itemize Instead, see @ref{Complete Installation}, for detailed information @@ -671,49 +381,49 @@ These explanations follow this list of steps. @example sh[ 1]# @kbd{cd /usr/src} @set source-dir 1 -sh[ 2]# @kbd{gunzip -c < /usr/FSF/gcc-2.7.2.2.tar.gz | tar xf -} -[Might say "Broken pipe"...that is normal on some systems.] +sh[ 2]# @kbd{gunzip -c < /usr/FSF/gcc-2.7.2.tar.gz | tar xf -} @set unpack-gcc 2 -sh[ 3]# @kbd{gunzip -c < /usr/FSF/g77-0.5.20.tar.gz | tar xf -} -["Broken pipe" again possible.] +[Might say "Broken pipe"...that is normal on some systems.] +sh[ 3]# @kbd{gunzip -c < /usr/FSF/g77-0.5.19.tar.gz | tar xf -} @set unpack-g77 3 -sh[ 4]# @kbd{ln -s gcc-2.7.2.2 gcc} +["Broken pipe" again possible.] +sh[ 4]# @kbd{ln -s gcc-2.7.2 gcc} @set link-gcc 4 -sh[ 5]# @kbd{ln -s g77-0.5.20 g77} +sh[ 5]# @kbd{ln -s g77-0.5.19 g77} @set link-g77 5 sh[ 6]# @kbd{mv -i g77/* gcc} -[No questions should be asked by mv here; or, you made a mistake.] @set merge-g77 6 -sh[ 7]# @kbd{patch -p1 -V t -d gcc < gcc/f/gbe/2.7.2.2.diff} -[Unless patch complains about rejected patches, this step worked.] +[No questions should be asked by mv here; or, you made a mistake.] +sh[ 7]# @kbd{patch -p1 -V t -d gcc-2.7.2 < gcc-2.7.2/f/gbe/2.7.2.diff} @set apply-patch 7 +[Unless patch complains about rejected patches, this step worked.] sh[ 8]# @kbd{cd gcc} sh[ 9]# @kbd{touch f77-install-ok} +@set f77-install-ok 9 [Do not do the above if your system already has an f77 command, unless you've checked that overwriting it is okay.] -@set f77-install-ok 9 sh[10]# @kbd{touch f2c-install-ok} +@set f2c-install-ok 10 [Do not do the above if your system already has an f2c command, unless you've checked that overwriting it is okay. Else, @kbd{touch f2c-exists-ok}.] -@set f2c-install-ok 10 sh[11]# @kbd{./configure --prefix=/usr} +@set configure-gcc 11 [Do not do the above if gcc is not installed in /usr/bin. You might need a different @kbd{--prefix=@dots{}}, as described below.] -@set configure-gcc 11 sh[12]# @kbd{make bootstrap} -[This takes a long time, and is where most problems occur.] @set build-gcc 12 +[This takes a long time, and is where most problems occur.] sh[13]# @kbd{rm -fr stage1} @set rm-stage1 13 sh[14]# @kbd{make -k install} -[The actual installation.] @set install-g77 14 +[The actual installation.] sh[15]# @kbd{g77 -v} -[Verify that g77 is installed, obtain version info.] @set show-version 15 +[Verify that g77 is installed, obtain version info.] sh[16]# @set end-procedure 16 @end example @@ -733,37 +443,26 @@ By convention, this manual assumes @file{/usr/src}. It might be helpful if other users on your system knew where to look for the source code for the installed version of @code{g77} and @code{gcc} in any case. - +@c @c @item Step @value{unpack-gcc}: @kbd{gunzip -d @dots{}} -@c Here, you might wish to use @file{gcc-2.7.2.1.tar.gz} -@c instead, or apply @file{gcc-2.7.2-2.7.2.1.diff.gz} to achieve -@c similar results. - -@item Step @value{unpack-g77}: @kbd{gunzip -d < /usr/FSF/g77-0.5.20.tar.gz | tar xf -} -It is not always necessary to obtain the latest version of -@code{g77} as a complete @file{.tar.gz} file if you have -a complete, earlier distribution of @code{g77}. -If appropriate, you can unpack that earlier -version of @code{g77}, and then apply the appropriate patches -to achieve the same result---a source tree containing version -0.5.20 of @code{g77}. - -@item Step @value{link-gcc}: @kbd{ln -s gcc-2.7.2.2 gcc} -@item Step @value{link-g77}: @kbd{ln -s g77-0.5.20 g77} +@c Some systems have a version of @code{tar} that support +@c uncompressing @code{gzip} files. +@c +@c @item Step @value{unpack-g77}: @kbd{gunzip -d < /usr/FSF/g77-0.5.19.tar.gz | tar xf -} + +@item Step @value{link-gcc}: @kbd{ln -s gcc-2.7.2 gcc} +@item Step @value{link-g77}: @kbd{ln -s g77-0.5.19 g77} These commands mainly help reduce typing, and help reduce visual clutter in examples in this manual showing what to type to install @code{g77}. -@c Of course, if appropriate, @kbd{ln -s gcc-2.7.2.1 gcc} or -@c similar. - @xref{Unpacking}, for information on using distributions of @code{g77} made by organizations other than the FSF. @item Step @value{merge-g77}: @kbd{mv -i g77/* gcc} After doing this, you can, if you like, type -@samp{rm g77} and @samp{rmdir g77-0.5.20} to remove +@samp{rm g77} and @samp{rmdir g77-0.5.19} to remove the empty directory and the symbol link to it. But, it might be helpful to leave them around as quick reminders of which version(s) of @code{g77} are @@ -774,8 +473,6 @@ on the contents of the @file{g77} directory (as merged into the @file{gcc} directory). @item Step @value{apply-patch}: @kbd{patch -p1 @dots{}} -@c (Or `@kbd{@dots{} < gcc/f/gbe/2.7.2.1.diff}', if appropriate.) -@c This can produce a wide variety of printed output, from @samp{Hmm, I can't seem to find a patch in there anywhere...} to long lists of messages indicated that patches are @@ -827,7 +524,7 @@ Otherwise, installing @code{g77} so that it does not fully replace the existing installation of @code{gcc} is likely to result in the inability to compile Fortran programs. -@xref{Where to Install,,Where in the World Does Fortran (and GNU CC) Go?}, +@xref{Where to Install,,Where in the World Does Fortran (and GNU C) Go?}, for more information on determining where to install @code{g77}. @xref{Configuring gcc}, for more information on the configuration process triggered by invoking the @file{./configure} @@ -857,53 +554,8 @@ make -k install install-libf77 install-f2c-all @xref{Updating Documentation,,Updating Your Info Directory}, for information on entering this manual into your system's list of texinfo manuals. - -@item Step @value{show-version}: @kbd{g77 -v} -If this command prints approximately 25 lines of output, -including the GNU Fortran Front End version number (which -should be the same as the version number for the version -of @code{g77} you just built and installed) and the -version numbers for the three parts of the @code{libf2c} -library (@code{libF77}, @code{libI77}, @code{libU77}), and -those version numbers are all in agreement, then there is -a high likelihood that the installation has been successfully -completed. - -You might consider doing further testing. -For example, log in as a non-privileged user, then create -a small Fortran program, such as: - -@example - PROGRAM SMTEST - DO 10 I=1, 10 - PRINT *, 'Hello World #', I -10 CONTINUE - END -@end example - -Compile, link, and run the above program, and, assuming you named -the source file @file{smtest.f}, the session should look like this: - -@example -sh# @kbd{g77 -o smtest smtest.f} -sh# @kbd{./smtest} - Hello World # 1 - Hello World # 2 - Hello World # 3 - Hello World # 4 - Hello World # 5 - Hello World # 6 - Hello World # 7 - Hello World # 8 - Hello World # 9 - Hello World # 10 -sh# -@end example - -After proper installation, you don't -need to keep your gcc and g77 source and build directories -around anymore. -Removing them can free up a lot of disk space. +@c +@c @item Step @value{show-version}: @kbd{g77 -v} @end table @node Complete Installation @@ -962,10 +614,10 @@ and @code{g77} is: @example sh# @kbd{cd /usr/src} -sh# @kbd{gunzip -d < /usr/FSF/gcc-2.7.2.2.tar.gz | tar xf -} -sh# @kbd{gunzip -d < /usr/FSF/g77-0.5.20.tar.gz | tar xf -} -sh# @kbd{ln -s gcc-2.7.2.2 gcc} -sh# @kbd{ln -s g77-0.5.20 g77} +sh# @kbd{gunzip -d < /usr/FSF/gcc-2.7.2.tar.gz | tar xf -} +sh# @kbd{gunzip -d < /usr/FSF/g77-0.5.19.tar.gz | tar xf -} +sh# @kbd{ln -s gcc-2.7.2 gcc} +sh# @kbd{ln -s g77-0.5.19 g77} sh# @kbd{mv -i g77/* gcc} @end example @@ -990,7 +642,7 @@ g77/f All three entries should be moved (or copied) into a @code{gcc} source tree (typically named after its version number and -as it appears in the FSF distributions---e.g. @file{gcc-2.7.2.2}). +as it appears in the FSF distributions---e.g. @file{gcc-2.7.2}). @file{g77/f} is the subdirectory containing all of the code, documentation, and other information that is specific @@ -1057,7 +709,7 @@ The format is, generally, @var{major}.@var{minor}.@var{patch}, with each field being a decimal number. (You can safely ignore -leading zeros; for example, 1.5.3 is the same as 1.5.03.)@ +leading zeros; for example, 1.5.3 is the same as 1.5.03.) The @var{major} field only increases with time. The other two fields are reset to 0 when the field to their left is incremented; otherwise, they, too, only @@ -1190,7 +842,7 @@ When you enable installation of @code{f77}, either a link to or a direct copy of the @code{g77} command is made. Similarly, @file{f77.1} is installed as a man page. -(The @code{uninstall} target in the @file{gcc/Makefile} also tests +(The @samp{uninstall} target in the @file{gcc/Makefile} also tests this macro and file, when invoked, to determine whether to delete the installed copies of @code{f77} and @file{f77.1}.) @@ -1275,7 +927,7 @@ or edit @file{gcc/f/Make-lang.in} and change the definition of the @node Patching GNU Fortran @subsection Patching GNU Fortran -If you're using a SunOS4 system, you'll need to make the following +If you're using a SunOS system, you'll need to make the following change to @file{gcc/f/proj.h}: edit the line reading @example @@ -1286,21 +938,21 @@ change to @file{gcc/f/proj.h}: edit the line reading by replacing the @samp{1} with @samp{0}. Or, you can avoid editing the source by adding @example -CFLAGS='-DFFEPROJ_STRTOUL=0 -g -O' +CFLAGS='-DFFEPROJ_STRTOUL=0 -g' @end example to the command line for @code{make} when you invoke it. (@samp{-g} is the default for @samp{CFLAGS}.) -This causes a minimal version of @code{strtoul()} provided +This causes a minimal version of @samp{strtoul()} provided as part of the @code{g77} distribution to be compiled and linked into whatever @code{g77} programs need it, since -some systems (like SunOS4 with only the bundled compiler and its -runtime) do not provide this function in their system libraries. +some systems (like SunOS) do not provide this function +in their system libraries. -Similarly, a minimal version of @code{bsearch()} is available +Similarly, a minimal version of @samp{bsearch()} is available and can be enabled by editing a line similar to the one -for @code{strtoul()} above in @file{gcc/f/proj.h}, if -your system libraries lack @code{bsearch()}. +for @samp{strtoul()} above in @file{gcc/f/proj.h}, if +your system libraries lack @samp{bsearch()}. The method of overriding @samp{X_CFLAGS} may also be used. These are not problems with @code{g77}, which requires an @@ -1311,11 +963,11 @@ of @code{gcc} to provide one to all @code{gcc}-based compilers in future @code{gcc} distributions. @xref{Problems Installing}, for more information on -why @code{strtoul()} comes up missing and on approaches +why @samp{strtoul()} comes up missing and on approaches to dealing with this problem that have already been tried. @node Where to Install -@subsection Where in the World Does Fortran (and GNU CC) Go? +@subsection Where in the World Does Fortran (and GNU C) Go? Before configuring, you should make sure you know where you want the @code{g77} and @code{gcc} @@ -1335,7 +987,7 @@ version of @code{gcc} on the system. Sometimes people make the mistake of installing @code{gcc} as @file{/usr/local/bin/gcc}, leaving an older, non-Fortran-aware version in @file{/usr/bin/gcc}. -(Or, the opposite happens.)@ +(Or, the opposite happens.) This can result in @code{g77} being unable to compile Fortran source files, because when it calls on @code{gcc} to do the actual compilation, @code{gcc} complains that it does not @@ -1427,9 +1079,9 @@ has been configured. If it does not, there is a problem. @emph{Note:} Configuring with the @samp{--srcdir} argument is known -to work with GNU @code{make}, but it is not known to work with -other variants of @code{make}. -Irix5.2 and SunOS4.1 versions of @code{make} definitely +to work with GNU @samp{make}, but it is not known to work with +other variants of @samp{make}. +Irix5.2 and SunOS4.1 versions of @samp{make} definitely won't work outside the source directory at present. @code{g77}'s portion of the @file{configure} script issues a warning message @@ -1528,14 +1180,21 @@ To save some disk space during installation, after Stage 2 is built, you can type @samp{rm -fr stage1} to remove the binaries built during Stage 1. -@emph{Note:} @xref{Object File Differences}, for information on -expected differences in object files produced during Stage 2 and -Stage 3 of a bootstrap build. -These differences will be encountered as a result of using -the @samp{make compare} or similar command sequence recommended -by the GNU CC installation documentation. +@pindex zzz.o +@pindex zzz.c +@emph{Note:} If you do build Stage 3 +and you compare the object files produced by various stages, +the file @file{gcc/f/zzz.o} @strong{will} be different. +That is because it +contains a string with an expansion of the @samp{__TIME__} macro, +which expands to the current time of day. +It is nothing to worry about, since +@file{gcc/f/zzz.c} doesn't contain any actual code. +It does allow you to override its use of @samp{__DATE__} and +@samp{__TIME__} by defining macros for the compilation---see the +source code for details. -Also, @xref{Installation,,Installing GNU CC,gcc,Using and Porting GNU CC}, +@xref{Installation,,Installing GNU CC,gcc,Using and Porting GNU CC}, for important information on building @code{gcc} that is not described in this @code{g77} manual. For example, explanations of diagnostic messages @@ -1606,51 +1265,43 @@ printed by them when they work: @example sh# @kbd{cd /usr/src/gcc} sh# @kbd{./g77 --driver=./xgcc -B./ -v} -g77 version 0.5.20 - ./xgcc -B./ -v -fnull-version -o /tmp/gfa18047 @dots{} + ./xgcc -B./ -v -fnull-version -o /tmp/gfa03648 @dots{} Reading specs from ./specs -gcc version 2.7.2.2.f.2 +gcc version 2.7.1 ./cpp -lang-c -v -isystem ./include -undef @dots{} -GNU CPP version 2.7.2.2.f.2 (Linux/Alpha) +GNU CPP version 2.7.1 (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: ./include - /usr/local/include - /usr/alpha-unknown-linux/include - /usr/lib/gcc-lib/alpha-unknown-linux/2.7.2.2.f.2/include + /usr/include + /usr/i486-unknown-linuxaout/include + /usr/lib/gcc-lib/i486-unknown-linuxaout/2.7.1/include /usr/include End of search list. - ./f771 /tmp/cca18048.i -fset-g77-defaults -quiet -dumpbase @dots{} -GNU F77 version 2.7.2.2.f.2 (Linux/Alpha) compiled @dots{} -GNU Fortran Front End version 0.5.20-970224 compiled: @dots{} - as -nocpp -o /tmp/cca180481.o /tmp/cca18048.s - ld -G 8 -O1 -o /tmp/gfa18047 /usr/lib/crt0.o -L. @dots{} -__G77_LIBF77_VERSION__: 0.5.20 -@@(#)LIBF77 VERSION 19960619 -__G77_LIBI77_VERSION__: 0.5.20 -@@(#) LIBI77 VERSION pjw,dmg-mods 19961209 -__G77_LIBU77_VERSION__: 0.5.20 -@@(#) LIBU77 VERSION 19970204 + ./f771 /tmp/cca03648.i -quiet -dumpbase null.F -version @dots{} +GNU F77 version 2.7.1 (80386, BSD syntax) compiled @dots{} +GNU Fortran Front End version 0.5.19 compiled: @dots{} + as -o /tmp/cca036481.o /tmp/cca03648.s + ld -m i386linux -o /tmp/gfa03648 /usr/lib/crt0.o -L. @dots{} +/usr/lib/crt0.o(.text+0x35): undefined reference to `main' sh# @kbd{./xgcc -B./ -v -o /tmp/delete-me -xc /dev/null -xnone} Reading specs from ./specs -gcc version 2.7.2.2.f.2 +gcc version 2.7.1 ./cpp -lang-c -v -isystem ./include -undef @dots{} -GNU CPP version 2.7.2.2.f.2 (Linux/Alpha) +GNU CPP version 2.7.1 (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: ./include - /usr/local/include - /usr/alpha-unknown-linux/include - /usr/lib/gcc-lib/alpha-unknown-linux/2.7.2.2.f.2/include + /usr/include + /usr/i486-unknown-linuxaout/include + /usr/lib/gcc-lib/i486-unknown-linuxaout/2.7.1/include /usr/include End of search list. - ./cc1 /tmp/cca18063.i -quiet -dumpbase null.c -version @dots{} -GNU C version 2.7.2.2.f.2 (Linux/Alpha) compiled @dots{} - as -nocpp -o /tmp/cca180631.o /tmp/cca18063.s - ld -G 8 -O1 -o /tmp/delete-me /usr/lib/crt0.o -L. @dots{} -/usr/lib/crt0.o: In function `__start': -crt0.S:110: undefined reference to `main' -/usr/lib/crt0.o(.lita+0x28): undefined reference to `main' + ./cc1 /tmp/cca03659.i -quiet -dumpbase null.c -version @dots{} +GNU C version 2.7.1 (80386, BSD syntax) compiled @dots{} + as -o /tmp/cca036591.o /tmp/cca03659.s + ld -m i386linux -o /tmp/delete-me /usr/lib/crt0.o -L. @dots{} +/usr/lib/crt0.o(.text+0x35): undefined reference to `main' sh# @end example @@ -1660,10 +1311,11 @@ used to indicate such truncations.) The above two commands test whether @code{g77} and @code{gcc}, respectively, are able to compile empty (null) source files, whether invocation of the C preprocessor works, whether libraries -can be linked, and so on. +can be linked (even though there is an undefined reference due +to there being no main program unit), and so on. If the output you get from either of the above two commands -is noticeably different, especially if it is shorter or longer +is noticably different, especially if it is shorter or longer in ways that do not look consistent with the above sample output, you probably should not install @code{gcc} and @code{g77} until you have investigated further. @@ -1729,7 +1381,7 @@ require this alternate command, but they do. Note that using the @samp{-k} option tells @code{make} to continue after some installation problems, like not having @code{makeinfo} installed on your system. -It might not be necessary for your system. +It might not be necessary. @node Updating Documentation @subsection Updating Your Info Directory @@ -1753,25 +1405,17 @@ file in the @code{info} directory on your system (perhaps @end example If the menu in @file{dir} is organized into sections, @code{g77} -probably belongs in a section with a name such as one of -the following: +probably belongs in a section with a name such as the following: @itemize @bullet -@item -Fortran Programming - @item Writing Programs - @item Programming Languages - @item Languages Other Than C - @item Scientific/Engineering Tools - @item GNU Compilers @end itemize @@ -1899,9 +1543,6 @@ not get overwritten. @item info/g77.info* This is the documentation for @code{g77}. -If it is not included, users will have trouble understanding -diagnostics messages and other such things, and will send -you a lot of email asking questions. Please edit this documentation (by editing @file{gcc/f/*.texi} and doing @samp{make doc} from the @file{/usr/src/gcc} directory) @@ -1919,8 +1560,6 @@ easily. @item man/man1/g77.1 This is the short man page for @code{g77}. -It is out of date, but you might as well include it -for people who really like man pages. @item man/man1/f77.1 In installations where @code{f77} is the same as @code{g77}, @@ -1965,9 +1604,129 @@ until you're sure your distribution is widely used and has been well tested. This especially goes for those of you making any changes to the @code{g77} sources to port @code{g77}, e.g. to OS/2. -@email{fortran@@gnu.ai.mit.edu} has received a fair number of bug +@samp{fortran@@gnu.ai.mit.edu} has received a fair amount of bug reports that turned out to be problems with other peoples' ports and distributions, about which nothing could be done for the user. Once you are quite certain a bug report does not involve your efforts, you can forward it to us. + +@node Settings +@section Changing Settings Before Building + +Here are some internal @code{g77} settings that can be changed +by editing source files in @file{gcc/f/} before building. + +This information, and perhaps even these settings, represent +stop-gap solutions to problems people doing various ports +of @code{g77} have encountered. +As such, none of the following information is expected to +be pertinent in future versions of @code{g77}. + +@menu +* Maximum Stackable Size:: Large arrays are forced off the stack frame. +* Floating-point Bit Patterns:: Possible programs building cross-compiler. +* Large Initialization:: Large arrays with @samp{DATA} initialization. +* Alpha Problems:: Problems with 64-bit systems like Alphas. +@end menu + +@node Maximum Stackable Size +@subsection Maximum Stackable Size + +@vindex FFECOM_sizeMAXSTACKITEM +@cindex code, stack variables +@cindex maximum stackable size +@cindex stack allocation +@cindex segmentation violation +@code{g77}, on most machines, puts many variables and arrays on the stack +where possible, and can be configured (by changing +@samp{FFECOM_sizeMAXSTACKITEM} in @file{gcc/f/com.c}) to force +smaller-sized entities into static storage (saving +on stack space) or permit larger-sized entities to be put on the +stack (which can improve run-time performance, as it presents +more opportunities for the GBE to optimize the generated code). + +@emph{Note:} Putting more variables and arrays on the stack +might cause problems due to system-dependent limits on stack size. +Also, the value of @samp{FFECOM_sizeMAXSTACKITEM} has no +effect on automatic variables and arrays. +@xref{But-bugs}, for more information. + +@node Floating-point Bit Patterns +@subsection Floating-point Bit Patterns + +@cindex cross-compiler, building +@cindex floating-point bit patterns +@cindex bit patterns +The @code{g77} build will crash if an attempt is made to build +it as a cross-compiler +for a target when @code{g77} cannot reliably determine the bit pattern of +floating-point constants for the target. +Planned improvements for g77-0.6 +will give it the capabilities it needs to not have to crash the build +but rather generate correct code for the target. +(Currently, @code{g77} +would generate bad code under such circumstances if it didn't crash +during the build, e.g. when compiling a source file that does +something like @samp{EQUIVALENCE (I,R)} and @samp{DATA R/9.43578/}.) + +@node Large Initialization +@subsection Initialization of Large Aggregate Areas + +@cindex speed, compiler +@cindex slow compiler +@cindex memory utilization +@cindex large initialization +@cindex aggregate initialization +A warning message is issued when @code{g77} sees code that provides +initial values (e.g. via @samp{DATA}) to an aggregate area (@samp{COMMON} +or @samp{EQUIVALENCE}, or even a large enough array or @samp{CHARACTER} +variable) +that is large enough to increase @code{g77}'s compile time by roughly +a factor of 10. + +This size currently is quite small, since @code{g77} +currently has a known bug requiring too much memory +and time to handle such cases. +In @file{gcc/f/data.c}, the macro +@samp{FFEDATA_sizeTOO_BIG_INIT_} is defined +to the minimum size for the warning to appear. +The size is specified in storage units, +which can be bytes, words, or whatever, on a case-by-case basis. + +After changing this macro definition, you must +(of course) rebuild and reinstall @code{g77} for +the change to take effect. + +Note that, as of version 0.5.18, improvements have +reduced the scope of the problem for @emph{sparse} +initialization of large arrays, especially those +with large, contiguous uninitialized areas. +However, the warning is issued at a point prior to +when @code{g77} knows whether the initialization is sparse, +and delaying the warning could mean it is produced +too late to be helpful. + +Therefore, the macro definition should not be adjusted to +reflect sparse cases. +Instead, adjust it to generate the warning when densely +initialized arrays begin to cause responses noticably slower +than linear performance would suggest. + +@node Alpha Problems +@subsection Alpha Problems + +@cindex Alpha, bugs +@cindex 64-bit systems +@code{g77} might warn when it is used to compile Fortran code +for a target configuration that is not basically a 32-bit +machine (such as an Alpha, which is a 64-bit machine, especially +if it has a 64-bit operating system running on it). +This is because @code{g77} is known to not work +properly on such configurations. +This is expected to be completely fixed +at 0.6, at which point the warning would be dropped. + +(Version 0.5.20 is expected to solve most of these +problems, though, as of this writing, work is still +progressing in this area.) diff --git a/gnu/usr.bin/gcc/f/intrin.c b/gnu/usr.bin/gcc/f/intrin.c index 9b91acf87a2..231e795ec77 100644 --- a/gnu/usr.bin/gcc/f/intrin.c +++ b/gnu/usr.bin/gcc/f/intrin.c @@ -1,5 +1,5 @@ /* intrin.c -- Recognize references to intrinsics - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -69,7 +69,6 @@ static ffebad ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, ffebld args, ffeinfoBasictype *xbt, ffeinfoKindtype *xkt, ffetargetCharacterSize *xsz, - bool *check_intrin, ffelexToken t, bool commit); static bool ffeintrin_check_any_ (ffebld arglist); @@ -158,7 +157,6 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, ffebld args, ffeinfoBasictype *xbt, ffeinfoKindtype *xkt, ffetargetCharacterSize *xsz, - bool *check_intrin, ffelexToken t, bool commit) { @@ -173,8 +171,6 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, bool need_col; ffeinfoBasictype col_bt = FFEINFO_basictypeNONE; ffeinfoKindtype col_kt = FFEINFO_kindtypeNONE; - int colon = (c[2] == ':') ? 2 : 3; - int argno; /* Check procedure type (function vs. subroutine) against invocation. */ @@ -200,7 +196,7 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, else firstarg_kt = FFEINFO_kindtype; - for (argc = &c[colon + 3], + for (argc = &c[5], arg = args; *argc != '\0'; ) @@ -210,8 +206,6 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, char extra = '\0'; char basic; char kind; - int length; - int elements; bool lastarg_complex = FALSE; /* We don't do anything with keywords yet. */ @@ -230,31 +224,9 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, required = *(argc++); basic = *(argc++); kind = *(argc++); - if (*argc == '[') - { - length = *++argc - '0'; - if (*++argc != ']') - length = 10 * length + (*(argc++) - '0'); - ++argc; - } - else - length = -1; - if (*argc == '(') - { - elements = *++argc - '0'; - if (*++argc != ')') - elements = 10 * elements + (*(argc++) - '0'); - ++argc; - } - else if (*argc == '&') - { - elements = -1; - ++argc; - } - else - elements = 0; if ((*argc == '&') - || (*argc == 'i') + || (*argc == 'g') + || (*argc == 's') || (*argc == 'w') || (*argc == 'x')) extra = *(argc++); @@ -295,9 +267,7 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, switch (basic) { case 'A': - okay = (ffeinfo_basictype (i) == FFEINFO_basictypeCHARACTER) - && ((length == -1) - || (ffeinfo_size (i) == (ffetargetCharacterSize) length)); + okay = ffeinfo_basictype (i) == FFEINFO_basictypeCHARACTER; break; case 'C': @@ -349,29 +319,6 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, || (ffeinfo_basictype (i) == FFEINFO_basictypeREAL); break; - case 'g': - okay = ((ffebld_op (a) == FFEBLD_opLABTER) - || (ffebld_op (a) == FFEBLD_opLABTOK)); - elements = -1; - extra = '-'; - break; - - case 's': - okay = (((((ffeinfo_basictype (i) == FFEINFO_basictypeNONE) - && (ffeinfo_kindtype (i) == FFEINFO_kindtypeNONE) - && (ffeinfo_kind (i) == FFEINFO_kindSUBROUTINE)) - || ((ffeinfo_basictype (i) == FFEINFO_basictypeINTEGER) - && (ffeinfo_kindtype (i) == FFEINFO_kindtypeINTEGERDEFAULT) - && (ffeinfo_kind (i) == FFEINFO_kindFUNCTION)) - || (ffeinfo_kind (i) == FFEINFO_kindNONE)) - && ((ffeinfo_where (i) == FFEINFO_whereDUMMY) - || (ffeinfo_where (i) == FFEINFO_whereGLOBAL))) - || ((ffeinfo_basictype (i) == FFEINFO_basictypeINTEGER) - && (ffeinfo_kind (i) == FFEINFO_kindENTITY))); - elements = -1; - extra = '-'; - break; - case '-': default: okay = TRUE; @@ -380,69 +327,44 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, switch (kind) { - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - akt = (kind - '0'); - if ((ffeinfo_basictype (i) == FFEINFO_basictypeINTEGER) - || (ffeinfo_basictype (i) == FFEINFO_basictypeLOGICAL)) - { - switch (akt) - { /* Translate to internal kinds for now! */ - default: - break; - - case 2: - akt = 4; - break; - - case 3: - akt = 2; - break; - - case 4: - akt = 5; - break; - - case 6: - akt = 3; - break; - } - } - okay &= anynum || (ffeinfo_kindtype (i) == akt); + case '1': + okay &= anynum || (ffeinfo_kindtype (i) == 1); + akt = 1; break; - case 'A': - okay &= anynum || (ffeinfo_kindtype (i) == firstarg_kt); - akt = (firstarg_kt == FFEINFO_kindtype) ? FFEINFO_kindtypeNONE - : firstarg_kt; + case '2': + okay &= anynum || (ffeinfo_kindtype (i) == 2); + akt = 2; break; - case '*': - default: + case '3': + okay &= anynum || (ffeinfo_kindtype (i) == 3); + akt = 3; break; - } - switch (elements) - { - ffebld b; - - case -1: + case 'A': + okay &= anynum || (ffeinfo_kindtype (i) == firstarg_kt); + akt = (firstarg_kt == FFEINFO_kindtype) ? FFEINFO_kindtypeNONE + : firstarg_kt; break; - case 0: - if (ffeinfo_rank (i) != 0) + case 's': + if (((((ffeinfo_basictype (i) != FFEINFO_basictypeNONE) + || (ffeinfo_kindtype (i) != FFEINFO_kindtypeNONE) + || (ffeinfo_kind (i) != FFEINFO_kindSUBROUTINE)) + && ((ffeinfo_basictype (i) != FFEINFO_basictypeINTEGER) + || (ffeinfo_kindtype (i) != FFEINFO_kindtypeINTEGERDEFAULT) + || (ffeinfo_kind (i) != FFEINFO_kindFUNCTION)) + && (ffeinfo_kind (i) != FFEINFO_kindNONE)) + || ((ffeinfo_where (i) != FFEINFO_whereDUMMY) + && (ffeinfo_where (i) != FFEINFO_whereGLOBAL))) + && ((ffeinfo_basictype (i) != FFEINFO_basictypeINTEGER) + || (ffeinfo_kind (i) != FFEINFO_kindENTITY))) okay = FALSE; break; + case '0': default: - if ((ffeinfo_rank (i) != 1) - || (ffebld_op (a) != FFEBLD_opSYMTER) - || ((b = ffesymbol_arraysize (ffebld_symter (a))) == NULL) - || (ffebld_op (b) != FFEBLD_opCONTER) - || (ffeinfo_basictype (ffebld_info (b)) != FFEINFO_basictypeINTEGER) - || (ffeinfo_kindtype (ffebld_info (b)) != FFEINFO_kindtypeINTEGERDEFAULT) - || (ffebld_constant_integer1 (ffebld_conter (b)) != elements)) - okay = FALSE; break; } @@ -456,21 +378,28 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, okay = FALSE; break; + case 'g': + if ((ffebld_op (a) != FFEBLD_opLABTER) + && (ffebld_op (a) != FFEBLD_opLABTOK)) + okay = FALSE; + break; + + case 's': + break; + case 'w': case 'x': if ((ffeinfo_kind (i) != FFEINFO_kindENTITY) + || (ffeinfo_rank (i) != 0) || ((ffebld_op (a) != FFEBLD_opSYMTER) && (ffebld_op (a) != FFEBLD_opARRAYREF) && (ffebld_op (a) != FFEBLD_opSUBSTR))) okay = FALSE; break; - case '-': - case 'i': - break; - default: - if (ffeinfo_kind (i) != FFEINFO_kindENTITY) + if ((ffeinfo_kind (i) != FFEINFO_kindENTITY) + || (ffeinfo_rank (i) != 0)) okay = FALSE; break; } @@ -542,7 +471,7 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, { case 'A': bt = FFEINFO_basictypeCHARACTER; - sz = (c[2] == '*') ? FFETARGET_charactersizeNONE : 1; + sz = 1; break; case 'C': @@ -575,34 +504,16 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, switch (c[1]) { - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - kt = (c[1] - '0'); - if ((bt == FFEINFO_basictypeINTEGER) - || (bt == FFEINFO_basictypeLOGICAL)) - { - switch (kt) - { /* Translate to internal kinds for now! */ - default: - break; - - case 2: - kt = 4; - break; - - case 3: - kt = 2; - break; + case '1': + kt = 1; + break; - case 4: - kt = 5; - break; + case '2': + kt = 2; + break; - case 6: - kt = 3; - break; - } - } + case '3': + kt = 3; break; case 'C': @@ -611,11 +522,7 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, kt = 1; break; - case 'p': - kt = ffecom_pointer_kind (); - break; - - case '=': + case '0': need_col = TRUE; /* Fall through. */ case '-': @@ -626,14 +533,14 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, /* Determine collective type of COL, if there is one. */ - if (need_col || c[colon + 1] != '-') + if (need_col || c[3] != '-') { bool okay = TRUE; bool have_anynum = FALSE; for (arg = args; arg != NULL; - arg = (c[colon + 1] == '*') ? ffebld_trail (arg) : NULL) + arg = (c[3] == '*') ? ffebld_trail (arg) : NULL) { ffebld a = ffebld_head (arg); ffeinfo i; @@ -753,19 +660,14 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, switch (c[1]) { - case '=': + case '0': if (need_col) kt = col_kt; break; case 'C': - if (col_bt == FFEINFO_basictypeCOMPLEX) - { - if (col_kt != FFEINFO_kindtypeREALDEFAULT) - *check_intrin = TRUE; - if (need_col) - kt = col_kt; - } + if (need_col && (col_bt == FFEINFO_basictypeCOMPLEX)) + kt = col_kt; break; } @@ -775,18 +677,16 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, /* Now, convert args in the arglist to the final type of the COL. */ - for (argno = 0, argc = &c[colon + 3], + for (argc = &c[5], arg = args; *argc != '\0'; - ++argno) + ) { char optional = '\0'; char required = '\0'; char extra = '\0'; char basic; char kind; - int length; - int elements; bool lastarg_complex = FALSE; /* We don't do anything with keywords yet. */ @@ -805,31 +705,9 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, required = *(argc++); basic = *(argc++); kind = *(argc++); - if (*argc == '[') - { - length = *++argc - '0'; - if (*++argc != ']') - length = 10 * length + (*(argc++) - '0'); - ++argc; - } - else - length = -1; - if (*argc == '(') - { - elements = *++argc - '0'; - if (*++argc != ')') - elements = 10 * elements + (*(argc++) - '0'); - ++argc; - } - else if (*argc == '&') - { - elements = -1; - ++argc; - } - else - elements = 0; if ((*argc == '&') - || (*argc == 'i') + || (*argc == 'g') + || (*argc == 's') || (*argc == 'w') || (*argc == 'x')) extra = *(argc++); @@ -845,8 +723,8 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, ffebld a; ffeinfo i; bool anynum; - ffeinfoBasictype abt = FFEINFO_basictypeNONE; - ffeinfoKindtype akt = FFEINFO_kindtypeNONE; + ffeinfoBasictype abt; + ffeinfoKindtype akt; if ((arg == NULL) || (ffebld_head (arg) == NULL)) @@ -863,15 +741,16 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, /* Determine what the default type for anynum would be. */ + abt = FFEINFO_basictypeNONE; + akt = FFEINFO_kindtypeNONE; if (anynum) { - switch (c[colon + 1]) + switch (c[3]) { case '-': break; - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - if (argno != (c[colon + 1] - '0')) + case '1': + if (arg != args) break; case '*': abt = col_bt; @@ -888,9 +767,7 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, switch (basic) { case 'A': - okay = (ffeinfo_basictype (i) == FFEINFO_basictypeCHARACTER) - && ((length == -1) - || (ffeinfo_size (i) == (ffetargetCharacterSize) length)); + okay = ffeinfo_basictype (i) == FFEINFO_basictypeCHARACTER; break; case 'C': @@ -942,29 +819,6 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, || (ffeinfo_basictype (i) == FFEINFO_basictypeREAL); break; - case 'g': - okay = ((ffebld_op (a) == FFEBLD_opLABTER) - || (ffebld_op (a) == FFEBLD_opLABTOK)); - elements = -1; - extra = '-'; - break; - - case 's': - okay = (((((ffeinfo_basictype (i) == FFEINFO_basictypeNONE) - && (ffeinfo_kindtype (i) == FFEINFO_kindtypeNONE) - && (ffeinfo_kind (i) == FFEINFO_kindSUBROUTINE)) - || ((ffeinfo_basictype (i) == FFEINFO_basictypeINTEGER) - && (ffeinfo_kindtype (i) == FFEINFO_kindtypeINTEGERDEFAULT) - && (ffeinfo_kind (i) == FFEINFO_kindFUNCTION)) - || (ffeinfo_kind (i) == FFEINFO_kindNONE)) - && ((ffeinfo_where (i) == FFEINFO_whereDUMMY) - || (ffeinfo_where (i) == FFEINFO_whereGLOBAL))) - || ((ffeinfo_basictype (i) == FFEINFO_basictypeINTEGER) - && (ffeinfo_kind (i) == FFEINFO_kindENTITY))); - elements = -1; - extra = '-'; - break; - case '-': default: okay = TRUE; @@ -973,69 +827,44 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, switch (kind) { - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - akt = (kind - '0'); - if ((ffeinfo_basictype (i) == FFEINFO_basictypeINTEGER) - || (ffeinfo_basictype (i) == FFEINFO_basictypeLOGICAL)) - { - switch (akt) - { /* Translate to internal kinds for now! */ - default: - break; - - case 2: - akt = 4; - break; - - case 3: - akt = 2; - break; - - case 4: - akt = 5; - break; - - case 6: - akt = 3; - break; - } - } - okay &= anynum || (ffeinfo_kindtype (i) == akt); + case '1': + okay &= anynum || (ffeinfo_kindtype (i) == 1); + akt = 1; break; - case 'A': - okay &= anynum || (ffeinfo_kindtype (i) == firstarg_kt); - akt = (firstarg_kt == FFEINFO_kindtype) ? FFEINFO_kindtypeNONE - : firstarg_kt; + case '2': + okay &= anynum || (ffeinfo_kindtype (i) == 2); + akt = 2; break; - case '*': - default: + case '3': + okay &= anynum || (ffeinfo_kindtype (i) == 3); + akt = 3; break; - } - - switch (elements) - { - ffebld b; - case -1: + case 'A': + okay &= anynum || (ffeinfo_kindtype (i) == firstarg_kt); + akt = (firstarg_kt == FFEINFO_kindtype) ? FFEINFO_kindtypeNONE + : firstarg_kt; break; - case 0: - if (ffeinfo_rank (i) != 0) + case 's': + if (((((ffeinfo_basictype (i) != FFEINFO_basictypeNONE) + || (ffeinfo_kindtype (i) != FFEINFO_kindtypeNONE) + || (ffeinfo_kind (i) != FFEINFO_kindSUBROUTINE)) + && ((ffeinfo_basictype (i) != FFEINFO_basictypeINTEGER) + || (ffeinfo_kindtype (i) != FFEINFO_kindtypeINTEGERDEFAULT) + || (ffeinfo_kind (i) != FFEINFO_kindFUNCTION)) + && (ffeinfo_kind (i) != FFEINFO_kindNONE)) + || ((ffeinfo_where (i) != FFEINFO_whereDUMMY) + && (ffeinfo_where (i) != FFEINFO_whereGLOBAL))) + && ((ffeinfo_basictype (i) != FFEINFO_basictypeINTEGER) + || (ffeinfo_kind (i) != FFEINFO_kindENTITY))) okay = FALSE; break; + case '0': default: - if ((ffeinfo_rank (i) != 1) - || (ffebld_op (a) != FFEBLD_opSYMTER) - || ((b = ffesymbol_arraysize (ffebld_symter (a))) == NULL) - || (ffebld_op (b) != FFEBLD_opCONTER) - || (ffeinfo_basictype (ffebld_info (b)) != FFEINFO_basictypeINTEGER) - || (ffeinfo_kindtype (ffebld_info (b)) != FFEINFO_kindtypeINTEGERDEFAULT) - || (ffebld_constant_integer1 (ffebld_conter (b)) != elements)) - okay = FALSE; break; } @@ -1049,21 +878,28 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, okay = FALSE; break; + case 'g': + if ((ffebld_op (a) != FFEBLD_opLABTER) + && (ffebld_op (a) != FFEBLD_opLABTOK)) + okay = FALSE; + break; + + case 's': + break; + case 'w': case 'x': if ((ffeinfo_kind (i) != FFEINFO_kindENTITY) + || (ffeinfo_rank (i) != 0) || ((ffebld_op (a) != FFEBLD_opSYMTER) && (ffebld_op (a) != FFEBLD_opARRAYREF) && (ffebld_op (a) != FFEBLD_opSUBSTR))) okay = FALSE; break; - case '-': - case 'i': - break; - default: - if (ffeinfo_kind (i) != FFEINFO_kindENTITY) + if ((ffeinfo_kind (i) != FFEINFO_kindENTITY) + || (ffeinfo_rank (i) != 0)) okay = FALSE; break; } @@ -1101,7 +937,7 @@ ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, FFEEXPR_contextLET); ffebld_set_head (arg, a); } - else if ((c[colon + 1] == '*') && commit) + else if ((c[3] == '*') && commit) { /* This is where we promote types to the consensus type for the COL. Maybe this is where -fpedantic @@ -1273,14 +1109,10 @@ ffeintrin_fulfill_generic (ffebld *expr, ffeinfo *info, ffelexToken t) if (state == FFE_intrinsicstateDELETED) continue; - tname = ffeintrin_specs_[tspec].name; - - if (timp != FFEINTRIN_impNONE) - { - if (!(ffeintrin_imps_[timp].control[0] == '-') - != !(ffebld_op (*expr) == FFEBLD_opSUBRREF)) - continue; /* Form of reference must match form of specific. */ - } + if (timp == FFEINTRIN_impNONE) + tname = ffeintrin_specs_[tspec].name; + else + tname = ffeintrin_imps_[timp].name; if (state == FFE_intrinsicstateDISABLED) terror = FFEBAD_INTRINSIC_DISABLED; @@ -1290,7 +1122,7 @@ ffeintrin_fulfill_generic (ffebld *expr, ffeinfo *info, ffelexToken t) { terror = ffeintrin_check_ (timp, ffebld_op (*expr), ffebld_right (*expr), - &tbt, &tkt, &tsz, NULL, t, FALSE); + &tbt, &tkt, &tsz, t, FALSE); if (terror == FFEBAD) { if (imp != FFEINTRIN_impNONE) @@ -1383,7 +1215,7 @@ ffeintrin_fulfill_generic (ffebld *expr, ffeinfo *info, ffelexToken t) } error = ffeintrin_check_ (imp, ffebld_op (*expr), ffebld_right (*expr), - &bt, &kt, &sz, NULL, t, TRUE); + &bt, &kt, &sz, t, TRUE); assert (error == FFEBAD); *info = ffeinfo_new (bt, kt, @@ -1411,9 +1243,8 @@ ffeintrin_fulfill_generic (ffebld *expr, ffeinfo *info, ffelexToken t) ffebld expr; // FUNCREF or SUBRREF with no info (caller // gets it from the modified info structure). ffeinfo info; // Already filled in, will be overwritten. - bool check_intrin; // May be omitted, else set TRUE if intrinsic needs checking. ffelexToken token; // Used for error message. - ffeintrin_fulfill_specific (&expr, &info, &check_intrin, token); + ffeintrin_fulfill_specific (&expr, &info, token); Based on the specific id, determine whether the arg list is valid (number, type, rank, and kind of args) and fill in the info structure @@ -1423,8 +1254,7 @@ ffeintrin_fulfill_generic (ffebld *expr, ffeinfo *info, ffelexToken t) accordingly. */ void -ffeintrin_fulfill_specific (ffebld *expr, ffeinfo *info, - bool *check_intrin, ffelexToken t) +ffeintrin_fulfill_specific (ffebld *expr, ffeinfo *info, ffelexToken t) { ffebld symter; ffebldOp op; @@ -1447,8 +1277,6 @@ ffeintrin_fulfill_specific (ffebld *expr, ffeinfo *info, state = ffeintrin_state_family (ffeintrin_specs_[spec].family); imp = ffeintrin_specs_[spec].implementation; - if (check_intrin != NULL) - *check_intrin = FALSE; any = ffeintrin_check_any_ (ffebld_right (*expr)); @@ -1460,10 +1288,8 @@ ffeintrin_fulfill_specific (ffebld *expr, ffeinfo *info, { error = ffeintrin_check_ (imp, ffebld_op (*expr), ffebld_right (*expr), - &bt, &kt, &sz, check_intrin, t, TRUE); + &bt, &kt, &sz, t, TRUE); } - else - error = FFEBAD; /* Not really needed, but quiet -Wuninitialized. */ if (any || (error != FFEBAD)) { @@ -1474,7 +1300,7 @@ ffeintrin_fulfill_specific (ffebld *expr, ffeinfo *info, ffebad_start (error); ffebad_here (0, ffelex_token_where_line (t), ffelex_token_where_column (t)); - if (spec != FFEINTRIN_specNONE) + if (imp == FFEINTRIN_impNONE) name = ffeintrin_specs_[spec].name; else name = ffeintrin_imps_[imp].name; @@ -1524,9 +1350,8 @@ ffeintrin_init_0 () char *p1; char *p2; char *p3; - int colon; - if (!ffe_is_do_internal_checks ()) + if (!ffe_is_do_internal_checks()) return; assert (FFEINTRIN_gen == ARRAY_SIZE (ffeintrin_gens_)); @@ -1543,9 +1368,6 @@ ffeintrin_init_0 () for (i = 0; ((size_t) i) < ARRAY_SIZE (ffeintrin_names_); ++i) { - assert ((ffeintrin_names_[i].generic == FFEINTRIN_genNONE) - || (ffeintrin_names_[i].specific == FFEINTRIN_specNONE)); - p1 = ffeintrin_names_[i].name_uc; p2 = ffeintrin_names_[i].name_lc; p3 = ffeintrin_names_[i].name_ic; @@ -1585,44 +1407,31 @@ ffeintrin_init_0 () continue; } if ((c[1] != '-') - && (c[1] != '=') - && ((c[1] < '1') - || (c[1] > '9')) - && (c[1] != 'C') - && (c[1] != 'p')) + && (c[1] != '0') + && (c[1] != '1') + && (c[1] != '2') + && (c[1] != '3') + && (c[1] != 'C')) { fprintf (stderr, "%s: bad return-kind-type\n", ffeintrin_imps_[i].name); continue; } - if (c[2] == ':') - colon = 2; - else - { - if (c[2] != '*') - { - fprintf (stderr, "%s: bad return-modifier\n", - ffeintrin_imps_[i].name); - continue; - } - colon = 3; - } - if ((c[colon] != ':') || (c[colon + 2] != ':')) + if ((c[2] != ':') || (c[4] != ':')) { fprintf (stderr, "%s: bad control\n", ffeintrin_imps_[i].name); continue; } - if ((c[colon + 1] != '-') - && (c[colon + 1] != '*') - && ((c[colon + 1] < '0') - || (c[colon + 1] > '9'))) + if ((c[3] != '-') + && (c[3] != '*') + && (c[3] != '1')) { fprintf (stderr, "%s: bad COL-spec\n", ffeintrin_imps_[i].name); continue; } - c += (colon + 3); + c += 5; while (c[0] != '\0') { while ((c[0] != '=') @@ -1644,7 +1453,7 @@ ffeintrin_init_0 () || (c[1] == 'p')) ++c; if (((c[1] != '-') - && (c[1] != 'A') + && (c[1] != 'A') && (c[1] != 'C') && (c[1] != 'I') && (c[1] != 'L') @@ -1652,49 +1461,20 @@ ffeintrin_init_0 () && (c[1] != 'B') && (c[1] != 'F') && (c[1] != 'N') - && (c[1] != 'S') - && (c[1] != 'g') - && (c[1] != 's')) - || ((c[2] != '*') - && ((c[2] < '1') - || (c[2] > '9')) - && (c[2] != 'A'))) + && (c[1] != 'S')) + || ((c[2] != '0') + && (c[2] != '1') + && (c[2] != '2') + && (c[2] != '3') + && (c[2] != 'A') + && (c[2] != 's'))) { fprintf (stderr, "%s: bad arg-type\n", ffeintrin_imps_[i].name); break; } - if (c[3] == '[') - { - if (((c[4] < '0') || (c[4] > '9')) - || ((c[5] != ']') - && (++c, (c[4] < '0') || (c[4] > '9') - || (c[5] != ']')))) - { - fprintf (stderr, "%s: bad arg-len\n", - ffeintrin_imps_[i].name); - break; - } - c += 3; - } - if (c[3] == '(') - { - if (((c[4] < '0') || (c[4] > '9')) - || ((c[5] != ')') - && (++c, (c[4] < '0') || (c[4] > '9') - || (c[5] != ')')))) - { - fprintf (stderr, "%s: bad arg-rank\n", - ffeintrin_imps_[i].name); - break; - } - c += 3; - } - else if ((c[3] == '&') - && (c[4] == '&')) - ++c; if ((c[3] == '&') - || (c[3] == 'i') + || (c[3] == 's') || (c[3] == 'w') || (c[3] == 'x')) ++c; @@ -1742,20 +1522,26 @@ ffeintrin_is_actualarg (ffeintrinSpec spec) ffeintrinGen gen; // (TRUE only) Generic id of intrinsic. ffeintrinSpec spec; // (TRUE only) Specific id of intrinsic. ffeintrinImp imp; // (TRUE only) Implementation id of intrinsic. - if (ffeintrin_is_intrinsic (name, t, explicit, - &gen, &spec, &imp)) + ffeinfoKind kind; // (TRUE:) kindFUNCTION, kindSUBROUTINE, + // or kindNONE; (FALSE:) kindANY, kindNONE. + if (ffeintrin_is_intrinsic (name, t, &gen, &spec, &imp, &kind)) // is an intrinsic, use gen, spec, imp, and - // kind accordingly. */ + // kind accordingly. + + If FALSE is returned, kindANY says that the intrinsic exists but is + not valid for some reason (disabled or unimplemented), in which case a + diagnostic was generated (assuming t == NULL). */ bool ffeintrin_is_intrinsic (char *name, ffelexToken t, bool explicit, ffeintrinGen *xgen, ffeintrinSpec *xspec, - ffeintrinImp *ximp) + ffeintrinImp *ximp, ffeinfoKind *xkind) { struct _ffeintrin_name_ *intrinsic; ffeintrinGen gen; ffeintrinSpec spec; ffeintrinImp imp; + ffeinfoKind kind; ffeIntrinsicState state; bool disabled = FALSE; bool unimpl = FALSE; @@ -1780,8 +1566,6 @@ ffeintrin_is_intrinsic (char *name, ffelexToken t, bool explicit, ffeintrinSpec tspec; bool ok = FALSE; - name = ffeintrin_gens_[gen].name; - for (i = 0; (((size_t) i) < ARRAY_SIZE (ffeintrin_gens_[gen].specs)) && ((tspec @@ -1822,8 +1606,6 @@ ffeintrin_is_intrinsic (char *name, ffelexToken t, bool explicit, if (spec != FFEINTRIN_specNONE) { - name = ffeintrin_specs_[spec].name; - if (((state = ffeintrin_state_family (ffeintrin_specs_[spec].family)) == FFE_intrinsicstateDELETED) || (!explicit @@ -1853,25 +1635,31 @@ ffeintrin_is_intrinsic (char *name, ffelexToken t, bool explicit, { ffebad_start (disabled ? FFEBAD_INTRINSIC_DISABLED - : FFEBAD_INTRINSIC_UNIMPLW); + : FFEBAD_INTRINSIC_UNIMPL); ffebad_here (0, ffelex_token_where_line (t), ffelex_token_where_column (t)); ffebad_string (name); ffebad_finish (); } + if (disabled || unimpl) + *xkind = FFEINFO_kindANY; + else + *xkind = FFEINFO_kindNONE; return FALSE; } /* Determine whether intrinsic is function or subroutine. If no specific - id, scan list of possible specifics for generic to get consensus. If - not unanimous, or clear from the context, return NONE. */ + id, scan list of possible specifics for generic to get consensus. Must + be unanimous, at least for now. */ if (spec == FFEINTRIN_specNONE) { int i; ffeintrinSpec tspec; ffeintrinImp timp; - bool at_least_one_ok = FALSE; + ffeinfoKind tkind; + + kind = FFEINFO_kindNONE; for (i = 0; (((size_t) i) < ARRAY_SIZE (ffeintrin_gens_[gen].specs)) @@ -1879,31 +1667,31 @@ ffeintrin_is_intrinsic (char *name, ffelexToken t, bool explicit, = ffeintrin_gens_[gen].specs[i]) != FFEINTRIN_specNONE); ++i) { - if (((state = ffeintrin_state_family (ffeintrin_specs_[tspec].family)) - == FFE_intrinsicstateDELETED) - || (state == FFE_intrinsicstateDISABLED)) - continue; - if ((timp = ffeintrin_specs_[tspec].implementation) == FFEINTRIN_impNONE) continue; - at_least_one_ok = TRUE; - break; - } + if (ffeintrin_imps_[timp].control[0] == '-') + tkind = FFEINFO_kindSUBROUTINE; + else + tkind = FFEINFO_kindFUNCTION; - if (!at_least_one_ok) - { - *xgen = FFEINTRIN_genNONE; - *xspec = FFEINTRIN_specNONE; - *ximp = FFEINTRIN_impNONE; - return FALSE; + if ((kind == tkind) || (kind == FFEINFO_kindNONE)) + kind = tkind; + else + assert ("what kind of proc am i?" == NULL); } } + else /* Have specific, use that. */ + kind + = (ffeintrin_imps_[imp].control[0] == '-') + ? FFEINFO_kindSUBROUTINE + : FFEINFO_kindFUNCTION; *xgen = gen; *xspec = spec; *ximp = imp; + *xkind = kind; return TRUE; } @@ -1969,8 +1757,10 @@ ffeintrin_state_family (ffeintrinFamily family) state = ffe_state_max (state, ffe_intrinsic_state_mil ()); return state; - case FFEINTRIN_familyGNU: - state = ffe_intrinsic_state_gnu (); + case FFEINTRIN_familyDCP: + state = ffe_intrinsic_state_vxt (); + state = ffe_state_max (state, ffe_intrinsic_state_f90 ()); + state = ffe_state_max (state, ffe_intrinsic_state_dcp ()); return state; case FFEINTRIN_familyF90: @@ -1984,12 +1774,17 @@ ffeintrin_state_family (ffeintrinFamily family) case FFEINTRIN_familyFVZ: state = ffe_intrinsic_state_f2c (); state = ffe_state_max (state, ffe_intrinsic_state_vxt ()); + state = ffe_state_max (state, ffe_intrinsic_state_dcp ()); return state; case FFEINTRIN_familyF2C: state = ffe_intrinsic_state_f2c (); return state; + case FFEINTRIN_familyF2Z: + state = ffe_intrinsic_state_f2c (); + return state; + case FFEINTRIN_familyF2U: state = ffe_intrinsic_state_unix (); return state; diff --git a/gnu/usr.bin/gcc/f/intrin.def b/gnu/usr.bin/gcc/f/intrin.def index 17eba78404a..d0031414c70 100644 --- a/gnu/usr.bin/gcc/f/intrin.def +++ b/gnu/usr.bin/gcc/f/intrin.def @@ -1,6 +1,23 @@ /* intrin.def -- Public #include File (module.h template V1.0) - The Free Software Foundation has released this file into the - public domain. + Copyright (C) 1995 Free Software Foundation, Inc. + Contributed by James Craig Burley (burley@gnu.ai.mit.edu). + +This file is part of GNU Fortran. + +GNU Fortran is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Fortran is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Fortran; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. Owning Modules: intrin.c @@ -13,7 +30,6 @@ DEFNAME ("ABORT", "abort", "Abort", genNONE, specABORT) /* UNIX */ DEFNAME ("ABS", "abs", "Abs", genNONE, specABS) -DEFNAME ("ACCESS", "access", "Access", genNONE, specACCESS) /* UNIX */ DEFNAME ("ACHAR", "achar", "AChar", genNONE, specACHAR) /* F90, F2C */ DEFNAME ("ACOS", "acos", "ACos", genNONE, specACOS) DEFNAME ("ACOSD", "acosd", "ACosD", genNONE, specACOSD) /* VXT */ @@ -44,12 +60,6 @@ DEFNAME ("ATAN", "atan", "ATan", genNONE, specATAN) DEFNAME ("ATAN2", "atan2", "ATan2", genNONE, specATAN2) DEFNAME ("ATAN2D", "atan2d", "ATan2D", genNONE, specATAN2D) /* VXT */ DEFNAME ("ATAND", "atand", "ATanD", genNONE, specATAND) /* VXT */ -DEFNAME ("BESJ0", "besj0", "BesJ0", genNONE, specBESJ0) /* UNIX */ -DEFNAME ("BESJ1", "besj1", "BesJ1", genNONE, specBESJ1) /* UNIX */ -DEFNAME ("BESJN", "besjn", "BesJN", genNONE, specBESJN) /* UNIX */ -DEFNAME ("BESY0", "besy0", "BesY0", genNONE, specBESY0) /* UNIX */ -DEFNAME ("BESY1", "besy1", "BesY1", genNONE, specBESY1) /* UNIX */ -DEFNAME ("BESYN", "besyn", "BesYN", genNONE, specBESYN) /* UNIX */ DEFNAME ("BITEST", "bitest", "BITest", genNONE, specBITEST) /* VXT */ DEFNAME ("BIT_SIZE", "bit_size", "Bit_Size", genNONE, specBIT_SIZE) /* F90 */ DEFNAME ("BJTEST", "bjtest", "BJTest", genNONE, specBJTEST) /* VXT */ @@ -65,11 +75,8 @@ DEFNAME ("CDSQRT", "cdsqrt", "CDSqRt", genNONE, specCDSQRT) /* VXT */ DEFNAME ("CEILING", "ceiling", "Ceiling", genNONE, specCEILING) /* F90 */ DEFNAME ("CEXP", "cexp", "CExp", genNONE, specCEXP) DEFNAME ("CHAR", "char", "Char", genNONE, specCHAR) -DEFNAME ("CHDIR", "chdir", "ChDir", genNONE, specCHDIR) /* UNIX */ -DEFNAME ("CHMOD", "chmod", "ChMod", genNONE, specCHMOD) /* UNIX */ DEFNAME ("CLOG", "clog", "CLog", genNONE, specCLOG) DEFNAME ("CMPLX", "cmplx", "Cmplx", genNONE, specCMPLX) -DEFNAME ("COMPLEX", "complex", "Complex", genNONE, specCOMPLEX) DEFNAME ("CONJG", "conjg", "Conjg", genNONE, specCONJG) DEFNAME ("COS", "cos", "Cos", genNONE, specCOS) DEFNAME ("COSD", "cosd", "CosD", genNONE, specCOSD) /* VXT */ @@ -78,7 +85,6 @@ DEFNAME ("COUNT", "count", "Count", genNONE, specCOUNT) /* F90 */ DEFNAME ("CSHIFT", "cshift", "CShift", genNONE, specCSHIFT) /* F90 */ DEFNAME ("CSIN", "csin", "CSin", genNONE, specCSIN) DEFNAME ("CSQRT", "csqrt", "CSqRt", genNONE, specCSQRT) -DEFNAME ("CTIME", "ctime", "CTime", genNONE, specCTIME) /* UNIX */ DEFNAME ("DABS", "dabs", "DAbs", genNONE, specDABS) DEFNAME ("DACOS", "dacos", "DACos", genNONE, specDACOS) DEFNAME ("DACOSD", "dacosd", "DACosD", genNONE, specDACOSD) /* VXT */ @@ -88,14 +94,7 @@ DEFNAME ("DATAN", "datan", "DATan", genNONE, specDATAN) DEFNAME ("DATAN2", "datan2", "DATan2", genNONE, specDATAN2) DEFNAME ("DATAN2D", "datan2d", "DATan2D", genNONE, specDATAN2D) /* VXT */ DEFNAME ("DATAND", "datand", "DATanD", genNONE, specDATAND) /* VXT */ -DEFNAME ("DATE", "date", "Date", genNONE, specDATE) /* VXT */ DEFNAME ("DATE_AND_TIME", "date_and_time", "Date_and_Time", genNONE, specDATE_AND_TIME) /* F90 */ -DEFNAME ("DBESJ0", "dbesj0", "DbesJ0", genNONE, specDBESJ0) /* UNIX */ -DEFNAME ("DBESJ1", "dbesj1", "DbesJ1", genNONE, specDBESJ1) /* UNIX */ -DEFNAME ("DBESJN", "dbesjn", "DbesJN", genNONE, specDBESJN) /* UNIX */ -DEFNAME ("DBESY0", "dbesy0", "DbesY0", genNONE, specDBESY0) /* UNIX */ -DEFNAME ("DBESY1", "dbesy1", "DbesY1", genNONE, specDBESY1) /* UNIX */ -DEFNAME ("DBESYN", "dbesyn", "DbesYN", genNONE, specDBESYN) /* UNIX */ DEFNAME ("DBLE", "dble", "Dble", genNONE, specDBLE) DEFNAME ("DBLEQ", "dbleq", "DbleQ", genNONE, specDBLEQ) /* VXT */ DEFNAME ("DCMPLX", "dcmplx", "DCmplx", genNONE, specDCMPLX) /* F2C, VXT */ @@ -103,7 +102,7 @@ DEFNAME ("DCONJG", "dconjg", "DConjg", genNONE, specDCONJG) /* F2C, VXT */ DEFNAME ("DCOS", "dcos", "DCos", genNONE, specDCOS) DEFNAME ("DCOSD", "dcosd", "DCosD", genNONE, specDCOSD) /* VXT */ DEFNAME ("DCOSH", "dcosh", "DCosH", genNONE, specDCOSH) -DEFNAME ("DDIM", "ddim", "DDiM", genNONE, specDDIM) +DEFNAME ("DDIM", "ddim", "DDim", genNONE, specDDIM) DEFNAME ("DERF", "derf", "DErF", genNONE, specDERF) /* UNIX */ DEFNAME ("DERFC", "derfc", "DErFC", genNONE, specDERFC) /* UNIX */ DEFNAME ("DEXP", "dexp", "DExp", genNONE, specDEXP) @@ -112,7 +111,7 @@ DEFNAME ("DFLOTI", "dfloti", "DFlotI", genNONE, specDFLOTI) /* VXT */ DEFNAME ("DFLOTJ", "dflotj", "DFlotJ", genNONE, specDFLOTJ) /* VXT */ DEFNAME ("DIGITS", "digits", "Digits", genNONE, specDIGITS) /* F90 */ DEFNAME ("DIM", "dim", "DiM", genNONE, specDIM) -DEFNAME ("DIMAG", "dimag", "DImag", genNONE, specDIMAG) /* F2C, VXT */ +DEFNAME ("DIMAG", "dimag", "DImag", genNONE, specDIMAG) /* VXT */ DEFNAME ("DINT", "dint", "DInt", genNONE, specDINT) DEFNAME ("DLOG", "dlog", "DLog", genNONE, specDLOG) DEFNAME ("DLOG10", "dlog10", "DLog10", genNONE, specDLOG10) @@ -131,44 +130,29 @@ DEFNAME ("DSQRT", "dsqrt", "DSqRt", genNONE, specDSQRT) DEFNAME ("DTAN", "dtan", "DTan", genNONE, specDTAN) DEFNAME ("DTAND", "dtand", "DTanD", genNONE, specDTAND) /* VXT */ DEFNAME ("DTANH", "dtanh", "DTanH", genNONE, specDTANH) -DEFNAME ("DTIME", "dtime", "Dtime", genNONE, specDTIME) /* UNIX */ DEFNAME ("EOSHIFT", "eoshift", "EOShift", genNONE, specEOSHIFT) /* F90 */ DEFNAME ("EPSILON", "epsilon", "Epsilon", genNONE, specEPSILON) /* F90 */ DEFNAME ("ERF", "erf", "ErF", genNONE, specERF) /* UNIX */ DEFNAME ("ERFC", "erfc", "ErFC", genNONE, specERFC) /* UNIX */ -DEFNAME ("ETIME", "etime", "ETime", genNONE, specETIME) /* UNIX */ DEFNAME ("EXIT", "exit", "Exit", genNONE, specEXIT) /* UNIX */ DEFNAME ("EXP", "exp", "Exp", genNONE, specEXP) DEFNAME ("EXPONENT", "exponent", "Exponent", genNONE, specEXPONENT) /* F90 */ -DEFNAME ("FDATE", "fdate", "Fdate", genNONE, specFDATE) /* UNIX */ -DEFNAME ("FGETC", "fgetc", "FGetC", genNONE, specFGETC) /* UNIX */ DEFNAME ("FLOAT", "float", "Float", genNONE, specFLOAT) DEFNAME ("FLOATI", "floati", "FloatI", genNONE, specFLOATI) /* VXT */ DEFNAME ("FLOATJ", "floatj", "FloatJ", genNONE, specFLOATJ) /* VXT */ DEFNAME ("FLOOR", "floor", "Floor", genNONE, specFLOOR) /* F90 */ DEFNAME ("FLUSH", "flush", "Flush", genNONE, specFLUSH) /* UNIX */ -DEFNAME ("FNUM", "fnum", "FNum", genNONE, specFNUM) /* UNIX */ DEFNAME ("FPABSP", "fpabsp", "FPAbsP", genFPABSP, specNONE) /* F2C */ DEFNAME ("FPEXPN", "fpexpn", "FPExpn", genFPEXPN, specNONE) /* F2C */ DEFNAME ("FPFRAC", "fpfrac", "FPFrac", genFPFRAC, specNONE) /* F2C */ DEFNAME ("FPMAKE", "fpmake", "FPMake", genFPMAKE, specNONE) /* F2C */ DEFNAME ("FPRRSP", "fprrsp", "FPRRSp", genFPRRSP, specNONE) /* F2C */ DEFNAME ("FPSCAL", "fpscal", "FPScal", genFPSCAL, specNONE) /* F2C */ -DEFNAME ("FPUTC", "fputc", "FPutC", genNONE, specFPUTC) /* UNIX */ DEFNAME ("FRACTION", "fraction", "Fraction", genNONE, specFRACTION) /* F90 */ DEFNAME ("FSEEK", "fseek", "FSeek", genNONE, specFSEEK) /* UNIX */ -DEFNAME ("FSTAT", "fstat", "FStat", genNONE, specFSTAT) /* UNIX */ DEFNAME ("FTELL", "ftell", "FTell", genNONE, specFTELL) /* UNIX */ -DEFNAME ("GERROR", "gerror", "GError", genNONE, specGERROR) /* UNIX */ DEFNAME ("GETARG", "getarg", "GetArg", genNONE, specGETARG) /* UNIX */ -DEFNAME ("GETCWD", "getcwd", "GetCWD", genNONE, specGETCWD) /* UNIX */ DEFNAME ("GETENV", "getenv", "GetEnv", genNONE, specGETENV) /* UNIX */ -DEFNAME ("GETGID", "getgid", "GetGId", genNONE, specGETGID) /* UNIX */ -DEFNAME ("GETLOG", "getlog", "GetLog", genNONE, specGETLOG) /* UNIX */ -DEFNAME ("GETPID", "getpid", "GetPId", genNONE, specGETPID) /* UNIX */ -DEFNAME ("GETUID", "getuid", "GetUId", genNONE, specGETUID) /* UNIX */ -DEFNAME ("GMTIME", "gmtime", "GMTime", genNONE, specGMTIME) /* UNIX */ -DEFNAME ("HOSTNM", "hostnm", "HostNm", genNONE, specHOSTNM) /* UNIX */ DEFNAME ("HUGE", "huge", "Huge", genNONE, specHUGE) /* F90 */ DEFNAME ("IABS", "iabs", "IAbs", genNONE, specIABS) DEFNAME ("IACHAR", "iachar", "IAChar", genNONE, specIACHAR) /* F90, F2C */ @@ -178,12 +162,10 @@ DEFNAME ("IBCLR", "ibclr", "IBClr", genNONE, specIBCLR) /* F90, VXT */ DEFNAME ("IBITS", "ibits", "IBits", genNONE, specIBITS) /* F90, VXT */ DEFNAME ("IBSET", "ibset", "IBSet", genNONE, specIBSET) /* F90, VXT */ DEFNAME ("ICHAR", "ichar", "IChar", genNONE, specICHAR) -DEFNAME ("IDATE", "idate", "IDate", genIDATE, specNONE) /* UNIX, VXT */ DEFNAME ("IDIM", "idim", "IDiM", genNONE, specIDIM) DEFNAME ("IDINT", "idint", "IDInt", genNONE, specIDINT) DEFNAME ("IDNINT", "idnint", "IDNInt", genNONE, specIDNINT) DEFNAME ("IEOR", "ieor", "IEOr", genNONE, specIEOR) /* F90, VXT */ -DEFNAME ("IERRNO", "ierrno", "IErrNo", genNONE, specIERRNO) /* UNIX */ DEFNAME ("IFIX", "ifix", "IFix", genNONE, specIFIX) DEFNAME ("IIABS", "iiabs", "IIAbs", genNONE, specIIABS) /* VXT */ DEFNAME ("IIAND", "iiand", "IIAnd", genNONE, specIIAND) /* VXT */ @@ -191,7 +173,7 @@ DEFNAME ("IIBCLR", "iibclr", "IIBClr", genNONE, specIIBCLR) /* VXT */ DEFNAME ("IIBITS", "iibits", "IIBits", genNONE, specIIBITS) /* VXT */ DEFNAME ("IIBSET", "iibset", "IIBSet", genNONE, specIIBSET) /* VXT */ DEFNAME ("IIDIM", "iidim", "IIDiM", genNONE, specIIDIM) /* VXT */ -DEFNAME ("IIDINT", "iidint", "IIDInt", genNONE, specIIDINT) /* VXT */ +DEFNAME ("IIDINT", "iidint", "IIDint", genNONE, specIIDINT) /* VXT */ DEFNAME ("IIDNNT", "iidnnt", "IIDNnt", genNONE, specIIDNNT) /* VXT */ DEFNAME ("IIEOR", "iieor", "IIEOr", genNONE, specIIEOR) /* VXT */ DEFNAME ("IIFIX", "iifix", "IIFix", genNONE, specIIFIX) /* VXT */ @@ -203,7 +185,6 @@ DEFNAME ("IISHFT", "iishft", "IIShft", genNONE, specNONE) /* VXT */ DEFNAME ("IISHFTC", "iishftc", "IIShftC", genNONE, specIISHFTC) /* VXT */ DEFNAME ("IISIGN", "iisign", "IISign", genNONE, specIISIGN) /* VXT */ DEFNAME ("IMAG", "imag", "Imag", genNONE, specIMAG) /* F2C */ -DEFNAME ("IMAGPART", "imagpart", "ImagPart", genNONE, specIMAGPART) /* GNU */ DEFNAME ("IMAX0", "imax0", "IMax0", genNONE, specIMAX0) /* VXT */ DEFNAME ("IMAX1", "imax1", "IMax1", genNONE, specIMAX1) /* VXT */ DEFNAME ("IMIN0", "imin0", "IMin0", genNONE, specIMIN0) /* VXT */ @@ -214,12 +195,9 @@ DEFNAME ("ININT", "inint", "INInt", genNONE, specININT) /* VXT */ DEFNAME ("INOT", "inot", "INot", genNONE, specINOT) /* VXT */ DEFNAME ("INT", "int", "Int", genNONE, specINT) DEFNAME ("IOR", "ior", "IOr", genNONE, specIOR) /* F90, VXT */ -DEFNAME ("IRAND", "irand", "IRand", genNONE, specIRAND) /* UNIX */ -DEFNAME ("ISATTY", "isatty", "IsaTty", genNONE, specISATTY) /* UNIX */ DEFNAME ("ISHFT", "ishft", "IShft", genNONE, specISHFT) /* F90 */ DEFNAME ("ISHFTC", "ishftc", "IShftC", genNONE, specISHFTC) /* F90, VXT */ DEFNAME ("ISIGN", "isign", "ISign", genNONE, specISIGN) -DEFNAME ("ITIME", "itime", "ITime", genNONE, specITIME) /* UNIX */ DEFNAME ("IZEXT", "izext", "IZExt", genNONE, specIZEXT) /* VXT */ DEFNAME ("JIABS", "jiabs", "JIAbs", genNONE, specJIABS) /* VXT */ DEFNAME ("JIAND", "jiand", "JIAnd", genNONE, specJIAND) /* VXT */ @@ -227,7 +205,7 @@ DEFNAME ("JIBCLR", "jibclr", "JIBClr", genNONE, specJIBCLR) /* VXT */ DEFNAME ("JIBITS", "jibits", "JIBits", genNONE, specJIBITS) /* VXT */ DEFNAME ("JIBSET", "jibset", "JIBSet", genNONE, specJIBSET) /* VXT */ DEFNAME ("JIDIM", "jidim", "JIDiM", genNONE, specJIDIM) /* VXT */ -DEFNAME ("JIDINT", "jidint", "JIDInt", genNONE, specJIDINT) /* VXT */ +DEFNAME ("JIDINT", "jidint", "JIDint", genNONE, specJIDINT) /* VXT */ DEFNAME ("JIDNNT", "jidnnt", "JIDNnt", genNONE, specJIDNNT) /* VXT */ DEFNAME ("JIEOR", "jieor", "JIEOr", genNONE, specJIEOR) /* VXT */ DEFNAME ("JIFIX", "jifix", "JIFix", genNONE, specJIFIX) /* VXT */ @@ -246,25 +224,19 @@ DEFNAME ("JMOD", "jmod", "JMod", genNONE, specJMOD) /* VXT */ DEFNAME ("JNINT", "jnint", "JNInt", genNONE, specJNINT) /* VXT */ DEFNAME ("JNOT", "jnot", "JNot", genNONE, specJNOT) /* VXT */ DEFNAME ("JZEXT", "jzext", "JZExt", genNONE, specJZEXT) /* VXT */ -DEFNAME ("KILL", "kill", "Kill", genNONE, specKILL) /* UNIX */ DEFNAME ("KIND", "kind", "Kind", genNONE, specKIND) /* F90 */ DEFNAME ("LBOUND", "lbound", "LBound", genNONE, specLBOUND) /* F90 */ DEFNAME ("LEN", "len", "Len", genNONE, specLEN) DEFNAME ("LEN_TRIM", "len_trim", "Len_Trim", genNONE, specLEN_TRIM) /* F90 */ DEFNAME ("LGE", "lge", "LGe", genNONE, specLGE) DEFNAME ("LGT", "lgt", "LGt", genNONE, specLGT) -DEFNAME ("LINK", "link", "Link", genNONE, specLINK) /* UNIX */ DEFNAME ("LLE", "lle", "LLe", genNONE, specLLE) DEFNAME ("LLT", "llt", "LLt", genNONE, specLLT) -DEFNAME ("LNBLNK", "lnblnk", "LnBlnk", genNONE, specLNBLNK) /* UNIX */ DEFNAME ("LOC", "loc", "Loc", genNONE, specLOC) /* VXT */ DEFNAME ("LOG", "log", "Log", genNONE, specLOG) DEFNAME ("LOG10", "log10", "Log10", genNONE, specLOG10) DEFNAME ("LOGICAL", "logical", "Logical", genNONE, specLOGICAL) /* F90 */ -DEFNAME ("LONG", "long", "Long", genNONE, specLONG) /* UNIX */ DEFNAME ("LSHIFT", "lshift", "LShift", genNONE, specLSHIFT) /* F2C */ -DEFNAME ("LSTAT", "lstat", "LStat", genNONE, specLSTAT) /* UNIX */ -DEFNAME ("LTIME", "ltime", "LTime", genNONE, specLTIME) /* UNIX */ DEFNAME ("MATMUL", "matmul", "MatMul", genNONE, specMATMUL) /* F90 */ DEFNAME ("MAX", "max", "Max", genNONE, specMAX) DEFNAME ("MAX0", "max0", "Max0", genNONE, specMAX0) @@ -272,7 +244,6 @@ DEFNAME ("MAX1", "max1", "Max1", genNONE, specMAX1) DEFNAME ("MAXEXPONENT", "maxexponent", "MaxExponent", genNONE, specMAXEXPONENT) /* F90 */ DEFNAME ("MAXLOC", "maxloc", "MaxLoc", genNONE, specMAXLOC) /* F90 */ DEFNAME ("MAXVAL", "maxval", "MaxVal", genNONE, specMAXVAL) /* F90 */ -DEFNAME ("MCLOCK", "mclock", "MClock", genNONE, specMCLOCK) /* UNIX */ DEFNAME ("MERGE", "merge", "Merge", genNONE, specMERGE) /* F90 */ DEFNAME ("MIN", "min", "Min", genNONE, specMIN) DEFNAME ("MIN0", "min0", "Min0", genNONE, specMIN0) @@ -288,7 +259,6 @@ DEFNAME ("NINT", "nint", "NInt", genNONE, specNINT) DEFNAME ("NOT", "not", "Not", genNONE, specNOT) /* F2C, F90, VXT */ DEFNAME ("OR", "or", "Or", genNONE, specOR) /* F2C */ DEFNAME ("PACK", "pack", "Pack", genNONE, specPACK) /* F90 */ -DEFNAME ("PERROR", "perror", "PError", genNONE, specPERROR) /* UNIX */ DEFNAME ("PRECISION", "precision", "Precision", genNONE, specPRECISION) /* F90 */ DEFNAME ("PRESENT", "present", "Present", genNONE, specPRESENT) /* F90 */ DEFNAME ("PRODUCT", "product", "Product", genNONE, specPRODUCT) /* F90 */ @@ -324,55 +294,41 @@ DEFNAME ("QTAN", "qtan", "QTan", genNONE, specQTAN) /* VXT */ DEFNAME ("QTAND", "qtand", "QTanD", genNONE, specQTAND) /* VXT */ DEFNAME ("QTANH", "qtanh", "QTanH", genNONE, specQTANH) /* VXT */ DEFNAME ("RADIX", "radix", "Radix", genNONE, specRADIX) /* F90 */ -DEFNAME ("RAND", "rand", "Rand", genNONE, specRAND) /* UNIX */ DEFNAME ("RANDOM_NUMBER", "random_number", "Random_Number", genNONE, specRANDOM_NUMBER) /* F90 */ DEFNAME ("RANDOM_SEED", "random_seed", "Random_Seed", genNONE, specRANDOM_SEED) /* F90 */ DEFNAME ("RANGE", "range", "Range", genNONE, specRANGE) /* F90 */ DEFNAME ("REAL", "real", "Real", genNONE, specREAL) -DEFNAME ("REALPART", "realpart", "RealPart", genNONE, specREALPART) /* GNU */ -DEFNAME ("RENAME", "rename", "Rename", genNONE, specRENAME) /* UNIX */ DEFNAME ("REPEAT", "repeat", "Repeat", genNONE, specREPEAT) /* F90 */ DEFNAME ("RESHAPE", "reshape", "Reshape", genNONE, specRESHAPE) /* F90 */ DEFNAME ("RRSPACING", "rrspacing", "RRSpacing", genNONE, specRRSPACING) /* F90 */ DEFNAME ("RSHIFT", "rshift", "RShift", genNONE, specRSHIFT) /* F2C */ DEFNAME ("SCALE", "scale", "Scale", genNONE, specSCALE) /* F90 */ DEFNAME ("SCAN", "scan", "Scan", genNONE, specSCAN) /* F90 */ -DEFNAME ("SECNDS", "secnds", "Secnds", genNONE, specSECNDS) /* VXT */ -DEFNAME ("SECOND", "second", "Second", genSECOND, specNONE) /* UNIX */ DEFNAME ("SELECTED_INT_KIND", "selected_int_kind", "Selected_Int_Kind", genNONE, specSEL_INT_KIND) /* F90 */ DEFNAME ("SELECTED_REAL_KIND", "selected_real_kind", "Selected_Real_Kind", genNONE, specSEL_REAL_KIND) /* F90 */ DEFNAME ("SET_EXPONENT", "set_exponent", "Set_Exponent", genNONE, specSET_EXPONENT) /* F90 */ DEFNAME ("SHAPE", "shape", "Shape", genNONE, specSHAPE) /* F90 */ -DEFNAME ("SHORT", "short", "Short", genNONE, specSHORT) /* UNIX */ DEFNAME ("SIGN", "sign", "Sign", genNONE, specSIGN) DEFNAME ("SIGNAL", "signal", "Signal", genNONE, specSIGNAL) /* UNIX */ DEFNAME ("SIN", "sin", "Sin", genNONE, specSIN) DEFNAME ("SIND", "sind", "SinD", genNONE, specSIND) /* VXT */ DEFNAME ("SINH", "sinh", "SinH", genNONE, specSINH) -DEFNAME ("SLEEP", "sleep", "Sleep", genNONE, specSLEEP) /* UNIX */ DEFNAME ("SNGL", "sngl", "Sngl", genNONE, specSNGL) DEFNAME ("SNGLQ", "snglq", "SnglQ", genNONE, specSNGLQ) /* VXT */ DEFNAME ("SPACING", "spacing", "Spacing", genNONE, specSPACING) /* F90 */ DEFNAME ("SPREAD", "spread", "Spread", genNONE, specSPREAD) /* F90 */ DEFNAME ("SQRT", "sqrt", "SqRt", genNONE, specSQRT) -DEFNAME ("SRAND", "srand", "SRand", genNONE, specSRAND) /* UNIX */ -DEFNAME ("STAT", "stat", "Stat", genNONE, specSTAT) /* UNIX */ DEFNAME ("SUM", "sum", "Sum", genNONE, specSUM) /* F90 */ -DEFNAME ("SYMLNK", "symlnk", "SymLnk", genNONE, specSYMLNK) /* UNIX */ DEFNAME ("SYSTEM", "system", "System", genNONE, specSYSTEM) /* UNIX */ DEFNAME ("SYSTEM_CLOCK", "system_clock", "System_Clock", genNONE, specSYSTEM_CLOCK) /* F90 */ DEFNAME ("TAN", "tan", "Tan", genNONE, specTAN) DEFNAME ("TAND", "tand", "TanD", genNONE, specTAND) /* VXT */ DEFNAME ("TANH", "tanh", "TanH", genNONE, specTANH) -DEFNAME ("TIME", "time", "Time", genTIME, specNONE) /* UNIX, VXT */ DEFNAME ("TINY", "tiny", "Tiny", genNONE, specTINY) /* F90 */ DEFNAME ("TRANSFER", "transfer", "Transfer", genNONE, specTRANSFER) /* F90 */ DEFNAME ("TRANSPOSE", "transpose", "Transpose", genNONE, specTRANSPOSE) /* F90 */ DEFNAME ("TRIM", "trim", "Trim", genNONE, specTRIM) /* F90 */ -DEFNAME ("TTYNAM", "ttynam", "TtyNam", genNONE, specTTYNAM) /* UNIX */ DEFNAME ("UBOUND", "ubound", "UBound", genNONE, specUBOUND) /* F90 */ -DEFNAME ("UMASK", "umask", "UMask", genNONE, specUMASK) /* UNIX */ -DEFNAME ("UNLINK", "unlink", "Unlink", genNONE, specUNLINK) /* UNIX */ DEFNAME ("UNPACK", "unpack", "Unpack", genNONE, specUNPACK) /* F90 */ DEFNAME ("VERIFY", "verify", "Verify", genNONE, specVERIFY) /* F90 */ DEFNAME ("XOR", "xor", "XOr", genNONE, specXOR) /* F2C */ @@ -392,43 +348,31 @@ DEFNAME ("ZSQRT", "zsqrt", "ZSqRt", genNONE, specZSQRT) /* F2C */ being used. Also, this includes the placeholder intrinsics that have no specific versions, but we want to reserve the names for now. */ -DEFGEN (FPABSP, "FPABSP", /* F2C */ +DEFGEN (FFEINTRIN_genFPABSP, "FPABSP", /* F2C */ FFEINTRIN_specNONE, FFEINTRIN_specNONE ) -DEFGEN (FPEXPN, "FPEXPN", /* F2C */ +DEFGEN (FFEINTRIN_genFPEXPN, "FPEXPN", /* F2C */ FFEINTRIN_specNONE, FFEINTRIN_specNONE ) -DEFGEN (FPFRAC, "FPFRAC", /* F2C */ +DEFGEN (FFEINTRIN_genFPFRAC, "FPFRAC", /* F2C */ FFEINTRIN_specNONE, FFEINTRIN_specNONE ) -DEFGEN (FPMAKE, "FPMAKE", /* F2C */ +DEFGEN (FFEINTRIN_genFPMAKE, "FPMAKE", /* F2C */ FFEINTRIN_specNONE, FFEINTRIN_specNONE ) -DEFGEN (FPRRSP, "FPRRSP", /* F2C */ +DEFGEN (FFEINTRIN_genFPRRSP, "FPRRSP", /* F2C */ FFEINTRIN_specNONE, FFEINTRIN_specNONE ) -DEFGEN (FPSCAL, "FPSCAL", /* F2C */ +DEFGEN (FFEINTRIN_genFPSCAL, "FPSCAL", /* F2C */ FFEINTRIN_specNONE, FFEINTRIN_specNONE ) -DEFGEN (IDATE, "IDATE (UNIX or VXT)", /* UNIX/VXT */ - FFEINTRIN_specIDATE, - FFEINTRIN_specIDATEVXT - ) -DEFGEN (SECOND, "SECOND (function or subroutine)", /* UNIX/CRAY */ - FFEINTRIN_specSECONDFUNC, - FFEINTRIN_specSECONDSUBR - ) -DEFGEN (TIME, "TIME (UNIX or VXT)", /* UNIX/VXT */ - FFEINTRIN_specTIME, - FFEINTRIN_specTIMEVXT - ) -DEFGEN (NONE, "none", +DEFGEN (FFEINTRIN_genNONE, "none", FFEINTRIN_specNONE, FFEINTRIN_specNONE ) @@ -442,2228 +386,1844 @@ DEFGEN (NONE, "none", The second boolean argument specifies whether the intrinsic is allowed by the standard to be passed as an actual argument. */ -DEFSPEC (ABS, +DEFSPEC (FFEINTRIN_specABS, "ABS", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impABS ) -DEFSPEC (ACOS, +DEFSPEC (FFEINTRIN_specACOS, "ACOS", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impACOS ) -DEFSPEC (AIMAG, +DEFSPEC (FFEINTRIN_specAIMAG, "AIMAG", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impAIMAG ) -DEFSPEC (AINT, +DEFSPEC (FFEINTRIN_specAINT, "AINT", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impAINT ) -DEFSPEC (ALOG, +DEFSPEC (FFEINTRIN_specALOG, "ALOG", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impALOG ) -DEFSPEC (ALOG10, +DEFSPEC (FFEINTRIN_specALOG10, "ALOG10", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impALOG10 ) -DEFSPEC (AMAX0, +DEFSPEC (FFEINTRIN_specAMAX0, "AMAX0", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impAMAX0 ) -DEFSPEC (AMAX1, +DEFSPEC (FFEINTRIN_specAMAX1, "AMAX1", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impAMAX1 ) -DEFSPEC (AMIN0, +DEFSPEC (FFEINTRIN_specAMIN0, "AMIN0", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impAMIN0 ) -DEFSPEC (AMIN1, +DEFSPEC (FFEINTRIN_specAMIN1, "AMIN1", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impAMIN1 ) -DEFSPEC (AMOD, +DEFSPEC (FFEINTRIN_specAMOD, "AMOD", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impAMOD ) -DEFSPEC (ANINT, +DEFSPEC (FFEINTRIN_specANINT, "ANINT", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impANINT ) -DEFSPEC (ASIN, +DEFSPEC (FFEINTRIN_specASIN, "ASIN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impASIN ) -DEFSPEC (ATAN, +DEFSPEC (FFEINTRIN_specATAN, "ATAN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impATAN ) -DEFSPEC (ATAN2, +DEFSPEC (FFEINTRIN_specATAN2, "ATAN2", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impATAN2 ) -DEFSPEC (CABS, +DEFSPEC (FFEINTRIN_specCABS, "CABS", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impCABS ) -DEFSPEC (CCOS, +DEFSPEC (FFEINTRIN_specCCOS, "CCOS", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impCCOS ) -DEFSPEC (CEXP, +DEFSPEC (FFEINTRIN_specCEXP, "CEXP", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impCEXP ) -DEFSPEC (CHAR, +DEFSPEC (FFEINTRIN_specCHAR, "CHAR", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impCHAR ) -DEFSPEC (CLOG, +DEFSPEC (FFEINTRIN_specCLOG, "CLOG", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impCLOG ) -DEFSPEC (CMPLX, +DEFSPEC (FFEINTRIN_specCMPLX, "CMPLX", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impCMPLX ) -DEFSPEC (CONJG, +DEFSPEC (FFEINTRIN_specCONJG, "CONJG", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impCONJG ) -DEFSPEC (COS, +DEFSPEC (FFEINTRIN_specCOS, "COS", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impCOS ) -DEFSPEC (COSH, +DEFSPEC (FFEINTRIN_specCOSH, "COSH", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impCOSH ) -DEFSPEC (CSIN, +DEFSPEC (FFEINTRIN_specCSIN, "CSIN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impCSIN ) -DEFSPEC (CSQRT, +DEFSPEC (FFEINTRIN_specCSQRT, "CSQRT", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impCSQRT ) -DEFSPEC (DABS, +DEFSPEC (FFEINTRIN_specDABS, "DABS", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDABS ) -DEFSPEC (DACOS, +DEFSPEC (FFEINTRIN_specDACOS, "DACOS", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDACOS ) -DEFSPEC (DASIN, +DEFSPEC (FFEINTRIN_specDASIN, "DASIN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDASIN ) -DEFSPEC (DATAN, +DEFSPEC (FFEINTRIN_specDATAN, "DATAN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDATAN ) -DEFSPEC (DATAN2, +DEFSPEC (FFEINTRIN_specDATAN2, "DATAN2", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDATAN2 ) -DEFSPEC (DBLE, +DEFSPEC (FFEINTRIN_specDBLE, "DBLE", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impDBLE ) -DEFSPEC (DCOS, +DEFSPEC (FFEINTRIN_specDCOS, "DCOS", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDCOS ) -DEFSPEC (DCOSH, +DEFSPEC (FFEINTRIN_specDCOSH, "DCOSH", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDCOSH ) -DEFSPEC (DDIM, +DEFSPEC (FFEINTRIN_specDDIM, "DDIM", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDDIM ) -DEFSPEC (DEXP, +DEFSPEC (FFEINTRIN_specDEXP, "DEXP", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDEXP ) -DEFSPEC (DIM, +DEFSPEC (FFEINTRIN_specDIM, "DIM", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDIM ) -DEFSPEC (DINT, +DEFSPEC (FFEINTRIN_specDINT, "DINT", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDINT ) -DEFSPEC (DLOG, +DEFSPEC (FFEINTRIN_specDLOG, "DLOG", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDLOG ) -DEFSPEC (DLOG10, +DEFSPEC (FFEINTRIN_specDLOG10, "DLOG10", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDLOG10 ) -DEFSPEC (DMAX1, +DEFSPEC (FFEINTRIN_specDMAX1, "DMAX1", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impDMAX1 ) -DEFSPEC (DMIN1, +DEFSPEC (FFEINTRIN_specDMIN1, "DMIN1", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impDMIN1 ) -DEFSPEC (DMOD, +DEFSPEC (FFEINTRIN_specDMOD, "DMOD", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDMOD ) -DEFSPEC (DNINT, +DEFSPEC (FFEINTRIN_specDNINT, "DNINT", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDNINT ) -DEFSPEC (DPROD, +DEFSPEC (FFEINTRIN_specDPROD, "DPROD", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDPROD ) -DEFSPEC (DSIGN, +DEFSPEC (FFEINTRIN_specDSIGN, "DSIGN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDSIGN ) -DEFSPEC (DSIN, +DEFSPEC (FFEINTRIN_specDSIN, "DSIN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDSIN ) -DEFSPEC (DSINH, +DEFSPEC (FFEINTRIN_specDSINH, "DSINH", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDSINH ) -DEFSPEC (DSQRT, +DEFSPEC (FFEINTRIN_specDSQRT, "DSQRT", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDSQRT ) -DEFSPEC (DTAN, +DEFSPEC (FFEINTRIN_specDTAN, "DTAN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDTAN ) -DEFSPEC (DTANH, +DEFSPEC (FFEINTRIN_specDTANH, "DTANH", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impDTANH ) -DEFSPEC (EXP, +DEFSPEC (FFEINTRIN_specEXP, "EXP", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impEXP ) -DEFSPEC (FLOAT, +DEFSPEC (FFEINTRIN_specFLOAT, "FLOAT", FALSE, FFEINTRIN_familyF77, - FFEINTRIN_impFLOAT + FFEINTRIN_impREAL ) -DEFSPEC (IABS, +DEFSPEC (FFEINTRIN_specIABS, "IABS", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impIABS ) -DEFSPEC (ICHAR, +DEFSPEC (FFEINTRIN_specICHAR, "ICHAR", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impICHAR ) -DEFSPEC (IDIM, +DEFSPEC (FFEINTRIN_specIDIM, "IDIM", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impIDIM ) -DEFSPEC (IDINT, +DEFSPEC (FFEINTRIN_specIDINT, "IDINT", FALSE, FFEINTRIN_familyF77, - FFEINTRIN_impIDINT + FFEINTRIN_impINT ) -DEFSPEC (IDNINT, +DEFSPEC (FFEINTRIN_specIDNINT, "IDNINT", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impIDNINT ) -DEFSPEC (IFIX, +DEFSPEC (FFEINTRIN_specIFIX, "IFIX", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impINT ) -DEFSPEC (INDEX, +DEFSPEC (FFEINTRIN_specINDEX, "INDEX", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impINDEX ) -DEFSPEC (INT, +DEFSPEC (FFEINTRIN_specINT, "INT", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impINT ) -DEFSPEC (ISIGN, +DEFSPEC (FFEINTRIN_specISIGN, "ISIGN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impISIGN ) -DEFSPEC (LEN, +DEFSPEC (FFEINTRIN_specLEN, "LEN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impLEN ) -DEFSPEC (LGE, +DEFSPEC (FFEINTRIN_specLGE, "LGE", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impLGE ) -DEFSPEC (LGT, +DEFSPEC (FFEINTRIN_specLGT, "LGT", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impLGT ) -DEFSPEC (LLE, +DEFSPEC (FFEINTRIN_specLLE, "LLE", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impLLE ) -DEFSPEC (LLT, +DEFSPEC (FFEINTRIN_specLLT, "LLT", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impLLT ) -DEFSPEC (LOG, +DEFSPEC (FFEINTRIN_specLOG, "LOG", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impLOG ) -DEFSPEC (LOG10, +DEFSPEC (FFEINTRIN_specLOG10, "LOG10", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impLOG10 ) -DEFSPEC (MAX, +DEFSPEC (FFEINTRIN_specMAX, "MAX", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impMAX ) -DEFSPEC (MAX0, +DEFSPEC (FFEINTRIN_specMAX0, "MAX0", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impMAX0 ) -DEFSPEC (MAX1, +DEFSPEC (FFEINTRIN_specMAX1, "MAX1", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impMAX1 ) -DEFSPEC (MIN, +DEFSPEC (FFEINTRIN_specMIN, "MIN", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impMIN ) -DEFSPEC (MIN0, +DEFSPEC (FFEINTRIN_specMIN0, "MIN0", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impMIN0 ) -DEFSPEC (MIN1, +DEFSPEC (FFEINTRIN_specMIN1, "MIN1", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impMIN1 ) -DEFSPEC (MOD, +DEFSPEC (FFEINTRIN_specMOD, "MOD", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impMOD ) -DEFSPEC (NINT, +DEFSPEC (FFEINTRIN_specNINT, "NINT", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impNINT ) -DEFSPEC (REAL, +DEFSPEC (FFEINTRIN_specREAL, "REAL", FALSE, FFEINTRIN_familyF77, FFEINTRIN_impREAL ) -DEFSPEC (SIGN, +DEFSPEC (FFEINTRIN_specSIGN, "SIGN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impSIGN ) -DEFSPEC (SIN, +DEFSPEC (FFEINTRIN_specSIN, "SIN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impSIN ) -DEFSPEC (SINH, +DEFSPEC (FFEINTRIN_specSINH, "SINH", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impSINH ) -DEFSPEC (SNGL, +DEFSPEC (FFEINTRIN_specSNGL, "SNGL", FALSE, FFEINTRIN_familyF77, - FFEINTRIN_impSNGL + FFEINTRIN_impREAL ) -DEFSPEC (SQRT, +DEFSPEC (FFEINTRIN_specSQRT, "SQRT", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impSQRT ) -DEFSPEC (TAN, +DEFSPEC (FFEINTRIN_specTAN, "TAN", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impTAN ) -DEFSPEC (TANH, +DEFSPEC (FFEINTRIN_specTANH, "TANH", TRUE, FFEINTRIN_familyF77, FFEINTRIN_impTANH ) -DEFSPEC (ABORT, +DEFSPEC (FFEINTRIN_specABORT, "ABORT", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impABORT ) -DEFSPEC (ACCESS, - "ACCESS", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impACCESS -) -DEFSPEC (ACHAR, +DEFSPEC (FFEINTRIN_specACHAR, "ACHAR", FALSE, FFEINTRIN_familyASC, FFEINTRIN_impACHAR ) -DEFSPEC (ACOSD, +DEFSPEC (FFEINTRIN_specACOSD, "ACOSD", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (ADJUSTL, +DEFSPEC (FFEINTRIN_specADJUSTL, "ADJUSTL", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (ADJUSTR, +DEFSPEC (FFEINTRIN_specADJUSTR, "ADJUSTR", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (AIMAX0, +DEFSPEC (FFEINTRIN_specAIMAX0, "AIMAX0", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (AIMIN0, +DEFSPEC (FFEINTRIN_specAIMIN0, "AIMIN0", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (AJMAX0, +DEFSPEC (FFEINTRIN_specAJMAX0, "AJMAX0", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impAMAX0 ) -DEFSPEC (AJMIN0, +DEFSPEC (FFEINTRIN_specAJMIN0, "AJMIN0", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impAMIN0 ) -DEFSPEC (ALL, +DEFSPEC (FFEINTRIN_specALL, "ALL", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (ALLOCATED, +DEFSPEC (FFEINTRIN_specALLOCATED, "ALLOCATED", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (AND, +DEFSPEC (FFEINTRIN_specAND, "AND", FALSE, FFEINTRIN_familyF2C, - FFEINTRIN_impAND + FFEINTRIN_impIAND ) -DEFSPEC (ANY, +DEFSPEC (FFEINTRIN_specANY, "ANY", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (ASIND, +DEFSPEC (FFEINTRIN_specASIND, "ASIND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (ASSOCIATED, +DEFSPEC (FFEINTRIN_specASSOCIATED, "ASSOCIATED", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (ATAN2D, +DEFSPEC (FFEINTRIN_specATAN2D, "ATAN2D", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (ATAND, +DEFSPEC (FFEINTRIN_specATAND, "ATAND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (BESJ0, - "BESJ0", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impBESJ0 -) -DEFSPEC (BESJ1, - "BESJ1", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impBESJ1 -) -DEFSPEC (BESJN, - "BESJN", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impBESJN -) -DEFSPEC (BESY0, - "BESY0", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impBESY0 -) -DEFSPEC (BESY1, - "BESY1", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impBESY1 -) -DEFSPEC (BESYN, - "BESYN", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impBESYN -) -DEFSPEC (BIT_SIZE, +DEFSPEC (FFEINTRIN_specBIT_SIZE, "BIT_SIZE", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impBIT_SIZE ) -DEFSPEC (BITEST, +DEFSPEC (FFEINTRIN_specBITEST, "BITEST", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (BJTEST, +DEFSPEC (FFEINTRIN_specBJTEST, "BJTEST", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impBTEST ) -DEFSPEC (BTEST, +DEFSPEC (FFEINTRIN_specBTEST, "BTEST", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impBTEST ) -DEFSPEC (CDABS, +DEFSPEC (FFEINTRIN_specCDABS, "CDABS", TRUE, FFEINTRIN_familyFVZ, FFEINTRIN_impCDABS ) -DEFSPEC (CDCOS, +DEFSPEC (FFEINTRIN_specCDCOS, "CDCOS", TRUE, FFEINTRIN_familyFVZ, FFEINTRIN_impCDCOS ) -DEFSPEC (CDEXP, +DEFSPEC (FFEINTRIN_specCDEXP, "CDEXP", TRUE, FFEINTRIN_familyFVZ, FFEINTRIN_impCDEXP ) -DEFSPEC (CDLOG, +DEFSPEC (FFEINTRIN_specCDLOG, "CDLOG", TRUE, FFEINTRIN_familyFVZ, FFEINTRIN_impCDLOG ) -DEFSPEC (CDSIN, +DEFSPEC (FFEINTRIN_specCDSIN, "CDSIN", TRUE, FFEINTRIN_familyFVZ, FFEINTRIN_impCDSIN ) -DEFSPEC (CDSQRT, +DEFSPEC (FFEINTRIN_specCDSQRT, "CDSQRT", TRUE, FFEINTRIN_familyFVZ, FFEINTRIN_impCDSQRT ) -DEFSPEC (CEILING, +DEFSPEC (FFEINTRIN_specCEILING, "CEILING", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (CHDIR, - "CHDIR", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impCHDIR -) -DEFSPEC (CHMOD, - "CHMOD", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impCHMOD -) -DEFSPEC (COMPLEX, - "COMPLEX", - FALSE, - FFEINTRIN_familyGNU, - FFEINTRIN_impCOMPLEX - ) -DEFSPEC (COSD, +DEFSPEC (FFEINTRIN_specCOSD, "COSD", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (COUNT, +DEFSPEC (FFEINTRIN_specCOUNT, "COUNT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (CSHIFT, +DEFSPEC (FFEINTRIN_specCSHIFT, "CSHIFT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (CTIME, - "CTIME", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impCTIME -) -DEFSPEC (DACOSD, +DEFSPEC (FFEINTRIN_specDACOSD, "DACOSD", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (DASIND, +DEFSPEC (FFEINTRIN_specDASIND, "DASIND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (DATAN2D, +DEFSPEC (FFEINTRIN_specDATAN2D, "DATAN2D", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (DATAND, +DEFSPEC (FFEINTRIN_specDATAND, "DATAND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (DATE, - "DATE", - FALSE, - FFEINTRIN_familyVXT, - FFEINTRIN_impDATE -) -DEFSPEC (DATE_AND_TIME, +DEFSPEC (FFEINTRIN_specDATE_AND_TIME, "DATE_AND_TIME", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (DBESJ0, - "DBESJ0", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impDBESJ0 -) -DEFSPEC (DBESJ1, - "DBESJ1", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impDBESJ1 -) -DEFSPEC (DBESJN, - "DBESJN", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impDBESJN -) -DEFSPEC (DBESY0, - "DBESY0", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impDBESY0 -) -DEFSPEC (DBESY1, - "DBESY1", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impDBESY1 -) -DEFSPEC (DBESYN, - "DBESYN", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impDBESYN -) -DEFSPEC (DBLEQ, +DEFSPEC (FFEINTRIN_specDBLEQ, "DBLEQ", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (DCMPLX, +DEFSPEC (FFEINTRIN_specDCMPLX, "DCMPLX", FALSE, - FFEINTRIN_familyFVZ, + FFEINTRIN_familyDCP, FFEINTRIN_impDCMPLX ) -DEFSPEC (DCONJG, +DEFSPEC (FFEINTRIN_specDCONJG, "DCONJG", TRUE, FFEINTRIN_familyFVZ, FFEINTRIN_impDCONJG ) -DEFSPEC (DCOSD, +DEFSPEC (FFEINTRIN_specDCOSD, "DCOSD", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (DERF, +DEFSPEC (FFEINTRIN_specDERF, "DERF", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impDERF ) -DEFSPEC (DERFC, +DEFSPEC (FFEINTRIN_specDERFC, "DERFC", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impDERFC ) -DEFSPEC (DFLOAT, +DEFSPEC (FFEINTRIN_specDFLOAT, "DFLOAT", FALSE, - FFEINTRIN_familyFVZ, - FFEINTRIN_impDFLOAT + FFEINTRIN_familyF2C, + FFEINTRIN_impDBLE ) -DEFSPEC (DFLOTI, +DEFSPEC (FFEINTRIN_specDFLOTI, "DFLOTI", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (DFLOTJ, +DEFSPEC (FFEINTRIN_specDFLOTJ, "DFLOTJ", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impDBLE ) -DEFSPEC (DIGITS, +DEFSPEC (FFEINTRIN_specDIGITS, "DIGITS", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (DIMAG, +DEFSPEC (FFEINTRIN_specDIMAG, "DIMAG", TRUE, FFEINTRIN_familyFVZ, FFEINTRIN_impDIMAG ) -DEFSPEC (DOT_PRODUCT, +DEFSPEC (FFEINTRIN_specDOT_PRODUCT, "DOT_PRODUCT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (DREAL, +DEFSPEC (FFEINTRIN_specDREAL, "DREAL", FALSE, - FFEINTRIN_familyVXT, - FFEINTRIN_impDREAL + FFEINTRIN_familyFVZ, + FFEINTRIN_impDBLE ) -DEFSPEC (DSIND, +DEFSPEC (FFEINTRIN_specDSIND, "DSIND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (DTAND, +DEFSPEC (FFEINTRIN_specDTAND, "DTAND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (DTIME, - "DTIME", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impDTIME -) -DEFSPEC (EOSHIFT, +DEFSPEC (FFEINTRIN_specEOSHIFT, "EOSHIFT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (EPSILON, +DEFSPEC (FFEINTRIN_specEPSILON, "EPSILON", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (ERF, +DEFSPEC (FFEINTRIN_specERF, "ERF", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impERF ) -DEFSPEC (ERFC, +DEFSPEC (FFEINTRIN_specERFC, "ERFC", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impERFC ) -DEFSPEC (ETIME, - "ETIME", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impETIME -) -DEFSPEC (EXIT, +DEFSPEC (FFEINTRIN_specEXIT, "EXIT", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impEXIT ) -DEFSPEC (EXPONENT, +DEFSPEC (FFEINTRIN_specEXPONENT, "EXPONENT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (FDATE, - "FDATE", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impFDATE -) -DEFSPEC (FGETC, - "FGETC", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impFGETC -) -DEFSPEC (FLOATI, +DEFSPEC (FFEINTRIN_specFLOATI, "FLOATI", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (FLOATJ, +DEFSPEC (FFEINTRIN_specFLOATJ, "FLOATJ", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impREAL ) -DEFSPEC (FLOOR, +DEFSPEC (FFEINTRIN_specFLOOR, "FLOOR", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (FLUSH, +DEFSPEC (FFEINTRIN_specFLUSH, "FLUSH", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impFLUSH ) -DEFSPEC (FNUM, - "FNUM", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impFNUM -) -DEFSPEC (FPUTC, - "FPUTC", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impFPUTC -) -DEFSPEC (FRACTION, +DEFSPEC (FFEINTRIN_specFRACTION, "FRACTION", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (FSEEK, +DEFSPEC (FFEINTRIN_specFSEEK, "FSEEK", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impFSEEK ) -DEFSPEC (FSTAT, - "FSTAT", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impFSTAT -) -DEFSPEC (FTELL, +DEFSPEC (FFEINTRIN_specFTELL, "FTELL", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impFTELL ) -DEFSPEC (GERROR, - "GERROR", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impGERROR -) -DEFSPEC (GETARG, +DEFSPEC (FFEINTRIN_specGETARG, "GETARG", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impGETARG ) -DEFSPEC (GETCWD, - "GETCWD", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impGETCWD -) -DEFSPEC (GETENV, +DEFSPEC (FFEINTRIN_specGETENV, "GETENV", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impGETENV ) -DEFSPEC (GETGID, - "GETGID", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impGETGID -) -DEFSPEC (GETLOG, - "GETLOG", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impGETLOG -) -DEFSPEC (GETPID, - "GETPID", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impGETPID -) -DEFSPEC (GETUID, - "GETUID", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impGETUID -) -DEFSPEC (GMTIME, - "GMTIME", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impGMTIME -) -DEFSPEC (HOSTNM, - "HOSTNM", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impHOSTNM -) -DEFSPEC (HUGE, +DEFSPEC (FFEINTRIN_specHUGE, "HUGE", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (IACHAR, +DEFSPEC (FFEINTRIN_specIACHAR, "IACHAR", FALSE, FFEINTRIN_familyASC, FFEINTRIN_impIACHAR ) -DEFSPEC (IAND, +DEFSPEC (FFEINTRIN_specIAND, "IAND", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impIAND ) -DEFSPEC (IARGC, +DEFSPEC (FFEINTRIN_specIARGC, "IARGC", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impIARGC ) -DEFSPEC (IBCLR, +DEFSPEC (FFEINTRIN_specIBCLR, "IBCLR", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impIBCLR ) -DEFSPEC (IBITS, +DEFSPEC (FFEINTRIN_specIBITS, "IBITS", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impIBITS ) -DEFSPEC (IBSET, +DEFSPEC (FFEINTRIN_specIBSET, "IBSET", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impIBSET ) -DEFSPEC (IDATE, - "IDATE (UNIX)", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impIDATE -) -DEFSPEC (IDATEVXT, - "IDATE (VXT)", - FALSE, - FFEINTRIN_familyVXT, - FFEINTRIN_impIDATEVXT -) -DEFSPEC (IEOR, +DEFSPEC (FFEINTRIN_specIEOR, "IEOR", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impIEOR ) -DEFSPEC (IERRNO, - "IERRNO", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impIERRNO -) -DEFSPEC (IIABS, +DEFSPEC (FFEINTRIN_specIIABS, "IIABS", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIAND, +DEFSPEC (FFEINTRIN_specIIAND, "IIAND", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIBCLR, +DEFSPEC (FFEINTRIN_specIIBCLR, "IIBCLR", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIBITS, +DEFSPEC (FFEINTRIN_specIIBITS, "IIBITS", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIBSET, +DEFSPEC (FFEINTRIN_specIIBSET, "IIBSET", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIDIM, +DEFSPEC (FFEINTRIN_specIIDIM, "IIDIM", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIDINT, +DEFSPEC (FFEINTRIN_specIIDINT, "IIDINT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIDNNT, +DEFSPEC (FFEINTRIN_specIIDNNT, "IIDNNT", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIEOR, +DEFSPEC (FFEINTRIN_specIIEOR, "IIEOR", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIFIX, +DEFSPEC (FFEINTRIN_specIIFIX, "IIFIX", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IINT, +DEFSPEC (FFEINTRIN_specIINT, "IINT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIOR, +DEFSPEC (FFEINTRIN_specIIOR, "IIOR", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIQINT, +DEFSPEC (FFEINTRIN_specIIQINT, "IIQINT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IIQNNT, +DEFSPEC (FFEINTRIN_specIIQNNT, "IIQNNT", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IISHFT, +DEFSPEC (FFEINTRIN_specIISHFT, "IISHFT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IISHFTC, +DEFSPEC (FFEINTRIN_specIISHFTC, "IISHFTC", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IISIGN, +DEFSPEC (FFEINTRIN_specIISIGN, "IISIGN", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IMAG, +DEFSPEC (FFEINTRIN_specIMAG, "IMAG", FALSE, FFEINTRIN_familyF2C, - FFEINTRIN_impIMAGPART - ) -DEFSPEC (IMAGPART, - "IMAGPART", - FALSE, - FFEINTRIN_familyGNU, - FFEINTRIN_impIMAGPART + FFEINTRIN_impAIMAG ) -DEFSPEC (IMAX0, +DEFSPEC (FFEINTRIN_specIMAX0, "IMAX0", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IMAX1, +DEFSPEC (FFEINTRIN_specIMAX1, "IMAX1", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IMIN0, +DEFSPEC (FFEINTRIN_specIMIN0, "IMIN0", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IMIN1, +DEFSPEC (FFEINTRIN_specIMIN1, "IMIN1", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IMOD, +DEFSPEC (FFEINTRIN_specIMOD, "IMOD", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (ININT, +DEFSPEC (FFEINTRIN_specININT, "ININT", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (INOT, +DEFSPEC (FFEINTRIN_specINOT, "INOT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (IOR, +DEFSPEC (FFEINTRIN_specIOR, "IOR", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impIOR ) -DEFSPEC (IRAND, - "IRAND", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impIRAND -) -DEFSPEC (ISATTY, - "ISATTY", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impISATTY -) -DEFSPEC (ISHFT, +DEFSPEC (FFEINTRIN_specISHFT, "ISHFT", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impISHFT ) -DEFSPEC (ISHFTC, +DEFSPEC (FFEINTRIN_specISHFTC, "ISHFTC", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impISHFTC ) -DEFSPEC (ITIME, - "ITIME", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impITIME -) -DEFSPEC (IZEXT, +DEFSPEC (FFEINTRIN_specIZEXT, "IZEXT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (JIABS, +DEFSPEC (FFEINTRIN_specJIABS, "JIABS", TRUE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impIABS ) -DEFSPEC (JIAND, +DEFSPEC (FFEINTRIN_specJIAND, "JIAND", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impIAND ) -DEFSPEC (JIBCLR, +DEFSPEC (FFEINTRIN_specJIBCLR, "JIBCLR", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impIBCLR ) -DEFSPEC (JIBITS, +DEFSPEC (FFEINTRIN_specJIBITS, "JIBITS", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impIBITS ) -DEFSPEC (JIBSET, +DEFSPEC (FFEINTRIN_specJIBSET, "JIBSET", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impIBSET ) -DEFSPEC (JIDIM, +DEFSPEC (FFEINTRIN_specJIDIM, "JIDIM", TRUE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impIDIM ) -DEFSPEC (JIDINT, +DEFSPEC (FFEINTRIN_specJIDINT, "JIDINT", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impINT ) -DEFSPEC (JIDNNT, +DEFSPEC (FFEINTRIN_specJIDNNT, "JIDNNT", TRUE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impIDNINT ) -DEFSPEC (JIEOR, +DEFSPEC (FFEINTRIN_specJIEOR, "JIEOR", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impIEOR ) -DEFSPEC (JIFIX, +DEFSPEC (FFEINTRIN_specJIFIX, "JIFIX", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impINT ) -DEFSPEC (JINT, +DEFSPEC (FFEINTRIN_specJINT, "JINT", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impINT ) -DEFSPEC (JIOR, +DEFSPEC (FFEINTRIN_specJIOR, "JIOR", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impIOR ) -DEFSPEC (JIQINT, +DEFSPEC (FFEINTRIN_specJIQINT, "JIQINT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (JIQNNT, +DEFSPEC (FFEINTRIN_specJIQNNT, "JIQNNT", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (JISHFT, +DEFSPEC (FFEINTRIN_specJISHFT, "JISHFT", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impISHFT ) -DEFSPEC (JISHFTC, +DEFSPEC (FFEINTRIN_specJISHFTC, "JISHFTC", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impISHFTC ) -DEFSPEC (JISIGN, +DEFSPEC (FFEINTRIN_specJISIGN, "JISIGN", TRUE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impISIGN ) -DEFSPEC (JMAX0, +DEFSPEC (FFEINTRIN_specJMAX0, "JMAX0", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impMAX0 ) -DEFSPEC (JMAX1, +DEFSPEC (FFEINTRIN_specJMAX1, "JMAX1", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impMAX1 ) -DEFSPEC (JMIN0, +DEFSPEC (FFEINTRIN_specJMIN0, "JMIN0", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impMIN0 ) -DEFSPEC (JMIN1, +DEFSPEC (FFEINTRIN_specJMIN1, "JMIN1", FALSE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impMIN1 ) -DEFSPEC (JMOD, +DEFSPEC (FFEINTRIN_specJMOD, "JMOD", TRUE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impMOD ) -DEFSPEC (JNINT, +DEFSPEC (FFEINTRIN_specJNINT, "JNINT", TRUE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impNINT ) -DEFSPEC (JNOT, +DEFSPEC (FFEINTRIN_specJNOT, "JNOT", TRUE, FFEINTRIN_familyVXT, - FFEINTRIN_impNONE + FFEINTRIN_impNOT ) -DEFSPEC (JZEXT, +DEFSPEC (FFEINTRIN_specJZEXT, "JZEXT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (KILL, - "KILL", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impKILL -) -DEFSPEC (KIND, +DEFSPEC (FFEINTRIN_specKIND, "KIND", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (LBOUND, +DEFSPEC (FFEINTRIN_specLBOUND, "LBOUND", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (LINK, - "LINK", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impLINK -) -DEFSPEC (LEN_TRIM, +DEFSPEC (FFEINTRIN_specLEN_TRIM, "LEN_TRIM", FALSE, FFEINTRIN_familyF90, - FFEINTRIN_impLNBLNK + FFEINTRIN_impNONE ) -DEFSPEC (LNBLNK, - "LNBLNK", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impLNBLNK -) -DEFSPEC (LOC, +DEFSPEC (FFEINTRIN_specLOC, "LOC", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impLOC ) -DEFSPEC (LOGICAL, +DEFSPEC (FFEINTRIN_specLOGICAL, "LOGICAL", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (LONG, - "LONG", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impLONG - ) -DEFSPEC (LSHIFT, +DEFSPEC (FFEINTRIN_specLSHIFT, "LSHIFT", FALSE, FFEINTRIN_familyF2C, FFEINTRIN_impLSHIFT ) -DEFSPEC (LSTAT, - "LSTAT", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impLSTAT -) -DEFSPEC (LTIME, - "LTIME", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impLTIME -) -DEFSPEC (MATMUL, +DEFSPEC (FFEINTRIN_specMATMUL, "MATMUL", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (MAXEXPONENT, +DEFSPEC (FFEINTRIN_specMAXEXPONENT, "MAXEXPONENT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (MAXLOC, +DEFSPEC (FFEINTRIN_specMAXLOC, "MAXLOC", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (MAXVAL, +DEFSPEC (FFEINTRIN_specMAXVAL, "MAXVAL", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (MCLOCK, - "MCLOCK", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impMCLOCK -) -DEFSPEC (MERGE, +DEFSPEC (FFEINTRIN_specMERGE, "MERGE", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (MINEXPONENT, +DEFSPEC (FFEINTRIN_specMINEXPONENT, "MINEXPONENT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (MINLOC, +DEFSPEC (FFEINTRIN_specMINLOC, "MINLOC", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (MINVAL, +DEFSPEC (FFEINTRIN_specMINVAL, "MINVAL", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (MODULO, +DEFSPEC (FFEINTRIN_specMODULO, "MODULO", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (MVBITS, +DEFSPEC (FFEINTRIN_specMVBITS, "MVBITS", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impMVBITS ) -DEFSPEC (NEAREST, +DEFSPEC (FFEINTRIN_specNEAREST, "NEAREST", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (NOT, +DEFSPEC (FFEINTRIN_specNOT, "NOT", FALSE, FFEINTRIN_familyMIL, FFEINTRIN_impNOT ) -DEFSPEC (OR, +DEFSPEC (FFEINTRIN_specOR, "OR", FALSE, FFEINTRIN_familyF2C, - FFEINTRIN_impOR + FFEINTRIN_impIOR ) -DEFSPEC (PACK, +DEFSPEC (FFEINTRIN_specPACK, "PACK", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (PERROR, - "PERROR", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impPERROR -) -DEFSPEC (PRECISION, +DEFSPEC (FFEINTRIN_specPRECISION, "PRECISION", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (PRESENT, +DEFSPEC (FFEINTRIN_specPRESENT, "PRESENT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (PRODUCT, +DEFSPEC (FFEINTRIN_specPRODUCT, "PRODUCT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (QABS, +DEFSPEC (FFEINTRIN_specQABS, "QABS", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QACOS, +DEFSPEC (FFEINTRIN_specQACOS, "QACOS", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QACOSD, +DEFSPEC (FFEINTRIN_specQACOSD, "QACOSD", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QASIN, +DEFSPEC (FFEINTRIN_specQASIN, "QASIN", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QASIND, +DEFSPEC (FFEINTRIN_specQASIND, "QASIND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QATAN, +DEFSPEC (FFEINTRIN_specQATAN, "QATAN", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QATAN2, +DEFSPEC (FFEINTRIN_specQATAN2, "QATAN2", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QATAN2D, +DEFSPEC (FFEINTRIN_specQATAN2D, "QATAN2D", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QATAND, +DEFSPEC (FFEINTRIN_specQATAND, "QATAND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QCOS, +DEFSPEC (FFEINTRIN_specQCOS, "QCOS", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QCOSD, +DEFSPEC (FFEINTRIN_specQCOSD, "QCOSD", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QCOSH, +DEFSPEC (FFEINTRIN_specQCOSH, "QCOSH", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QDIM, +DEFSPEC (FFEINTRIN_specQDIM, "QDIM", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QEXP, +DEFSPEC (FFEINTRIN_specQEXP, "QEXP", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QEXT, +DEFSPEC (FFEINTRIN_specQEXT, "QEXT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QEXTD, +DEFSPEC (FFEINTRIN_specQEXTD, "QEXTD", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QFLOAT, +DEFSPEC (FFEINTRIN_specQFLOAT, "QFLOAT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QINT, +DEFSPEC (FFEINTRIN_specQINT, "QINT", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QLOG, +DEFSPEC (FFEINTRIN_specQLOG, "QLOG", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QLOG10, +DEFSPEC (FFEINTRIN_specQLOG10, "QLOG10", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QMAX1, +DEFSPEC (FFEINTRIN_specQMAX1, "QMAX1", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QMIN1, +DEFSPEC (FFEINTRIN_specQMIN1, "QMIN1", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QMOD, +DEFSPEC (FFEINTRIN_specQMOD, "QMOD", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QNINT, +DEFSPEC (FFEINTRIN_specQNINT, "QNINT", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QSIGN, +DEFSPEC (FFEINTRIN_specQSIGN, "QSIGN", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QSIN, +DEFSPEC (FFEINTRIN_specQSIN, "QSIN", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QSIND, +DEFSPEC (FFEINTRIN_specQSIND, "QSIND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QSINH, +DEFSPEC (FFEINTRIN_specQSINH, "QSINH", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QSQRT, +DEFSPEC (FFEINTRIN_specQSQRT, "QSQRT", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QTAN, +DEFSPEC (FFEINTRIN_specQTAN, "QTAN", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QTAND, +DEFSPEC (FFEINTRIN_specQTAND, "QTAND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (QTANH, +DEFSPEC (FFEINTRIN_specQTANH, "QTANH", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (RADIX, +DEFSPEC (FFEINTRIN_specRADIX, "RADIX", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (RAND, - "RAND", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impRAND -) -DEFSPEC (RANDOM_NUMBER, +DEFSPEC (FFEINTRIN_specRANDOM_NUMBER, "RANDOM_NUMBER", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (RANDOM_SEED, +DEFSPEC (FFEINTRIN_specRANDOM_SEED, "RANDOM_SEED", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (RANGE, +DEFSPEC (FFEINTRIN_specRANGE, "RANGE", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (REALPART, - "REALPART", - FALSE, - FFEINTRIN_familyGNU, - FFEINTRIN_impREALPART - ) -DEFSPEC (RENAME, - "RENAME", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impRENAME -) -DEFSPEC (REPEAT, +DEFSPEC (FFEINTRIN_specREPEAT, "REPEAT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (RESHAPE, +DEFSPEC (FFEINTRIN_specRESHAPE, "RESHAPE", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (RRSPACING, +DEFSPEC (FFEINTRIN_specRRSPACING, "RRSPACING", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (RSHIFT, +DEFSPEC (FFEINTRIN_specRSHIFT, "RSHIFT", FALSE, FFEINTRIN_familyF2C, FFEINTRIN_impRSHIFT ) -DEFSPEC (SCALE, +DEFSPEC (FFEINTRIN_specSCALE, "SCALE", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (SCAN, +DEFSPEC (FFEINTRIN_specSCAN, "SCAN", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (SECNDS, - "SECNDS", - FALSE, - FFEINTRIN_familyVXT, - FFEINTRIN_impSECNDS -) -DEFSPEC (SECONDFUNC, - "SECOND (function)", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impSECONDFUNC -) -DEFSPEC (SECONDSUBR, - "SECOND (subroutine)", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impSECONDSUBR -) -DEFSPEC (SEL_INT_KIND, +DEFSPEC (FFEINTRIN_specSEL_INT_KIND, "SEL_INT_KIND", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (SEL_REAL_KIND, +DEFSPEC (FFEINTRIN_specSEL_REAL_KIND, "SEL_REAL_KIND", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (SET_EXPONENT, +DEFSPEC (FFEINTRIN_specSET_EXPONENT, "SET_EXPONENT", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (SHAPE, +DEFSPEC (FFEINTRIN_specSHAPE, "SHAPE", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (SHORT, - "SHORT", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impSHORT - ) -DEFSPEC (SIGNAL, +DEFSPEC (FFEINTRIN_specSIGNAL, "SIGNAL", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impSIGNAL ) -DEFSPEC (SIND, +DEFSPEC (FFEINTRIN_specSIND, "SIND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (SLEEP, - "SLEEP", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impSLEEP -) -DEFSPEC (SNGLQ, +DEFSPEC (FFEINTRIN_specSNGLQ, "SNGLQ", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (SPACING, +DEFSPEC (FFEINTRIN_specSPACING, "SPACING", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (SPREAD, +DEFSPEC (FFEINTRIN_specSPREAD, "SPREAD", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (SRAND, - "SRAND", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impSRAND -) -DEFSPEC (STAT, - "STAT", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impSTAT -) -DEFSPEC (SUM, +DEFSPEC (FFEINTRIN_specSUM, "SUM", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (SYMLNK, - "SYMLNK", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impSYMLNK -) -DEFSPEC (SYSTEM, +DEFSPEC (FFEINTRIN_specSYSTEM, "SYSTEM", FALSE, FFEINTRIN_familyF2U, FFEINTRIN_impSYSTEM ) -DEFSPEC (SYSTEM_CLOCK, +DEFSPEC (FFEINTRIN_specSYSTEM_CLOCK, "SYSTEM_CLOCK", FALSE, FFEINTRIN_familyF90, - FFEINTRIN_impSYSTEM_CLOCK + FFEINTRIN_impNONE ) -DEFSPEC (TAND, +DEFSPEC (FFEINTRIN_specTAND, "TAND", TRUE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (TIME, - "TIME (UNIX)", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impTIME -) -DEFSPEC (TIMEVXT, - "TIME (VXT)", - FALSE, - FFEINTRIN_familyVXT, - FFEINTRIN_impTIMEVXT -) -DEFSPEC (TINY, +DEFSPEC (FFEINTRIN_specTINY, "TINY", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (TRANSFER, +DEFSPEC (FFEINTRIN_specTRANSFER, "TRANSFER", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (TRANSPOSE, +DEFSPEC (FFEINTRIN_specTRANSPOSE, "TRANSPOSE", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (TRIM, +DEFSPEC (FFEINTRIN_specTRIM, "TRIM", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (TTYNAM, - "TTYNAM", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impTTYNAM -) -DEFSPEC (UBOUND, +DEFSPEC (FFEINTRIN_specUBOUND, "UBOUND", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (UMASK, - "UMASK", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impUMASK -) -DEFSPEC (UNLINK, - "UNLINK", - FALSE, - FFEINTRIN_familyF2U, - FFEINTRIN_impUNLINK -) -DEFSPEC (UNPACK, +DEFSPEC (FFEINTRIN_specUNPACK, "UNPACK", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (VERIFY, +DEFSPEC (FFEINTRIN_specVERIFY, "VERIFY", FALSE, FFEINTRIN_familyF90, FFEINTRIN_impNONE ) -DEFSPEC (XOR, +DEFSPEC (FFEINTRIN_specXOR, "XOR", FALSE, FFEINTRIN_familyF2C, - FFEINTRIN_impXOR + FFEINTRIN_impIEOR ) -DEFSPEC (ZABS, +DEFSPEC (FFEINTRIN_specZABS, "ZABS", TRUE, - FFEINTRIN_familyF2C, + FFEINTRIN_familyF2Z, FFEINTRIN_impCDABS ) -DEFSPEC (ZCOS, +DEFSPEC (FFEINTRIN_specZCOS, "ZCOS", TRUE, - FFEINTRIN_familyF2C, + FFEINTRIN_familyF2Z, FFEINTRIN_impCDCOS ) -DEFSPEC (ZEXP, +DEFSPEC (FFEINTRIN_specZEXP, "ZEXP", TRUE, - FFEINTRIN_familyF2C, + FFEINTRIN_familyF2Z, FFEINTRIN_impCDEXP ) -DEFSPEC (ZEXT, +DEFSPEC (FFEINTRIN_specZEXT, "ZEXT", FALSE, FFEINTRIN_familyVXT, FFEINTRIN_impNONE ) -DEFSPEC (ZLOG, +DEFSPEC (FFEINTRIN_specZLOG, "ZLOG", TRUE, - FFEINTRIN_familyF2C, + FFEINTRIN_familyF2Z, FFEINTRIN_impCDLOG ) -DEFSPEC (ZSIN, +DEFSPEC (FFEINTRIN_specZSIN, "ZSIN", TRUE, - FFEINTRIN_familyF2C, + FFEINTRIN_familyF2Z, FFEINTRIN_impCDSIN ) -DEFSPEC (ZSQRT, +DEFSPEC (FFEINTRIN_specZSQRT, "ZSQRT", TRUE, - FFEINTRIN_familyF2C, + FFEINTRIN_familyF2Z, FFEINTRIN_impCDSQRT ) -DEFSPEC (NONE, +DEFSPEC (FFEINTRIN_specNONE, "none", FALSE, FFEINTRIN_familyNONE, @@ -2691,11 +2251,7 @@ DEFSPEC (NONE, no need to complain about ambiguity if two different-typed intrinsic run-time implementations have the same compile-time implementation, as long as there's a straightforward way of determining which was - meant (done by ffeintrin_fulfill_generic). (Here `the same code at - compile time' may be the default dispatch defined by the - DEFIMP/DEFIMQ signatures -- see com.c.) Fixme: Note that - currently, DEFIMQs have to be a subroutine or function to match - what the corresponding DEFIMP of the same name is. */ + meant (done by ffeintrin_fulfill_generic). */ /* The control string has the following format: @@ -2703,7 +2259,7 @@ DEFSPEC (NONE, is: - [] + is: @@ -2721,19 +2277,11 @@ DEFSPEC (NONE, is: - Subroutine - = Decided by COL + 0 Decided by COL 1 (Default) - 2 (Twice the size of 1) - 3 (Same size as CHARACTER*1) - 4 (Twice the size of 2) - 6 (Twice the size as 3) + 2 (COMPLEX*16, INTEGER*1, LOGICAL*1, REAL*8) + 3 (INTEGER*2, LOGICAL*2) C Like 1 (F77), except (F90), if COL is COMPLEX, uses kind type of COL - p ffecom_pointer_kind_ - - is: - - * Valid for of `A' only, means program may - declare any length for return value, default being (*) is: @@ -2741,13 +2289,13 @@ DEFSPEC (NONE, is: - - No COL (return-base-type and return-kind-type must be definitive) - * All arguments form COL (must have more than one argument) - n Argument n (0 for first arg, 1 for second, etc.) forms COL + - No COL + * All arguments form COL + 1 Argument 1 forms COL is: - =[][][][] + =[][] is the standard keyword name for the argument. @@ -2756,14 +2304,14 @@ DEFSPEC (NONE, ? Argument is optional ! Like ?, but argument must be omitted if previous arg was COMPLEX + One or more of these arguments must be specified - * Zero or more of these arguments must be specified - n Numbered names for arguments, one or more must be specified - p Like n, but two or more must be specified + * Zero or more of these arguments may be specified + n Numbered names for arguments, one or more may be specified + p Like n, but two or more may be specified is: - - Any is valid (arg-kind-type is 0) - A Character*(*) + - Any is valid (but see arg-kind-type) + A Character C Complex I Integer L Logical @@ -2771,46 +2319,34 @@ DEFSPEC (NONE, B Boolean (I or L) F Floating-point (C or R) N Numeric (C, I, or R) - S Scalar numeric (I or R) - g GOTO label (alternate-return form of CALL) (arg-kind-type is 0) - s Signal handler (INTEGER FUNCTION, SUBROUTINE or dummy/global - default INTEGER variable) (arg-kind-type is 0) + S Scalar numeric (I or R; C mapped to R) is: - * Any is valid + 0 Any is valid 1 (Default) - 2 (Twice the size of 1) - 3 (Same size as CHARACTER*1) - 4 (Twice the size of 2) - 6 (Twice the size as 3) + 2 (COMPLEX*16, INTEGER*1, LOGICAL*1, REAL*8) + 3 (INTEGER*2, LOGICAL*2) A Same as first argument - - is: - - (Default) CHARACTER*(*) - [n] CHARACTER*n - - is: - - (default) Rank-0 (variable or array element) - (n) Rank-1 array n elements long - & Any (arg-extra is &) + g GOTO label (alternate-return form of CALL) + s Signal handler (INTEGER FUNCTION, SUBROUTINE or dummy/global + default INTEGER variable) (arg-base-type * only) is: - (default) Arg is INTENT(IN) - i Arg's attributes are all that matter (inquiry function) + (default) Arg is (scalar) variable or constant + & Arg can have its address taken (LOC(), for example) + g GOTO label (alternate-return form of CALL) + s Signal handler (see ) w Arg is INTENT(OUT) x Arg is INTENT(INOUT) - & Arg can have its address taken (LOC(), for example) */ -DEFIMP (ABS, "ABS", ABS, "S=:0:A=N*") -DEFIMP (ACOS, "ACOS", ACOS, "R=:0:X=R*") -DEFIMP (AIMAG, "AIMAG", AIMAG, "RC:0:Z=C*") -DEFIMP (AINT, "AINT", AINT, "R=:0:A=R*") +DEFIMP (ABS, "ABS", ABS, "S0:*:A=N0") +DEFIMP (ACOS, "ACOS", ACOS, "R0:*:X=R0") +DEFIMP (AIMAG, "AIMAG", AIMAG, "R0:*:Z=C0") +DEFIMP (AINT, "AINT", AINT, "R0:*:A=R0") DEFIMQ (ALOG, "ALOG", ALOG, "R1:-:X=R1", LOG) DEFIMQ (ALOG10, "ALOG10", ALOG10, "R1:-:X=R1", @@ -2825,23 +2361,23 @@ DEFIMQ (AMIN1, "AMIN1", , "R1:*:A=pR1", MIN) DEFIMQ (AMOD, "AMOD", AMOD, "R1:*:A=R1,P=R1", MOD) -DEFIMP (ANINT, "ANINT", ANINT, "R=:0:A=R*") -DEFIMP (ASIN, "ASIN", ASIN, "R=:0:X=R*") -DEFIMP (ATAN, "ATAN", ATAN, "R=:0:X=R*") -DEFIMP (ATAN2, "ATAN2", ATAN2, "R=:*:Y=R*,X=R*") +DEFIMP (ANINT, "ANINT", ANINT, "R0:*:A=R0") +DEFIMP (ASIN, "ASIN", ASIN, "R0:*:X=R0") +DEFIMP (ATAN, "ATAN", ATAN, "R0:*:X=R0") +DEFIMP (ATAN2, "ATAN2", ATAN2, "R0:*:Y=R0,X=R0") DEFIMQ (CABS, "CABS", CABS, "R1:-:A=C1", ABS) DEFIMQ (CCOS, "CCOS", CCOS, "C1:-:X=C1", COS) DEFIMQ (CEXP, "CEXP", CEXP, "C1:-:X=C1", EXP) -DEFIMP (CHAR, "CHAR", , "A1:-:I=I*") +DEFIMP (CHAR, "CHAR", , "A1:-:I=I0") DEFIMQ (CLOG, "CLOG", CLOG, "C1:-:X=C1", LOG) -DEFIMP (CMPLX, "CMPLX", , "C1:*:X=N*,Y=!S*") -DEFIMP (CONJG, "CONJG", CONJG, "C=:0:Z=C*") -DEFIMP (COS, "COS", COS, "F=:0:X=F*") -DEFIMP (COSH, "COSH", COSH, "R=:0:X=R*") +DEFIMP (CMPLX, "CMPLX", , "C1:*:X=N0,Y=!S0") +DEFIMP (CONJG, "CONJG", CONJG, "C0:*:Z=C0") +DEFIMP (COS, "COS", COS, "F0:*:X=F0") +DEFIMP (COSH, "COSH", COSH, "R0:*:X=R0") DEFIMQ (CSIN, "CSIN", CSIN, "C1:-:X=C1", SIN) DEFIMQ (CSQRT, "CSQRT", CSQRT, "C1:-:X=C1", @@ -2856,8 +2392,8 @@ DEFIMQ (DATAN, "DATAN", DATAN, "R2:-:X=R2", ATAN) DEFIMQ (DATAN2, "DATAN2", DATAN2, "R2:*:Y=R2,X=R2", ATAN2) -DEFIMP (DBLE, "DBLE", , "R2:-:A=N*") -DEFIMQ (DCMPLX, "DCMPLX", , "C2:*:X=N*,Y=!S*", +DEFIMP (DBLE, "DBLE", , "R2:-:A=N0") +DEFIMQ (DCMPLX, "DCMPLX", , "C2:*:X=N0,Y=!S0", CMPLX) DEFIMQ (DCOS, "DCOS", DCOS, "R2:-:X=R2", COS) @@ -2867,7 +2403,7 @@ DEFIMQ (DDIM, "DDIM", DDIM, "R2:*:X=R2,Y=R2", DIM) DEFIMQ (DEXP, "DEXP", DEXP, "R2:-:X=R2", EXP) -DEFIMP (DIM, "DIM", DIM, "S=:*:X=S*,Y=S*") +DEFIMP (DIM, "DIM", DIM, "S0:*:X=S0,Y=S0") DEFIMQ (DINT, "DINT", DINT, "R2:-:A=R2", AINT) DEFIMQ (DLOG, "DLOG", DLOG, "R2:-:X=R2", @@ -2895,32 +2431,27 @@ DEFIMQ (DTAN, "DTAN", DTAN, "R2:-:X=R2", TAN) DEFIMQ (DTANH, "DTANH", DTANH, "R2:-:X=R2", TANH) -DEFIMP (EXP, "EXP", EXP, "F=:0:X=F*") -DEFIMQ (FLOAT, "FLOAT", , "R1:-:A=I*", - REAL) +DEFIMP (EXP, "EXP", EXP, "F0:*:X=F0") DEFIMQ (IABS, "IABS", IABS, "I1:-:A=I1", ABS) -DEFIMP (ICHAR, "ICHAR", , "I1:-:C=A*") +DEFIMP (ICHAR, "ICHAR", , "I1:-:C=A0") DEFIMQ (IDIM, "IDIM", IDIM, "I1:*:X=I1,Y=I1", DIM) -DEFIMQ (IDINT, "IDINT", , "I1:-:A=R2", - INT) DEFIMQ (IDNINT, "IDNINT", IDNINT, "I1:-:A=R2", NINT) -DEFIMP (INDEX, "INDEX", INDEX, "I1:*:String=A*,Substring=A*") -DEFIMP (INT, "INT", , "I1:-:A=N*") +DEFIMP (INDEX, "INDEX", INDEX, "I1:*:String=A0,Substring=A0") +DEFIMP (INT, "INT", , "I1:-:A=N0") DEFIMQ (ISIGN, "ISIGN", ISIGN, "I1:*:A=I1,B=I1", SIGN) -DEFIMP (LEN, "LEN", LEN, "I1:-:String=A*i") +DEFIMP (LEN, "LEN", LEN, "I1:-:String=A0") DEFIMP (LGE, "LGE", LGE, "L1:*:String_A=A1,String_B=A1") DEFIMP (LGT, "LGT", LGT, "L1:*:String_A=A1,String_B=A1") DEFIMP (LLE, "LLE", LLE, "L1:*:String_A=A1,String_B=A1") DEFIMP (LLT, "LLT", LLT, "L1:*:String_A=A1,String_B=A1") -DEFIMP (LOG, "LOG", , "F=:0:X=F*") -DEFIMP (LOG10, "LOG10", , "R=:0:X=R*") -DEFIMP (LONG, "LONG", , "I1:-:A=I*") -DEFIMP (MAX, "MAX", , "S=:*:A=pS*") -DEFIMP (MIN, "MIN", , "S=:*:A=pS*") +DEFIMP (LOG, "LOG", , "F0:*:X=F0") +DEFIMP (LOG10, "LOG10", , "R0:*:X=R0") +DEFIMP (MAX, "MAX", , "S0:*:A=pS0") +DEFIMP (MIN, "MIN", , "S0:*:A=pS0") DEFIMQ (MAX0, "MAX0", , "I1:*:A=pI1", MAX) DEFIMQ (MAX1, "MAX1", , "I1:*:A=pR1", @@ -2929,30 +2460,21 @@ DEFIMQ (MIN0, "MIN0", , "I1:*:A=pI1", MIN) DEFIMQ (MIN1, "MIN1", , "I1:*:A=pR1", MIN) -DEFIMP (MOD, "MOD", MOD, "S=:*:A=S*,P=S*") -DEFIMP (NINT, "NINT", NINT, "I1:-:A=R*") -DEFIMP (REAL, "REAL", , "RC:0:A=N*") -DEFIMP (SIGN, "SIGN", SIGN, "S=:*:A=S*,B=S*") -DEFIMP (SIN, "SIN", SIN, "F=:0:X=F*") -DEFIMP (SINH, "SINH", SINH, "R=:0:X=R*") -DEFIMQ (SNGL, "SNGL", , "R1:-:A=R2", - REAL) -DEFIMP (SQRT, "SQRT", SQRT, "F=:0:X=F*") -DEFIMP (TAN, "TAN", TAN, "R=:0:X=R*") -DEFIMP (TANH, "TANH", TANH, "R=:0:X=R*") +DEFIMP (MOD, "MOD", MOD, "S0:*:A=S0,P=S0") +DEFIMP (NINT, "NINT", NINT, "I1:-:A=R0") +DEFIMP (REAL, "REAL", , "RC:*:A=N0") +DEFIMP (SIGN, "SIGN", SIGN, "S0:*:A=S0,B=S0") +DEFIMP (SIN, "SIN", SIN, "F0:*:X=F0") +DEFIMP (SINH, "SINH", SINH, "R0:*:X=R0") +DEFIMP (SQRT, "SQRT", SQRT, "F0:*:X=F0") +DEFIMP (TAN, "TAN", TAN, "R0:*:X=R0") +DEFIMP (TANH, "TANH", TANH, "R0:*:X=R0") DEFIMP (ABORT, "ABORT", ABORT, "--:-:") -DEFIMP (ACCESS, "ACCESS", ACCESS, "I1:-:Name=A1,Mode=A1") -DEFIMP (ACHAR, "ACHAR", , "A1:-:I=I*") -DEFIMP (AND, "AND", , "B=:*:I=B*,J=B*") -DEFIMP (BESJ0, "BESJ0", BESJ0, "R=:0:X=R*") -DEFIMP (BESJ1, "BESJ1", BESJ1, "R=:0:X=R*") -DEFIMP (BESJN, "BESJN", BESJN, "R=:1:N=I*,X=R*") -DEFIMP (BESY0, "BESY0", BESY0, "R=:0:X=R*") -DEFIMP (BESY1, "BESY1", BESY1, "R=:0:X=R*") -DEFIMP (BESYN, "BESYN", BESYN, "R=:1:N=I*,X=R*") -DEFIMP (BIT_SIZE, "BIT_SIZE", , "I=:0:I=I*i") -DEFIMP (BTEST, "BTEST", , "L1:*:I=I*,Pos=I*") +DEFIMP (ACHAR, "ACHAR", , "A1:-:I=I0") +DEFIMP (AND, "AND", , "B0:*:I=B0,J=B0") +DEFIMP (BIT_SIZE, "BIT_SIZE", , "I0:*:I=I0") +DEFIMP (BTEST, "BTEST", , "L1:*:I=I0,Pos=I0") DEFIMQ (CDABS, "CDABS", CDABS, "R2:-:A=C2", ABS) DEFIMQ (CDCOS, "CDCOS", CDCOS, "C2:-:X=C2", @@ -2965,109 +2487,40 @@ DEFIMQ (CDSIN, "CDSIN", CDSIN, "C2:-:X=C2", SIN) DEFIMQ (CDSQRT, "CDSQRT", CDSQRT, "C2:-:X=C2", SQRT) -DEFIMP (CHDIR, "CHDIR", CHDIR, "--:-:Dir=A1,Status=?I1w") -DEFIMP (CHMOD, "CHMOD", CHMOD, "--:-:Name=A1,Mode=A1,Status=?I*w") -DEFIMP (COMPLEX, "COMPLEX", , "C=:*:Real=S*,Imag=S*") -DEFIMP (CTIME, "CTIME", CTIME, "A1*:-:STime=I2") -DEFIMP (DATE, "DATE", DATE, "--:-:Date=A1w") -DEFIMQ (DBESJ0, "DBESJ0", DBESJ0, "R2:-:X=R2", - BESJ0) -DEFIMQ (DBESJ1, "DBESJ1", DBESJ1, "R2:-:X=R2", - BESJ1) -DEFIMQ (DBESJN, "DBESJN", DBESJN, "R2:-:N=I*,X=R2", - BESJN) -DEFIMQ (DBESY0, "DBESY0", DBESY0, "R2:-:X=R2", - BESY0) -DEFIMQ (DBESY1, "DBESY1", DBESY1, "R2:-:X=R2", - BESY1) -DEFIMQ (DBESYN, "DBESYN", DBESYN, "R2:-:N=I*,X=R2", - BESYN) DEFIMQ (DCONJG, "DCONJG", DCONJG, "C2:-:Z=C2", CONJG) DEFIMQ (DERF, "DERF", DERF, "R2:-:X=R2", ERF) DEFIMQ (DERFC, "DERFC", DERFC, "R2:-:X=R2", ERFC) -DEFIMQ (DFLOAT, "DFLOAT", , "R2:-:A=I*", - REAL) DEFIMQ (DIMAG, "DIMAG", DIMAG, "R2:-:Z=C2", AIMAG) -DEFIMQ (DREAL, "DREAL", , "R2:-:A=N*", - REAL) -DEFIMP (DTIME, "DTIME", DTIME, "R1:-:TArray=R1(2)w") -DEFIMP (ERF, "ERF", ERF, "R=:0:X=R*") -DEFIMP (ERFC, "ERFC", ERFC, "R=:0:X=R*") -DEFIMP (ETIME, "ETIME", ETIME, "R1:-:TArray=R1(2)w") -DEFIMP (EXIT, "EXIT", EXIT, "--:-:Status=?I*") -DEFIMP (FDATE, "FDATE", FDATE, "A1*:-:") -DEFIMP (FGET, "FGET", FGET, "--:-:C=A1w,Status=?I*w") -DEFIMP (FGETC, "FGETC", FGETC, "--:-:Unit=I*,C=A1w,Status=I*w") -DEFIMP (FLUSH, "FLUSH", FLUSH, "--:-:Unit=?I*") -DEFIMP (FNUM, "FNUM", FNUM, "I1:-:Unit=I*") -DEFIMP (FPUT, "FPUT", FPUT, "--:-:C=A1,Status=?I*w") -DEFIMP (FPUTC, "FPUTC", FPUTC, "--:-:Unit=I*,C=A1,Status=I*w") -DEFIMP (FSEEK, "FSEEK", FSEEK, "--:-:Unit=I*,Offset=I*,Whence=I*,ErrLab=?g*") -DEFIMP (FSTAT, "FSTAT", FSTAT, "I1:-:Unit=I*,SArray=I1(13)w") -DEFIMP (FTELL, "FTELL", FTELL, "I1:-:Unit=I*") -DEFIMP (GERROR, "GERROR", GERROR, "--:-:Message=A1w") -DEFIMP (GETARG, "GETARG", GETARG, "--:-:Pos=I*,Value=A1w") -DEFIMP (GETCWD, "GETCWD", GETCWD, "I1:-:Name=A1w") -DEFIMP (GETGID, "GETGID", GETGID, "I1:-:") -DEFIMP (GETLOG, "GETLOG", GETLOG, "--:-:Login=A1w") -DEFIMP (GETPID, "GETPID", GETPID, "I1:-:") -DEFIMP (GETUID, "GETUID", GETUID, "I1:-:") +DEFIMP (ERF, "ERF", ERF, "R0:-:X=R0") +DEFIMP (ERFC, "ERFC", ERFC, "R0:-:X=R0") +DEFIMP (EXIT, "EXIT", EXIT, "--:-:Status=?I0") +DEFIMP (FLUSH, "FLUSH", FLUSH, "--:-:Unit=?I0") +DEFIMP (FSEEK, "FSEEK", FSEEK, "--:-:Unit=I0,Offset=I0,Whence=I0,ErrLab=?-gg") +DEFIMP (FTELL, "FTELL", FTELL, "I1:-:Unit=?I0") +DEFIMP (GETARG, "GETARG", GETARG, "--:-:Pos=I0,Value=A1w") DEFIMP (GETENV, "GETENV", GETENV, "--:-:Name=A1,Value=A1w") -DEFIMP (GMTIME, "GMTIME", GMTIME, "--:-:STime=I1,TArray=I1(9)w") -DEFIMP (HOSTNM, "HOSTNM", HOSTNM, "I1:-:Name=A1w") -DEFIMP (IACHAR, "IACHAR", , "I1:-:C=A*") -DEFIMP (IAND, "IAND", , "I=:*:I=I*,J=I*") +DEFIMP (IACHAR, "IACHAR", , "I1:-:C=A0") +DEFIMP (IAND, "IAND", , "I0:*:I=I0,J=I0") DEFIMP (IARGC, "IARGC", IARGC, "I1:-:") -DEFIMP (IBCLR, "IBCLR", , "I=:0:I=I*,Pos=I*") -DEFIMP (IBITS, "IBITS", , "I=:0:I=I*,Pos=I*,Len=I*") -DEFIMP (IBSET, "IBSET", , "I=:0:I=I*,Pos=I*") -DEFIMP (IDATE, "IDATE (UNIX)", IDATE, "--:-:TArray=I1(3)w") -DEFIMP (IDATEVXT, "IDATE (VXT)", VXTIDATE, "--:-:D=I1w,M=I1w,Y=I1w") -DEFIMP (IEOR, "IEOR", , "I=:*:I=I*,J=I*") -DEFIMP (IOR, "IOR", , "I=:*:I=I*,J=I*") -DEFIMP (IERRNO, "IERRNO", IERRNO, "I1:-:") -DEFIMQ (IMAGPART, "IMAGPART", , "R=:0:Z=C*", - AIMAG) -DEFIMP (IRAND, "IRAND", IRAND, "I1:-:Flag=?I*") -DEFIMP (ISATTY, "ISATTY", ISATTY, "L1:-:Unit=I*") -DEFIMP (ISHFT, "ISHFT", , "I=:0:I=I*,Shift=I*") -DEFIMP (ISHFTC, "ISHFTC", , "I=:0:I=I*,Shift=I*,Size=I*") -DEFIMP (ITIME, "ITIME", ITIME, "--:-:TArray=I1(3)w") -DEFIMP (KILL, "KILL", KILL, "--:-:Pid=I*,Signal=I*,Status=?I*w") -DEFIMP (LINK, "LINK", LINK, "--:-:Path1=A1,Path2=A1,Status=?I*w") -DEFIMP (LNBLNK, "LNBLNK", LNBLNK, "I1:-:String=A1") -DEFIMP (LSTAT, "LSTAT", LSTAT, "I1:-:File=A1,SArray=I1(13)w") -DEFIMP (LTIME, "LTIME", LTIME, "--:-:STime=I1,TArray=I1(9)w") -DEFIMP (LOC, "LOC", , "Ip:-:Entity=-*&&") -DEFIMP (LSHIFT, "LSHIFT", , "I=:0:I=I*,Shift=I*") -DEFIMP (MCLOCK, "MCLOCK", MCLOCK, "I2:-:") -DEFIMP (MVBITS, "MVBITS", , "--:-:From=I*,FromPos=I*,Len=I*,TO=IAx,ToPos=I*") -DEFIMP (NOT, "NOT", , "I=:0:I=I*") -DEFIMP (OR, "OR", , "B=:*:I=B*,J=B*") -DEFIMP (PERROR, "PERROR", PERROR, "--:-:String=A1") -DEFIMP (RAND, "RAND", RAND, "R1:-:Flag=?I*") -DEFIMP (REALPART, "REALPART", , "R=:0:Z=C*") -DEFIMP (RENAME, "RENAME", RENAME, "--:-:Path1=A1,Path2=A1,Status=?I*w") -DEFIMP (RSHIFT, "RSHIFT", , "I=:0:I=I*,Shift=I*") -DEFIMP (SECNDS, "SECNDS", SECNDS, "R1:-:T=R1") -DEFIMP (SECONDFUNC, "SECOND (function)", SECOND, "R1:-:") -DEFIMP (SECONDSUBR, "SECOND (subroutine)", SECOND, "--:-:Seconds=R1w") -DEFIMP (SHORT, "SHORT", , "I6:-:A=I*") -DEFIMP (SIGNAL, "SIGNAL", , "--:-:Number=I*,Handler=s*") -DEFIMP (SLEEP, "SLEEP", SLEEP, "--:-:Seconds=I1") -DEFIMP (SRAND, "SRAND", SRAND, "--:-:Seed=I*") -DEFIMP (STAT, "STAT", STAT, "I1:-:File=A1,SArray=I1(13)w") -DEFIMP (SYMLNK, "SYMLNK", SYMLNK, "--:-:Path1=A1,Path2=A1,Status=?I*w") -DEFIMP (SYSTEM, "SYSTEM", SYSTEM, "--:-:Command=A1,Status=?I1") -DEFIMP (SYSTEM_CLOCK, "SYSTEM_CLOCK", SYSTEM_CLOCK, "--:-:Count=I1w,Rate=I1w,Max=I1w") -DEFIMP (TIME, "TIME (UNIX)", TIME, "I2:-:") -DEFIMP (TIMEVXT, "TIME (VXT)", VXTTIME, "--:-:Time=A1[8]w") -DEFIMP (TTYNAM, "TTYNAM", TTYNAM, "A1*:-:Unit=I*") -DEFIMP (UMASK, "UMASK", UMASK, "--:-:Mask=I*,Old=?I*w") -DEFIMP (UNLINK, "UNLINK", UNLINK, "--:-:File=A1,Status=?I1w") -DEFIMP (XOR, "XOR", , "B=:*:I=B*,J=B*") +DEFIMP (IBCLR, "IBCLR", , "I0:1:I=I0,Pos=I0") +DEFIMP (IBITS, "IBITS", , "I0:1:I=I0,Pos=I0,Len=I0") +DEFIMP (IBSET, "IBSET", , "I0:1:I=I0,Pos=I0") +DEFIMP (IEOR, "IEOR", , "I0:*:I=I0,J=I0") +DEFIMP (IOR, "IOR", , "I0:*:I=I0,J=I0") +DEFIMP (ISHFT, "ISHFT", , "I0:1:I=I0,Shift=I0") +DEFIMP (ISHFTC, "ISHFTC", , "I0:1:I=I0,Shift=I0,Size=I0") +DEFIMP (LOC, "LOC", , "I1:-:Variable=-0&") +DEFIMP (LSHIFT, "LSHIFT", , "I0:1:I=I0,Shift=I0") +DEFIMP (MVBITS, "MVBITS", , "--:-:From=I0,FromPos=I0,Len=I0,TO=IAx,ToPos=I0") +DEFIMP (NOT, "NOT", , "I0:*:I=I0") +DEFIMP (OR, "OR", , "B0:*:I=B0,J=B0") +DEFIMP (RSHIFT, "RSHIFT", , "I0:1:I=I0,Shift=I0") +DEFIMP (SIGNAL, "SIGNAL", , "--:-:Number=I0,Handler=-ss") +DEFIMP (SYSTEM, "SYSTEM", , "--:-:Command=A1,Status=?I1") +DEFIMP (XOR, "XOR", , "B0:*:I=B0,J=B0") DEFIMP (NONE, "none", , "") + diff --git a/gnu/usr.bin/gcc/f/intrin.h b/gnu/usr.bin/gcc/f/intrin.h index fd5cbfed037..16564d22d3d 100644 --- a/gnu/usr.bin/gcc/f/intrin.h +++ b/gnu/usr.bin/gcc/f/intrin.h @@ -1,5 +1,5 @@ /* intrin.h -- Public interface for intrin.c - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -24,21 +24,18 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef _H_f_intrin #define _H_f_intrin -#ifndef FFEINTRIN_DOC -#define FFEINTRIN_DOC 0 /* 1 means intrinsic documentation only (intdoc.c). */ -#endif - typedef enum { FFEINTRIN_familyNONE, /* Not in any family. */ FFEINTRIN_familyF77, /* ANSI FORTRAN 77. */ - FFEINTRIN_familyGNU, /* GNU Fortran intrinsics. */ - FFEINTRIN_familyF2C, /* f2c intrinsics. */ + FFEINTRIN_familyASC, /* ASCII-related (ACHAR, IACHAR). */ + FFEINTRIN_familyMIL, /* MIL STD 1753 (MVBITS, etc). */ + FFEINTRIN_familyDCP, /* Unnamed DOUBLE COMPLEX intrinsics. */ FFEINTRIN_familyF90, /* Fortran 90. */ FFEINTRIN_familyVXT, /* VAX/VMS FORTRAN. */ - FFEINTRIN_familyMIL, /* MIL STD 1753 (MVBITS, etc), in mil, vxt, and f90. */ - FFEINTRIN_familyASC, /* ASCII-related (ACHAR, IACHAR), both f2c and f90. */ - FFEINTRIN_familyFVZ, /* in both f2c and VAX/VMS FORTRAN. */ + FFEINTRIN_familyFVZ, /* f2c, VAX/VMS DOUBLE COMPLEX intrinsics. */ + FFEINTRIN_familyF2C, /* f2c intrinsics. */ + FFEINTRIN_familyF2Z, /* f2c DOUBLE COMPLEX intrinsics. */ FFEINTRIN_familyF2U, /* libf2c/libU77 UNIX system intrinsics. */ FFEINTRIN_family, } ffeintrinFamily; @@ -46,7 +43,7 @@ typedef enum typedef enum { #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) -#define DEFGEN(CODE,NAME,SPEC1,SPEC2) FFEINTRIN_gen ## CODE, +#define DEFGEN(CODE,NAME,SPEC1,SPEC2) CODE, #define DEFSPEC(CODE,NAME,CALLABLE,FAMILY,IMP) #define DEFIMP(CODE,NAME,GFRT,CONTROL) #define DEFIMQ(CODE,NAME,GFRT,CONTROL,CGIMP) @@ -63,7 +60,7 @@ typedef enum { #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) #define DEFGEN(CODE,NAME,SPEC1,SPEC2) -#define DEFSPEC(CODE,NAME,CALLABLE,FAMILY,IMP) FFEINTRIN_spec ## CODE, +#define DEFSPEC(CODE,NAME,CALLABLE,FAMILY,IMP) CODE, #define DEFIMP(CODE,NAME,GFRT,CONTROL) #define DEFIMQ(CODE,NAME,GFRT,CONTROL,CGIMP) #include "intrin.def" @@ -91,8 +88,6 @@ typedef enum FFEINTRIN_imp } ffeintrinImp; -#if !FFEINTRIN_DOC - #include "bld.h" #include "info.h" @@ -100,8 +95,7 @@ ffeinfoBasictype ffeintrin_basictype (ffeintrinSpec spec); ffeintrinImp ffeintrin_codegen_imp (ffeintrinImp imp); ffeintrinFamily ffeintrin_family (ffeintrinSpec spec); void ffeintrin_fulfill_generic (ffebld *expr, ffeinfo *info, ffelexToken t); -void ffeintrin_fulfill_specific (ffebld *expr, ffeinfo *info, - bool *check_intrin, ffelexToken t); +void ffeintrin_fulfill_specific (ffebld *expr, ffeinfo *info, ffelexToken t); #if FFECOM_targetCURRENT == FFECOM_targetGCC ffecomGfrt ffeintrin_gfrt (ffeintrinImp imp); #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */ @@ -113,7 +107,7 @@ void ffeintrin_init_0 (void); bool ffeintrin_is_actualarg (ffeintrinSpec spec); bool ffeintrin_is_intrinsic (char *name, ffelexToken t, bool explicit, ffeintrinGen *gen, ffeintrinSpec *spec, - ffeintrinImp *imp); + ffeintrinImp *imp, ffeinfoKind *kind); ffeinfoKindtype ffeintrin_kindtype (ffeintrinSpec spec); char *ffeintrin_name_generic (ffeintrinGen gen); char *ffeintrin_name_implementation (ffeintrinImp imp); @@ -125,8 +119,6 @@ ffeIntrinsicState ffeintrin_state_family (ffeintrinFamily family); #define ffeintrin_terminate_3() #define ffeintrin_terminate_4() -#endif /* !FFEINTRIN_DOC */ - /* End of #include file. */ #endif diff --git a/gnu/usr.bin/gcc/f/lang-options.h b/gnu/usr.bin/gcc/f/lang-options.h index b150a2c41a6..f9eab62cc37 100644 --- a/gnu/usr.bin/gcc/f/lang-options.h +++ b/gnu/usr.bin/gcc/f/lang-options.h @@ -1,5 +1,5 @@ /* lang-options.h file for Fortran - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -52,20 +52,16 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA "-fno-fixed-form", "-fpedantic", "-fno-pedantic", - "-fvxt", - "-fno-vxt", + "-fvxt-not-f90", + "-ff90-not-vxt", "-fugly", "-fno-ugly", "-fugly-args", "-fno-ugly-args", - "-fugly-assign", - "-fno-ugly-assign", "-fugly-assumed", "-fno-ugly-assumed", "-fugly-comma", "-fno-ugly-comma", - "-fugly-complex", - "-fno-ugly-complex", "-fugly-init", "-fno-ugly-init", "-fugly-logint", @@ -76,8 +72,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA "-fno-init-local-zero", "-fbackslash", "-fno-backslash", - "-femulate-complex", - "-fno-emulate-complex", "-funderscoring", "-fno-underscoring", "-fsecond-underscore", diff --git a/gnu/usr.bin/gcc/f/lang-specs.h b/gnu/usr.bin/gcc/f/lang-specs.h index ea500c3d74a..a2183903294 100644 --- a/gnu/usr.bin/gcc/f/lang-specs.h +++ b/gnu/usr.bin/gcc/f/lang-specs.h @@ -1,5 +1,5 @@ /* lang-specs.h file for Fortran - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/lex.c b/gnu/usr.bin/gcc/f/lex.c index 79b3a9a6cca..21c493d22e8 100644 --- a/gnu/usr.bin/gcc/f/lex.c +++ b/gnu/usr.bin/gcc/f/lex.c @@ -1,5 +1,5 @@ /* Implementation of Fortran lexer - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -61,7 +61,6 @@ static void ffelex_include_ (void); static bool ffelex_is_free_char_ctx_contin_ (ffewhereColumnNumber col); static bool ffelex_is_free_nonc_ctx_contin_ (ffewhereColumnNumber col); static void ffelex_next_line_ (void); -static void ffelex_prepare_eos_ (void); static void ffelex_send_token_ (void); static ffelexHandler ffelex_swallow_tokens_ (ffelexToken t); static ffelexToken ffelex_token_new_ (void); @@ -133,7 +132,7 @@ static ffewhereColumn ffelex_current_wc_; token. */ #define FFELEX_columnTOKEN_SIZE_ 63 #if FFELEX_columnTOKEN_SIZE_ < FFEWHERE_indexMAX -#error "token size too small!" +#error token size too small! #endif /* Current token being lexed. */ @@ -902,17 +901,15 @@ ffelex_file_push_ (int old_lineno, char *input_filename) if (input_file_stack) input_file_stack->name = input_filename; } -#endif - -/* Prepare to finish a statement-in-progress by sending the current - token, if any, then setting up EOS as the current token with the - appropriate current pointer. The caller can then move the current - pointer before actually sending EOS, if desired, as it is in - typical fixed-form cases. */ +#endif static void -ffelex_prepare_eos_ () +ffelex_finish_statement_ () { + if ((ffelex_number_of_tokens_ == 0) + && (ffelex_token_->type == FFELEX_typeNONE)) + return; /* Don't have a statement pending. */ + if (ffelex_token_->type != FFELEX_typeNONE) { ffelex_backslash_ (EOF, 0); @@ -952,18 +949,6 @@ ffelex_prepare_eos_ () ffelex_token_->type = FFELEX_typeEOS; ffelex_token_->where_line = ffewhere_line_use (ffelex_current_wl_); ffelex_token_->where_col = ffewhere_column_use (ffelex_current_wc_); -} - -static void -ffelex_finish_statement_ () -{ - if ((ffelex_number_of_tokens_ == 0) - && (ffelex_token_->type == FFELEX_typeNONE)) - return; /* Don't have a statement pending. */ - - if (ffelex_token_->type != FFELEX_typeEOS) - ffelex_prepare_eos_ (); - ffelex_permit_include_ = TRUE; ffelex_send_token_ (); ffelex_permit_include_ = FALSE; @@ -1535,7 +1520,7 @@ ffelex_include_ () if (card_length != 0) { #ifdef REDUCE_CARD_SIZE_AFTER_BIGGY /* Define if occasional large lines. */ -#error "need to handle possible reduction of card size here!!" +#error need to handle possible reduction of card size here!! #endif assert (ffelex_card_size_ >= card_length); /* It shrunk?? */ memcpy (ffelex_card_image_, card_image, card_length); @@ -2069,11 +2054,11 @@ ffelex_file_fixed (ffewhereFile wf, FILE *f) label) aside from a positive continuation character might have meaning in the midst of a character or hollerith constant. - 2. If a line has no explicit continuation character (that is, it has a - space in column 6 and the first non-space character past column 6 is - not a digit 0-9), then there are two possibilities: + 2. If a line has no explicit continuation character (a space in column 6 + and first non-blank character past column 6 is not a digit 0-9), then + there are two possibilities: - A. A label is present and/or a non-space (and non-comment) character + A. A label is present and/or a non-blank (and non-comment) character appears somewhere after column 6. Terminate processing of the previous statement, if any, send the new label for the next statement, if any, and start processing a new statement with this non-blank character, if @@ -2102,7 +2087,7 @@ ffelex_file_fixed (ffewhereFile wf, FILE *f) case '!': /* ANSI Fortran 90 says ! in column 6 is continuation. */ /* VXT Fortran says ! anywhere is comment, even column 6. */ - if (ffe_is_vxt () || (column != 5)) + if (ffe_is_vxt_not_90 () || (column != 5)) goto no_tokens_on_line; /* :::::::::::::::::::: */ goto got_a_continuation; /* :::::::::::::::::::: */ @@ -2111,13 +2096,10 @@ ffelex_file_fixed (ffewhereFile wf, FILE *f) goto some_other_character; /* :::::::::::::::::::: */ /* Fall through. */ if (column == 5) - { - /* This seems right to do. But it is close to call, since / * starting - in column 6 will thus be interpreted as a continuation line - beginning with '*'. */ - - goto got_a_continuation;/* :::::::::::::::::::: */ - } + goto got_a_continuation;/* :::::::::::::::::::: */ + /* This seems right to do. But it is close to call, since / * starting + in column 6 will thus be interpreted as a continuation line + beginning with '*'. */ /* Fall through. */ case '\0': /* End of line. Therefore may be continued-through line, so handle @@ -2231,9 +2213,6 @@ ffelex_file_fixed (ffewhereFile wf, FILE *f) an impending INCLUDE, and that requires accurate line info being maintained by the lexer. */ - if (finish_statement) - ffelex_prepare_eos_ (); /* Prepare EOS before we move current pointer. */ - ffewhere_line_kill (ffelex_current_wl_); ffewhere_column_kill (ffelex_current_wc_); ffelex_current_wl_ = ffewhere_line_new (ffelex_linecount_current_); @@ -2527,7 +2506,7 @@ ffelex_file_fixed (ffewhereFile wf, FILE *f) break; case '_': - if (1 || ffe_is_90 ()) + if (ffe_is_90 ()) { ffelex_token_->type = FFELEX_typeUNDERSCORE; ffelex_token_->where_line @@ -3463,7 +3442,7 @@ ffelex_file_free (ffewhereFile wf, FILE *f) break; case '_': - if (1 || ffe_is_90 ()) + if (ffe_is_90 ()) { ffelex_token_->type = FFELEX_typeUNDERSCORE; ffelex_token_->where_line diff --git a/gnu/usr.bin/gcc/f/name.h b/gnu/usr.bin/gcc/f/name.h index e73d9504aa1..1a5b4778ef4 100644 --- a/gnu/usr.bin/gcc/f/name.h +++ b/gnu/usr.bin/gcc/f/name.h @@ -89,16 +89,15 @@ ffenameSpace ffename_space_new (mallocPool pool); #define ffename_init_2() #define ffename_init_3() #define ffename_init_4() -#define ffename_set_global(n,glob) ((n)->u.g = (glob)) -#define ffename_set_symbol(n,sym) ((n)->u.s = (sym)) -#define ffename_symbol(n) ((n)->u.s) #define ffename_terminate_0() #define ffename_terminate_1() #define ffename_terminate_2() #define ffename_terminate_3() #define ffename_terminate_4() +#define ffename_set_global(n,glob) ((n)->u.g = (glob)) +#define ffename_set_symbol(n,sym) ((n)->u.s = (sym)) +#define ffename_symbol(n) ((n)->u.s) #define ffename_text(n) ffelex_token_text((n)->t) -#define ffename_token(n) ((n)->t) #define ffename_where_filename(n) ffelex_token_where_filename((n)->t) #define ffename_where_filelinenum(n) ffelex_token_where_filelinenum((n)->t) #define ffename_where_line(n) ffelex_token_where_line((n)->t) diff --git a/gnu/usr.bin/gcc/f/news.texi b/gnu/usr.bin/gcc/f/news.texi index 60204c03927..f0faa2d7806 100644 --- a/gnu/usr.bin/gcc/f/news.texi +++ b/gnu/usr.bin/gcc/f/news.texi @@ -1,11 +1,11 @@ -@c Copyright (C) 1995-1997 Free Software Foundation, Inc. +@c Copyright (C) 1995, 1996 Free Software Foundation, Inc. @c This is part of the G77 manual. @c For copying conditions, see the file g77.texi. @c The text of this file appears in the file BUGS @c in the G77 distribution, as well as in the G77 manual. -@c 1997-02-25 +@c 1996-02-01 @ifclear NEWSONLY @node News @@ -13,271 +13,15 @@ @end ifclear @cindex versions, recent @cindex recent versions - -@heading In 0.5.20: -@itemize @bullet -@item -The @samp{-fno-typeless-boz} option is now the default. - -This option specifies that non-decimal-radix -constants using the prefixed-radix form (such as @samp{Z'1234'}) -are to be interpreted as @code{INTEGER} constants. -Specify @samp{-ftypeless-boz} to cause such -constants to be interpreted as typeless. - -(Version 0.5.19 introduced @samp{-fno-typeless-boz} and -its inverse.) - -@item -Options @samp{-ff90-intrinsics-enable} and -@samp{-fvxt-intrinsics-enable} now are the -defaults. - -Some programs might use names that clash with -intrinsic names defined (and now enabled) by these -options or by the new @code{libU77} intrinsics. -Users of such programs might need to compile them -differently (using, for example, @samp{-ff90-intrinsics-disable}) -or, better yet, insert appropriate @code{EXTERNAL} -statements specifying that these names are not intended -to be names of intrinsics. - -@item -The @samp{ALWAYS_FLUSH} macro is no longer defined when -building @code{libf2c}, which should result in improved -I/O performance, especially over NFS. - -@emph{Note:} If you have code that depends on the behavior -of @code{libf2c} when built with @samp{ALWAYS_FLUSH} defined, -you will have to modify @code{libf2c} accordingly before -building it from this and future versions of @code{g77}. - -@item -Dave Love's implementation of @code{libU77} has been -added to the version of @code{libf2c} distributed with -and built as part of @code{g77}. -@code{g77} now knows about the routines in this library -as intrinsics. - -@item -New option @samp{-fvxt} specifies that the -source file is written in VXT Fortran, instead of GNU Fortran. - -@item -The @samp{-fvxt-not-f90} option has been deleted, -along with its inverse, @samp{-ff90-not-vxt}. - -If you used one of these deleted options, you should -re-read the pertinent documentation to determine which -options, if any, are appropriate for compiling your -code with this version of @code{g77}. - -@item -The @samp{-fugly} option now issues a warning, as it -likely will be removed in a future version. - -(Enabling all the @samp{-fugly-*} options is unlikely -to be feasible, or sensible, in the future, -so users should learn to specify only those -@samp{-fugly-*} options they really need for a -particular source file.) - -@item -The @samp{-fugly-assumed} option, introduced in -version 0.5.19, has been changed to -better accommodate old and new code. - -@item -Make a number of fixes to the @code{g77} front end and -the @code{gcc} back end to better support Alpha (AXP) -machines. -This includes providing at least one bug-fix to the -@code{gcc} back end for Alphas. - -@item -Related to supporting Alpha (AXP) machines, the @code{LOC()} -intrinsic and @code{%LOC()} construct now return -values of integer type that is the same width (holds -the same number of bits) as the pointer type on the -machine. - -On most machines, this won't make a difference, whereas -on Alphas, the type these constructs return is -@code{INTEGER*8} instead of the more common @code{INTEGER*4}. - -@item -Emulate @code{COMPLEX} arithmetic in the @code{g77} front -end, to avoid bugs in @code{complex} support in the -@code{gcc} back end. -New option @samp{-fno-emulate-complex} -causes @code{g77} to revert the 0.5.19 behavior. - -@item -Fix bug whereby @samp{REAL A(1)}, for example, caused -a compiler crash if @samp{-fugly-assumed} was in effect -and @var{A} was a local (automatic) array. -That case is no longer affected by the new -handling of @samp{-fugly-assumed}. - -@item -Fix @code{g77} command driver so that @samp{g77 -o foo.f} -no longer deletes @file{foo.f} before issuing other -diagnostics, and so the @samp{-x} option is properly -handled. - -@item -Enable inlining of subroutines and functions by the @code{gcc} -back end. -This works as it does for @code{gcc} itself---program units -may be inlined for invocations that follow them in the same -program unit, as long as the appropriate compile-time -options are specified. - -@item -Dummy arguments are no longer assumed to potentially alias -(overlap) -other dummy arguments or @code{COMMON} areas when any of -these are defined (assigned to) by Fortran code. - -This can result in faster and/or smaller programs when -compiling with optimization enabled, though on some -systems this effect is observed only when @samp{-fforce-addr} -also is specified. - -New options @samp{-falias-check}, @samp{-fargument-alias}, -@samp{-fargument-noalias}, -and @samp{-fno-argument-noalias-global} control the -way @code{g77} handles potential aliasing. - -@item -The @code{CONJG()} and @code{DCONJG()} intrinsics now -are compiled in-line. - -@item -The bug-fix for 0.5.19.1 has been re-done. -The @code{g77} compiler has been changed back to -assume @code{libf2c} has no aliasing problems in -its implementations of the @code{COMPLEX} (and -@code{DOUBLE COMPLEX}) intrinsics. -The @code{libf2c} has been changed to have no such -problems. - -As a result, 0.5.20 is expected to offer improved performance -over 0.5.19.1, perhaps as good as 0.5.19 in most -or all cases, due to this change alone. - -@emph{Note:} This change requires version 0.5.20 of -@code{libf2c}, at least, when linking code produced -by any versions of @code{g77} other than 0.5.19.1. -Use @samp{g77 -v} to determine the version numbers -of the @code{libF77}, @code{libI77}, and @code{libU77} -components of the @code{libf2c} library. -(If these version numbers are not printed---in -particular, if the linker complains about unresolved -references to names like @samp{g77__fvers__}---that -strongly suggests your installation has an obsolete -version of @code{libf2c}.) - -@item -New option @samp{-fugly-assign} specifies that the -same memory locations are to be used to hold the -values assigned by both statements @samp{I = 3} and -@samp{ASSIGN 10 TO I}, for example. -(Normally, @code{g77} uses a separate memory location -to hold assigned statement labels.) - -@item -@code{FORMAT} and @code{ENTRY} statements now are allowed to -precede @code{IMPLICIT NONE} statements. - -@item -Produce diagnostic for unsupported @code{SELECT CASE} on -@code{CHARACTER} type, instead of crashing, at compile time. - -@item -Fix crashes involving diagnosed or invalid code. - -@item -Change approach to building @code{libf2c} archive -(@file{libf2c.a}) so that members are added to it -only when truly necessary, so the user that installs -an already-built @code{g77} doesn't need to have write -access to the build tree (whereas the user doing the -build might not have access to install new software -on the system). - -@item -Support @code{gcc} version 2.7.2.2 -(modified by @code{g77} into version 2.7.2.2.f.2), -and remove -support for prior versions of @code{gcc}. - -@item -Upgrade to @code{libf2c} as of 1997-02-08, and -fix up some of the build procedures. - -@item -Improve general build procedures for @code{g77}, -fixing minor bugs (such as deletion of any file -named @file{f771} in the parent directory of @code{gcc/}). - -@item -Enable full support of @code{INTEGER*8} available in -@code{libf2c} and @file{f2c.h} so that @code{f2c} users -may make full use of its features via the @code{g77} -version of @file{f2c.h} and the @code{INTEGER*8} -support routines in the @code{g77} version of @code{libf2c}. - -@item -Improve @code{g77} driver and @code{libf2c} so that @samp{g77 -v} -yields version information on the library. - -@item -The @code{SNGL} and @code{FLOAT} intrinsics now are -specific intrinsics, instead of synonyms for the -generic intrinsic @code{REAL}. - -@item -New intrinsics have been added. -These are @code{REALPART}, @code{IMAGPART}, -@code{COMPLEX}, -@code{LONG}, and @code{SHORT}. - -@item -A new group of intrinsics, @samp{gnu}, has been added -to contain the new @code{REALPART}, @code{IMAGPART}, -and @code{COMPLEX} intrinsics. -An old group, @samp{dcp}, has been removed. - -@item -Complain about industry-wide ambiguous references -@samp{REAL(@var{expr})} and @samp{AIMAG(@var{expr})}, -where @var{expr} is @code{DOUBLE COMPLEX} (or any -complex type other than @code{COMPLEX}), unless -@samp{-ff90} option specifies Fortran 90 interpretation -or new @samp{-fugly-complex} option, in conjunction with -@samp{-fnot-f90}, specifies @code{f2c} interpretation. - -@item -Make improvements to diagnostics. - -@item -Speed up compiler a bit. - -@item -Improvements to documentation and indexing, including -a new chapter containing information on one, later -more, diagnostics that users are directed to pull -up automatically via a message in the diagnostic itself. - -(Hence the menu item @samp{M} for the node -@samp{Diagnostics} in the top-level menu of -the Info documentation.) -@end itemize +@c [In 0.5.20?] +@c @item +@c New option @samp{--enable-libu77} for use by installers +@c at configuration time to indicate that a version of the +@c @samp{libU77} is present and to be built and installed +@c along with the rest of @samp{libf2c}. @heading In 0.5.19.1: @itemize @bullet -@item Code-generation bugs afflicting operations on complex data have been fixed. @@ -302,26 +46,26 @@ For example, @samp{C = CSQRT(C)}, @samp{Z = Z/C}, and @samp{Z = Z**I} @heading In 0.5.19: @itemize @bullet @item -Fix @code{FORMAT} statement parsing so negative values for +Fix @samp{FORMAT} statement parsing so negative values for specifiers such as @samp{P} (e.g. @samp{FORMAT(-1PF8.1)}) are correctly processed as negative. @item -Fix @code{SIGNAL} intrinsic so it once again accepts a +Fix @samp{SIGNAL} intrinsic so it once again accepts a procedure as its second argument. @item A temporary kludge option provides bare-bones information on -@code{COMMON} and @code{EQUIVALENCE} members at debug time. +@samp{COMMON} and @samp{EQUIVALENCE} members at debug time. @item New @samp{-fonetrip} option specifies FORTRAN-66-style -one-trip @code{DO} loops. +one-trip @samp{DO} loops. @item New @samp{-fno-silent} option causes names of program units to be printed as they are compiled, in a fashion similar to -UNIX @code{f77} and @code{f2c}. +UNIX @samp{f77} and @samp{f2c}. @item New @samp{-fugly-assumed} option specifies that arrays @@ -331,7 +75,7 @@ treated as assumed-size. @item New @samp{-fno-typeless-boz} option specifies that non-decimal-radix constants using the prefixed-radix form (such as @samp{Z'1234'}) -are to be interpreted as @code{INTEGER} constants. +are to be interpreted as @samp{INTEGER} constants. @item New @samp{-ff66} option is a ``shorthand'' option that specifies @@ -339,7 +83,7 @@ behaviors considered appropriate for FORTRAN 66 programs. @item New @samp{-ff77} option is a ``shorthand'' option that specifies -behaviors considered appropriate for UNIX @code{f77} programs. +behaviors considered appropriate for UNIX @samp{f77} programs. @item New @samp{-fugly-comma} and @samp{-fugly-logint} options provided @@ -350,7 +94,7 @@ in that they do nothing more than enable (or disable) other @item Fix parsing of assignment statements involving targets that -are substrings of elements of @code{CHARACTER} arrays having +are substrings of elements of @samp{CHARACTER} arrays having names such as @samp{READ}, @samp{WRITE}, @samp{GOTO}, and @samp{REALFUNCTIONFOO}. @@ -358,7 +102,7 @@ names such as @samp{READ}, @samp{WRITE}, @samp{GOTO}, and Fix crashes involving diagnosed code. @item -Fix handling of local @code{EQUIVALENCE} areas so certain cases +Fix handling of local @samp{EQUIVALENCE} areas so certain cases of valid Fortran programs are not misdiagnosed as improperly extending the area backwards. @@ -371,21 +115,21 @@ fix up some of the build procedures. @item Change code generation for list-directed I/O so it allows -for new versions of @code{libf2c} that might return non-zero +for new versions of @samp{libf2c} that might return non-zero status codes for some operations previously assumed to always return zero. -This change not only affects how @code{IOSTAT=} variables +This change not only affects how @samp{IOSTAT=} variables are set by list-directed I/O, it also affects whether -@code{END=} and @code{ERR=} labels are reached by these +@samp{END=} and @samp{ERR=} labels are reached by these operations. @item -Add intrinsic support for new @code{FTELL} and @code{FSEEK} -procedures in @code{libf2c}. +Add intrinsic support for new @samp{FTELL} and @samp{FSEEK} +procedures in @samp{libf2c}. @item -Modify @code{fseek_()} in @code{libf2c} to be more portable +Modify @samp{fseek_()} in @samp{libf2c} to be more portable (though, in practice, there might be no systems where this matters) and to catch invalid @samp{whence} arguments. @@ -394,11 +138,11 @@ Some useless warnings from the @samp{-Wunused} option have been eliminated. @item -Fix a problem building the @file{f771} executable +Fix a problem building the @samp{f771} executable on AIX systems by linking with the @samp{-bbigtoc} option. @item -Abort configuration if @code{gcc} has not been patched +Abort configuration if @samp{gcc} has not been patched using the patch file provided in the @samp{gcc/f/gbe/} subdirectory. @@ -409,7 +153,7 @@ Also add printing of @code{g77} version number when the @samp{--verbose} (@samp{-v}) option is used. @item -Change internally generated name for local @code{EQUIVALENCE} +Change internally generated name for local @samp{EQUIVALENCE} areas to one based on the alphabetically sorted first name in the list of names for entities placed at the beginning of the areas. @@ -421,24 +165,24 @@ Improvements to documentation and indexing. @heading In 0.5.18: @itemize @bullet @item -Add some rudimentary support for @code{INTEGER*1}, -@code{INTEGER*2}, @code{INTEGER*8}, -and their @code{LOGICAL} equivalents. +Add some rudimentary support for @samp{INTEGER*1}, +@samp{INTEGER*2}, @samp{INTEGER*8}, +and their @samp{LOGICAL} equivalents. (This support works on most, maybe all, @code{gcc} targets.) -Thanks to Scott Snyder (@email{snyder@@d0sgif.fnal.gov}) +Thanks to Scott Snyder (@code{snyder@@d0sgif.fnal.gov}) for providing the patch for this! Among the missing elements from the support for these features are full intrinsic support and constants. @item -Add some rudimentary support for the @code{BYTE} and -@code{WORD} type-declaration statements. -@code{BYTE} corresponds to @code{INTEGER*1}, -while @code{WORD} corresponds to @code{INTEGER*2}. +Add some rudimentary support for the @samp{BYTE} and +@samp{WORD} type-declaration statements. +@samp{BYTE} corresponds to @samp{INTEGER*1}, +while @samp{WORD} corresponds to @samp{INTEGER*2}. -Thanks to Scott Snyder (@email{snyder@@d0sgif.fnal.gov}) +Thanks to Scott Snyder (@code{snyder@@d0sgif.fnal.gov}) for providing the patch for this! @item @@ -446,7 +190,7 @@ The compiler code handling intrinsics has been largely rewritten to accommodate the new types. No new intrinsics or arguments for existing intrinsics have been added, so there is, at this -point, no intrinsic to convert to @code{INTEGER*8}, +point, no intrinsic to convert to @samp{INTEGER*8}, for example. @item @@ -473,14 +217,14 @@ other value. @item With @samp{-ff90} in force, @code{g77} incorrectly -interpreted @samp{REAL(Z)} as returning a @code{REAL} -result, instead of as a @code{DOUBLE PRECISION} +interpreted @samp{REAL(Z)} as returning a @samp{REAL} +result, instead of as a @samp{DOUBLE PRECISION} result. -(Here, @samp{Z} is @code{DOUBLE COMPLEX}.) +(Here, @samp{Z} is @samp{DOUBLE COMPLEX}.) With @samp{-fno-f90} in force, the interpretation remains unchanged, since this appears to be how at least some -F77 code using the @code{DOUBLE COMPLEX} extension expected +F77 code using the @samp{DOUBLE COMPLEX} extension expected it to work. Essentially, @samp{REAL(Z)} in F90 is the same as @@ -489,18 +233,18 @@ be the same as @samp{REAL(REAL(Z))}. @item An expression involving exponentiation, where both operands -were type @code{INTEGER} and the right-hand operand +were type @samp{INTEGER} and the right-hand operand was negative, was erroneously evaluated. @item -Fix bugs involving @code{DATA} implied-@code{DO} constructs +Fix bugs involving @samp{DATA} implied-@samp{DO} constructs (these involved an errant diagnostic and a crash, both on good code, one involving subsequent statement-function definition). @item -Close @code{INCLUDE} files after processing them, so compiling source -files with lots of @code{INCLUDE} statements does not result in -being unable to open @code{INCLUDE} files after all the available +Close @samp{INCLUDE} files after processing them, so compiling source +files with lots of @samp{INCLUDE} statements does not result in +being unable to open @samp{INCLUDE} files after all the available file descriptors are used up. @item @@ -536,7 +280,7 @@ Fortran, and @var{n} is @samp{1} for the first Fortran patch for that version of @code{gcc}, @samp{2} for the second, and so on. -So, this introduces version 2.7.2.f.1 of @code{gcc}. +So, this introduces version @samp{2.7.2.f.1} of @code{gcc}. @item Make several improvements and fixes to diagnostics, including @@ -554,8 +298,8 @@ loops, instead of these being rejected unless @samp{-fpedantic} or @samp{-fugly} specified. @item -Allow @code{SAVE} of a local variable or array, even after -it has been given an initial value via @code{DATA}, for example. +Allow @samp{SAVE} of a local variable or array, even after +it has been given an initial value via @samp{DATA}, for example. @item Introduce an Info version of @code{g77} documentation, which @@ -567,8 +311,8 @@ The files @file{gcc/f/BUGS}, @file{gcc/f/INSTALL}, and the texinfo source when distributions are made. This effort was inspired by a first pass at translating -@file{g77-0.5.16/f/DOC} that was contributed to Craig by -David Ronis (@email{ronis@@onsager.chem.mcgill.ca}). +@code{g77-0.5.16/f/DOC} that was contributed to Craig by +David Ronis (@code{ronis@@onsager.chem.mcgill.ca}). @item New @samp{-fno-second-underscore} option to specify @@ -583,14 +327,14 @@ In particular, calculation of the iteration count is still done by converting the start, end, and increment parameters to the type of the @code{DO} variable, but the result of the calculation is always converted to -the default @code{INTEGER} type. +the default @samp{INTEGER} type. (This should have no effect on existing code compiled by @code{g77}, but code written to assume that use of a @emph{wider} type for the @code{DO} variable will result in an iteration count being fully calculated using that wider type (wider -than default @code{INTEGER}) must be rewritten.) +than default @samp{INTEGER}) must be rewritten.) @item Support @code{gcc} version 2.7.2. @@ -602,7 +346,7 @@ fix up some of the build procedures. Note that the email addresses related to @code{f2c} have changed---the distribution site now is named @code{netlib.bell-labs.com}, and the -maintainer's new address is @email{dmg@@bell-labs.com}. +maintainer's new address is @code{dmg@@bell-labs.com}. @end itemize @heading In 0.5.17: @@ -641,9 +385,9 @@ program unit (such as when input file contains @samp{@@foo}). Fix crashes, infinite loops (hangs), and such involving diagnosed code. @item -Fix @code{ASSIGN}'ed variables so they can be @code{SAVE}'d or dummy arguments, -and issue clearer error message in cases where target of @code{ASSIGN} -or @code{ASSIGN}ed @code{GOTO}/@code{FORMAT} is too small (which should +Fix @samp{ASSIGN}'ed variables so they can be @samp{SAVE}'d or dummy arguments, +and issue clearer error message in cases where target of @samp{ASSIGN} +or @samp{ASSIGN}ed @samp{GOTO}/@samp{FORMAT} is too small (which should never happen). @item @@ -656,12 +400,12 @@ options to compiler. @item Fix failure to always diagnose missing type declaration for -@code{IMPLICIT NONE}. +@samp{IMPLICIT NONE}. @item Fix compile-time performance problem (which could sometimes crash the compiler, cause a hang, or whatever, due to a bug -in the back end) involving exponentiation with a large @code{INTEGER} +in the back end) involving exponentiation with a large @samp{INTEGER} constant for the right-hand operator (e.g. @samp{I**32767}). @item @@ -674,8 +418,8 @@ interpreted by the Fortran standard (and @code{g77}) in ways that are surprising to many programmers. @item -Add @code{ERF()} and @code{ERFC()} as generic intrinsics mapping to existing -@code{ERF}/@code{DERF} and @code{ERFC}/@code{DERFC} specific intrinsics. +Add @samp{ERF()} and @samp{ERFC()} as generic intrinsics mapping to existing +@samp{ERF}/@samp{DERF} and @samp{ERFC}/@samp{DERFC} specific intrinsics. @emph{Note:} You should specify @samp{INTRINSIC ERF,ERFC} in any code where you might use @@ -684,8 +428,8 @@ these as generic intrinsics, to improve likelihood of diagnostics doesn't support these as intrinsics (e.g. @code{f2c}). @item -Remove from @samp{-fno-pedantic} the diagnostic about @code{DO} -with non-@code{INTEGER} index variable; issue that under +Remove from @samp{-fno-pedantic} the diagnostic about @samp{DO} +with non-@samp{INTEGER} index variable; issue that under @samp{-Wsurprising} instead. @item @@ -693,15 +437,15 @@ Clarify some diagnostics that say things like ``ignored'' when that's misleading. @item -Clarify diagnostic on use of @code{.EQ.}/@code{.NE.} on @code{LOGICAL} +Clarify diagnostic on use of @samp{.EQ.}/@samp{.NE.} on @samp{LOGICAL} operands. @item Minor improvements to code generation for various operations on -@code{LOGICAL} operands. +@samp{LOGICAL} operands. @item -Minor improvement to code generation for some @code{DO} loops on some +Minor improvement to code generation for some @samp{DO} loops on some machines. @item @@ -714,19 +458,19 @@ Upgrade to @code{libf2c} as of 1995-11-15. @heading In 0.5.16: @itemize @bullet @item -Fix a code-generation bug involving complicated @code{EQUIVALENCE} statements -not involving @code{COMMON}. +Fix a code-generation bug involving complicated @samp{EQUIVALENCE} statements +not involving @samp{COMMON}. @item Fix code-generation bugs involving invoking ``gratis'' library procedures in @code{libf2c} from code compiled with @samp{-fno-f2c} by making these procedures known to @code{g77} as intrinsics (not affected by -fno-f2c). -This is known to fix code invoking @code{ERF()}, @code{ERFC()}, -@code{DERF()}, and @code{DERFC()}. +This is known to fix code invoking @samp{ERF()}, @samp{ERFC()}, +@samp{DERF()}, and @samp{DERFC()}. @item Update @code{libf2c} to include netlib patches through 1995-08-16, and -@code{#define} @samp{WANT_LEAD_0} to 1 to make @code{g77}-compiled code more +@samp{#define} @samp{WANT_LEAD_0} to 1 to make @code{g77}-compiled code more consistent with other Fortran implementations by outputting leading zeros in formatted and list-directed output. @@ -738,9 +482,9 @@ compared to @code{f2c} plus @code{gcc} (but apparently only when using @file{gcc-2.7.0} or later). @item -Fix a code-generation bug involving invocation of @code{COMPLEX} and -@code{DOUBLE COMPLEX} @code{FUNCTION}s and doing @code{COMPLEX} and -@code{DOUBLE COMPLEX} divides, when the result +Fix a code-generation bug involving invocation of @samp{COMPLEX} and +@samp{DOUBLE COMPLEX} @samp{FUNCTION}s and doing @samp{COMPLEX} and +@samp{DOUBLE COMPLEX} divides, when the result of the invocation or divide is assigned directly to a variable that overlaps one or more of the arguments to the invocation or divide. @@ -756,7 +500,7 @@ Fix crash on expressions like @samp{COMPLEX**INTEGER}. @item Fix crash on expressions like @samp{(1D0,2D0)**2}, i.e. raising a -@code{DOUBLE COMPLEX} constant to an @code{INTEGER} constant power. +@samp{DOUBLE COMPLEX} constant to an @samp{INTEGER} constant power. @item Fix crashes and such involving diagnosed code. @@ -771,7 +515,7 @@ definitions. @item Fix bug resulting in debugger not knowing size of local equivalence -area when any member of area has initial value (via @code{DATA}, +area when any member of area has initial value (via @samp{DATA}, for example). @item @@ -786,7 +530,7 @@ gratuitously invoke the @item Fix diagnostic to point to correct source line when it immediately -follows an @code{INCLUDE} statement. +follows an @samp{INCLUDE} statement. @item Support more compiler options in @code{gcc}/@code{g77} when @@ -798,13 +542,13 @@ automatic insertion of configuration-specific linker specs. @item Add new intrinsics that interface to existing routines in @code{libf2c}: -@code{ABORT}, @code{DERF}, @code{DERFC}, @code{ERF}, @code{ERFC}, @code{EXIT}, -@code{FLUSH}, @code{GETARG}, @code{GETENV}, @code{IARGC}, -@code{SIGNAL}, and @code{SYSTEM}. -Note that @code{ABORT}, @code{EXIT}, @code{FLUSH}, @code{SIGNAL}, and -@code{SYSTEM} are intrinsic subroutines, not functions (since they -have side effects), so to get the return values from @code{SIGNAL} -and @code{SYSTEM}, append a final argument specifying an @code{INTEGER} +@samp{ABORT}, @samp{DERF}, @samp{DERFC}, @samp{ERF}, @samp{ERFC}, @samp{EXIT}, +@samp{FLUSH}, @samp{GETARG}, @samp{GETENV}, @samp{IARGC}, +@samp{SIGNAL}, and @samp{SYSTEM}. +Note that @samp{ABORT}, @samp{EXIT}, @samp{FLUSH}, @samp{SIGNAL}, and +@samp{SYSTEM} are intrinsic subroutines, not functions (since they +have side effects), so to get the return values from @samp{SIGNAL} +and @samp{SYSTEM}, append a final argument specifying an @samp{INTEGER} variable or array element (e.g. @samp{CALL SYSTEM('rm foo',ISTAT)}). @item @@ -812,7 +556,7 @@ Add new intrinsic group named @samp{unix} to contain the new intrinsics, and by default enable this new group. @item -Move @code{LOC()} intrinsic out of the @samp{vxt} group to the new +Move @samp{LOC()} intrinsic out of the @samp{vxt} group to the new @samp{unix} group. @item @@ -841,7 +585,7 @@ Support @code{gcc}'s @samp{-fident} and @samp{-fno-ident} options. @item When @samp{-Wunused} in effect, don't warn about local variables used as -statement-function dummy arguments or @code{DATA} implied-@code{DO} iteration +statement-function dummy arguments or @samp{DATA} implied-@samp{DO} iteration variables, even though, strictly speaking, these are not uses of the variables themselves. @@ -868,7 +612,7 @@ macros defined in @file{gcc/f/target.h} and used in places like @item Add warning to be printed for each invocation of the compiler -if the target machine @code{INTEGER}, @code{REAL}, or @code{LOGICAL} size +if the target machine @samp{INTEGER}, REAL, or @samp{LOGICAL} size is not 32 bits, since @code{g77} is known to not work well for such cases (to be fixed in Version 0.6---@pxref{Actual Bugs,,Actual Bugs We Haven't Fixed Yet}). @@ -887,7 +631,7 @@ smaller library without lots of debugging clutter. @itemize @bullet @item Fix bad code generation involving @samp{X**I} and temporary, internal variables -generated by @code{g77} and the back end (such as for @code{DO} loops). +generated by @code{g77} and the back end (such as for @samp{DO} loops). @item Fix crash given @samp{CHARACTER A;DATA A/.TRUE./}. @@ -903,7 +647,7 @@ Fix crash or other erratic behavior when null character constant Fix crash or other erratic behavior involving diagnosed code. @item -Fix code generation for external functions returning type @code{REAL} when +Fix code generation for external functions returning type @samp{REAL} when the @samp{-ff2c} option is in force (which it is by default) so that @code{f2c} compatibility is indeed provided. @@ -927,15 +671,15 @@ as @code{gcc} back end is to be fixed to do this even better, and it turned out to slow down some code in some cases after all. @item -In @code{COMMON} and @code{EQUIVALENCE} areas with any members given initial -values (e.g. via @code{DATA}), uninitialized members now always +In @samp{COMMON} and @samp{EQUIVALENCE} areas with any members given initial +values (e.g. via @samp{DATA}), uninitialized members now always initialized to binary zeros (though this is not required by the standard, and might not be done in future versions of @code{g77}). -Previously, in some @code{COMMON}/@code{EQUIVALENCE} areas +Previously, in some @samp{COMMON}/@samp{EQUIVALENCE} areas (essentially those with members of more than one type), the uninitialized members were initialized to spaces, to -cater to @code{CHARACTER} types, but it seems no existing code expects +cater to @samp{CHARACTER} types, but it seems no existing code expects that, while much existing code expects binary zeros. @end itemize @@ -946,7 +690,7 @@ Don't emit bad code when low bound of adjustable array is nonconstant and thus might vary as an expression at run time. @item -Emit correct code for calculation of number of trips in @code{DO} loops +Emit correct code for calculation of number of trips in @samp{DO} loops for cases where the loop should not execute at all. (This bug affected cases @@ -955,31 +699,31 @@ than the step count, though probably not for floating-point cases.) @item Fix crash when extra parentheses surround item in -@code{DATA} implied-@code{DO} list. +@samp{DATA} implied-@samp{DO} list. @item Fix crash over minor internal inconsistencies in handling diagnostics, just substitute dummy strings where necessary. @item -Fix crash on some systems when compiling call to @code{MVBITS()} intrinsic. +Fix crash on some systems when compiling call to @samp{MVBITS()} intrinsic. @item -Fix crash on array assignment @samp{TYPE@var{ddd}(@dots{})=@dots{}}, where @var{ddd} +Fix crash on array assignment @samp{TYPE@var{ddd}(...)=...}, where @var{ddd} is a string of one or more digits. @item -Fix crash on @code{DCMPLX()} with a single @code{INTEGER} argument. +Fix crash on @samp{DCMPLX()} with a single @samp{INTEGER} argument. @item Fix various crashes involving code with diagnosed errors. @item -Support @samp{-I} option for @code{INCLUDE} statement, plus @code{gcc}'s +Support @samp{-I} option for @samp{INCLUDE} statement, plus @code{gcc}'s @file{header.gcc} facility for handling systems like MS-DOS. @item -Allow @code{INCLUDE} statement to be continued across multiple lines, +Allow @samp{INCLUDE} statement to be continued across multiple lines, even allow it to coexist with other statements on the same line. @item @@ -1006,10 +750,10 @@ related warnings that might be helpful won't be seen. @item New @samp{-fbackslash} option, on by default, that causes @samp{\} -within @code{CHARACTER} +within @samp{CHARACTER} and Hollerith constants to be interpreted a la GNU C. Note that -this behavior is somewhat different from @code{f2c}'s, which supports only +this behavior is somewhat different from @samp{f2c}'s, which supports only a limited subset of backslash (escape) sequences. @item @@ -1018,19 +762,19 @@ Make @samp{-fugly-args} the default. @item New @samp{-fugly-init} option, on by default, that allows typeless/Hollerith to be specified as initial values for variables or named constants -(@code{PARAMETER}), and also allows character<->numeric conversion in +(@samp{PARAMETER}), and also allows character<->numeric conversion in those contexts---turn off via @samp{-fno-ugly-init}. @item New @samp{-finit-local-zero} option to initialize local variables to binary zeros. -This does not affect whether they are @code{SAVE}d, i.e. made +This does not affect whether they are @samp{SAVE}d, i.e. made automatic or static. @item New @samp{-Wimplicit} option to warn about implicitly typed variables, arrays, and functions. -(Basically causes all program units to default to @code{IMPLICIT NONE}.) +(Basically causes all program units to default to @samp{IMPLICIT NONE}.) @item @samp{-Wall} now implies @samp{-Wuninitialized} as with @code{gcc} @@ -1039,20 +783,20 @@ requires @samp{-O}), and implies @samp{-Wunused} as well. @item @samp{-Wunused} no longer gives spurious messages for unused -@code{EXTERNAL} names (since they are assumed to refer to block data +@samp{EXTERNAL} names (since they are assumed to refer to block data program units, to make use of libraries more reliable). @item -Support @code{%LOC()} and @code{LOC()} of character arguments. +Support @samp{%LOC()} and @samp{LOC()} of character arguments. @item Support null (zero-length) character constants and expressions. @item -Support @code{f2c}'s @code{IMAG()} generic intrinsic. +Support @code{f2c}'s @samp{IMAG()} generic intrinsic. @item -Support @code{ICHAR()}, @code{IACHAR()}, and @code{LEN()} of +Support @samp{ICHAR()}, @samp{IACHAR()}, and @samp{LEN()} of character expressions that are valid in assignments but not normally as actual arguments. @@ -1060,11 +804,11 @@ not normally as actual arguments. Support @code{f2c}-style @samp{&} in column 1 to mean continuation line. @item -Allow @code{NAMELIST}, @code{EXTERNAL}, @code{INTRINSIC}, and @code{VOLATILE} -in @code{BLOCK DATA}, even though these are not allowed by the standard. +Allow @samp{NAMELIST}, @samp{EXTERNAL}, @samp{INTRINSIC}, and @samp{VOLATILE} +in @samp{BLOCK DATA}, even though these are not allowed by the standard. @item -Allow @code{RETURN} in main program unit. +Allow @samp{RETURN} in main program unit. @item Changes to Hollerith-constant support to obey Appendix C of the @@ -1079,28 +823,28 @@ Hollerith ``format specifications'' in the form of arrays of non-character allowed. @item -Warnings issued when non-space truncation occurs when converting +Warnings issued when non-blank truncation occurs when converting to another type. @item When specified as actual argument, now passed -by reference to @code{INTEGER} (padded on right with spaces if constant -too small, otherwise fully intact if constant wider the @code{INTEGER} +by reference to @samp{INTEGER} (padded on right with spaces if constant +too small, otherwise fully intact if constant wider the @samp{INTEGER} type) instead of by value. @end itemize @strong{Warning:} @code{f2c} differs on the interpretation of @samp{CALL FOO(1HX)}, which it treats exactly the same as @samp{CALL FOO('X')}, but which the standard and @code{g77} treat -as @samp{CALL FOO(%REF('X '))} (padded with as many spaces as necessary -to widen to @code{INTEGER}), essentially. +as @samp{CALL FOO(%REF('X '))} (padded with as many blanks as necessary +to widen to @samp{INTEGER}), essentially. @item Changes and fixes to typeless-constant support: @itemize -- @item -Now treated as a typeless double-length @code{INTEGER} value. +Now treated as a typeless double-length @samp{INTEGER} value. @item Warnings issued when overflow occurs. @@ -1115,15 +859,15 @@ the target machine for whatever type it is turned into. @item When specified as actual argument, now passed as reference to -a default @code{INTEGER} constant. +a default @samp{INTEGER} constant. @end itemize @item -@code{%DESCR()} of a non-@code{CHARACTER} expression now passes a pointer to +@samp{%DESCR()} of a non-@samp{CHARACTER} expression now passes a pointer to the expression plus a length for the expression just as if -it were a @code{CHARACTER} expression. +it were a @samp{CHARACTER} expression. For example, @samp{CALL FOO(%DESCR(D))}, where -@samp{D} is @code{REAL*8}, is the same as @samp{CALL FOO(D,%VAL(8)))}. +@samp{D} is @samp{REAL*8}, is the same as @samp{CALL FOO(D,%VAL(8)))}. @item Name of multi-entrypoint master function changed to incorporate @@ -1132,7 +876,7 @@ value, so the name of the master function for @samp{SUBROUTINE X} with alternate entry points is now @samp{__g77_masterfun_x}. @item -Remove redundant message about zero-step-count @code{DO} loops. +Remove redundant message about zero-step-count @samp{DO} loops. @item Clean up diagnostic messages, shortening many of them. @@ -1145,17 +889,17 @@ Clarify implications of constant-handling bugs in @file{f/BUGS}. @item Generate better code for @samp{**} operator with a right-hand operand of -type @code{INTEGER}. +type @samp{INTEGER}. @item -Generate better code for @code{SQRT()} and @code{DSQRT()}, +Generate better code for @samp{SQRT()} and @samp{DSQRT()}, also when @samp{-ffast-math} -specified, enable better code generation for @code{SIN()} and @code{COS()}. +specified, enable better code generation for @samp{SIN()} and @samp{COS()}. @item Generate better code for some kinds of array references. @item -Speed up lexing somewhat (this makes the compilation phase noticeably +Speed up lexing somewhat (this makes the compilation phase noticably faster). @end itemize diff --git a/gnu/usr.bin/gcc/f/proj.h b/gnu/usr.bin/gcc/f/proj.h index 205130a49d1..ca092fa8985 100644 --- a/gnu/usr.bin/gcc/f/proj.h +++ b/gnu/usr.bin/gcc/f/proj.h @@ -1,5 +1,5 @@ /* proj.h file for Gnu Fortran - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/runtime/ChangeLog b/gnu/usr.bin/gcc/f/runtime/ChangeLog index bd1edf5d3a8..8d2f0b12590 100644 --- a/gnu/usr.bin/gcc/f/runtime/ChangeLog +++ b/gnu/usr.bin/gcc/f/runtime/ChangeLog @@ -1,179 +1,3 @@ -Fri Feb 28 13:16:50 1997 Craig Burley - - * Version 0.5.20 released. - -Wed Feb 26 20:28:53 1997 Craig Burley - - * Makefile.in: $(MAKE) invocations now explicitly - specify `-f Makefile', just in case the `makefile's - from the netlib distribution would get used instead. - -Mon Feb 24 16:43:39 1997 Craig Burley - - * libU77/Makefile.in (check): Specify driver, and - don't bother enabling already-enabled intrinsic groups. - Also, get the $(srcdir) version of u77-test.f. - -Sat Feb 22 14:08:42 1997 Craig Burley - - * libU77/u77-test.f: Explicitly declare intrinsics, get - rid of useless CHARACTER declarations on intrinsics (maybe - someday appropriate to implement meaning of that in g77 - and restore them?). - Add spin loop just to fatten up the timings a bit. - Clarify ETIME output as having three fields. - Call TIME with CHARACTER*8, not CHARACTER*6, argument. - Call new SECOND intrinsic subroutine, after calling - new DUMDUM subroutine just to ensure the correct value - doesn't get left around in a register or something. - -Thu Feb 20 15:22:42 1997 Craig Burley - - * libU77/bes.c: Comment out all the code, as g77 avoids actually - calling it, going directly to the system's library instead. - -Mon Feb 17 02:27:41 1997 Craig Burley - - * libU77/fgetc_.c (fgetc_): Allow return value to be - CHARACTER*(*), properly handle CHARACTER*0 and blank-pad - CHARACTER*n where n>1. - -Tue Feb 11 14:12:19 1997 Craig Burley - - * Makefile.in: Clarify role of $(srcdir) here. Fix - various targets accordingly. Don't rely at all on - gcc/f/include/ being a link to gcc/include/ -- just - use it directly. - (${srcdir}/configure, ${srcdir}/libU77/configure): - Remove the config.cache files in build directory before - cd'ing to source directory as well. - - * libF77/Makefile.in, libI77/Makefile.in (ALL_CFLAGS): - Include `-I.' to pick up build directory. - Use gcc/include/ directly. - * libU77/Makefile.in (ALL_CFLAGS): Include `-I$(srcdir)' - to pick up source directory. - (OBJS): Fix typo in `chmod_.o' (was `chmod.o'). - -Mon Feb 10 12:54:47 1997 Craig Burley - - * Makefile.in (UOBJ), libU77/Makefile.in (OBJS): Add - libU77/chmod_.o to list of objects. - * libU77/chmod_.c: Fix up headers. - Fix implementation to not prematurely truncate command - string and make room for trailing null. - - * libU77/ctime_.c: Incoming xstime argument is now longint. - * libU77/mclock_.c: Now returns longint. - * libU77/time_.c: Now returns longint. - -1997-02-10 Dave Love - - * etime_.c, dtime_.c: Typo rounded times to seconds. - - * date_.c: Add missing return. - - * hostnm_.c: #include unistd.h. - -Sat Feb 8 03:30:19 1997 Craig Burley - - INTEGER*8 support built in to f2c.h and libf2c (since - gcc will be used to compile relevant code anyway): - * Makefile.in, libF77/Makefile.in: Add pow_qq.o, - qbitbits.o, and qbitshft.o to $POW and $F90BIT macros, - as appropriate. - * f2c.h.in: Define appropriate types and macros. - Place #error directive correctly. - * configure.in: Determine appropriate types for long - integer (F2C_LONGINT). - Meanwhile, quote strings in #error, for consistency. - Fix restoring of ac_cpp macro. - * configure: Regenerated using autoconf-2.12. - - * libF77/Version.c, libI77/Version.c, libU77/Version.c: - Update version numbers. - Change names and code for g77-specific version-printing - routines (shorter names should be safer to link on - weird, 8-char systems). - - * libF77/c_cos.c, libF77/c_div.c, libF77/c_exp.c, - libF77/c_log.c, libF77/c_sin.c, libF77/c_sqrt.c, - libF77/d_cnjg.c, libF77/pow_zi.c, libF77/r_cnjg.c, - libF77/z_cos.c, libF77/z_div.c, libF77/z_exp.c, - libF77/z_log.c, libF77/z_sin.c, libF77/z_sqrt.c: - Changed to work properly even when result is aliased - with any inputs. - - * libF77/makefile, libI77/makefile: Leave these in - the g77 distribution, so it is easier to track changes - to official libf2c. - - * libF77/signal_.c: Eliminate redundant `return 0;'. - - * libI77/fio.h (err, errfl): Fix these so they work - (and must be expressed) as statements. - Fix up many users of err() to include trailing semicolon. - - * Incorporate changes by Bell Labs to libf2c through 1997-02-07. - -1997-02-06 Dave Love - - * libU77/etime_.c, libU77/dtime_.c: Fix getrusage stuff. - - * libU77/config.h.in: Regenerate for HAVE_GETRUSAGE. - - * libU77/Makefile.in, libI77/Makefile.in, libF77/Makefile.in: - Redo *clean targets; distclean and maintainer-clean remove the stage? - and include links. This probably want looking at further. - -Wed Feb 5 00:21:23 1997 Craig Burley - - Add libU77 library from Dave Love : - * Makefile.in: Add libU77 directory, rules, etc. - * configure.in: New libU77 directory, Makefile, etc. - - * Makefile.in, libF77/Makefile.in, libI77/Makefile.in, - libU77/Makefile.in: Reorganize these so $(AR) commands - handled by the top-level Makefile instead of the - subordinates. This permits it to do $(AR) only when - one or more object files actually change, instead of - having to force-update it as was necessary before. - And that had the disadvantage of requiring, e.g., user - root to have access to $(AR) to the library simply to - install g77, which might be problematic on an NFS setup. - (mostlyclean, clean, distclean, maintainer-clean): - Properly handle these rules. - - * Makefile.in: Don't invoke config.status here -- let - compiler-level stuff handle all that. - - * err.c [MISSING_FILE_ELEMS]: Declare malloc in this case - too, so it doesn't end up as an integer. - -Sat Feb 1 02:43:48 1997 Craig Burley - - * libF77/Makefile.in: More fixup for $(F90BIT) -- wasn't - in list for ar command, and it wasn't correctly listed - in the list of things depending on f2c.h. - - * f2c.h.in: Fix up #error directive. - -1997-01-31 Dave Love - - * libF77/Makefile.in ($(lib)): Add $(F90BIT); shouldn't exclude - stuff f2c needs so we can share the library. - -Sat Jan 18 19:39:03 1997 Craig Burley - - * configure.in: No longer define ALWAYS_FLUSH, the - resulting performance is too low. - -Wed Dec 18 12:06:02 1996 Craig Burley - - Patch from Mumit Khan : - * libF77/s_paus.c: Add __CYGWIN32__ to list of macros - controlling how to pause. - Sun Dec 1 21:25:27 1996 Craig Burley * configure: Regenerated using autoconf-2.12. @@ -228,7 +52,7 @@ Thu Oct 31 22:27:45 1996 Craig Burley Wed Aug 28 13:25:29 1996 Dave Love - * libI77/rsne.c (x_rsne): Use size_t instead of int. + * libI77/rsne.c (x_rsne): Use size_t instead f int. * libI77/endfile.c (copy): Use size_t in place of int. diff --git a/gnu/usr.bin/gcc/f/runtime/Makefile.in b/gnu/usr.bin/gcc/f/runtime/Makefile.in index ad0d2ab9043..88196acca14 100644 --- a/gnu/usr.bin/gcc/f/runtime/Makefile.in +++ b/gnu/usr.bin/gcc/f/runtime/Makefile.in @@ -1,5 +1,5 @@ # Makefile for GNU F77 compiler runtime. -# Copyright (C) 1995-1997 Free Software Foundation, Inc. +# Copyright (C) 1995 Free Software Foundation, Inc. # Contributed by Dave Love (d.love@dl.ac.uk). # #This file is part of GNU Fortran. @@ -21,9 +21,6 @@ #### Start of system configuration section. #### -# $(srcdir) must be set to the g77 runtime source directory -# (g77/f/runtime/). - srcdir = @srcdir@ VPATH = @srcdir@ @@ -66,70 +63,7 @@ infodir = $(prefix)/info SHELL = /bin/sh -lib = ../../libf2c.a - -SUBDIRS = libI77 libF77 libU77 - -MISC = libF77/F77_aloc.o libF77/VersionF.o libF77/main.o libF77/s_rnge.o \ - libF77/abort_.o libF77/getarg_.o libF77/iargc_.o libF77/getenv_.o \ - libF77/signal_.o libF77/s_stop.o libF77/s_paus.o libF77/system_.o \ - libF77/cabs.o libF77/derf_.o libF77/derfc_.o libF77/erf_.o \ - libF77/erfc_.o libF77/sig_die.o libF77/exit.o -POW = libF77/pow_ci.o libF77/pow_dd.o libF77/pow_di.o libF77/pow_hh.o \ - libF77/pow_ii.o libF77/pow_ri.o libF77/pow_zi.o libF77/pow_zz.o \ - libF77/pow_qq.o -CX = libF77/c_abs.o libF77/c_cos.o libF77/c_div.o libF77/c_exp.o \ - libF77/c_log.o libF77/c_sin.o libF77/c_sqrt.o -DCX = libF77/z_abs.o libF77/z_cos.o libF77/z_div.o libF77/z_exp.o \ - libF77/z_log.o libF77/z_sin.o libF77/z_sqrt.o -REAL = libF77/r_abs.o libF77/r_acos.o libF77/r_asin.o libF77/r_atan.o \ - libF77/r_atn2.o libF77/r_cnjg.o libF77/r_cos.o libF77/r_cosh.o \ - libF77/r_dim.o libF77/r_exp.o libF77/r_imag.o libF77/r_int.o \ - libF77/r_lg10.o libF77/r_log.o libF77/r_mod.o libF77/r_nint.o \ - libF77/r_sign.o libF77/r_sin.o libF77/r_sinh.o libF77/r_sqrt.o \ - libF77/r_tan.o libF77/r_tanh.o -DBL = libF77/d_abs.o libF77/d_acos.o libF77/d_asin.o libF77/d_atan.o \ - libF77/d_atn2.o libF77/d_cnjg.o libF77/d_cos.o libF77/d_cosh.o \ - libF77/d_dim.o libF77/d_exp.o libF77/d_imag.o libF77/d_int.o \ - libF77/d_lg10.o libF77/d_log.o libF77/d_mod.o libF77/d_nint.o \ - libF77/d_prod.o libF77/d_sign.o libF77/d_sin.o libF77/d_sinh.o \ - libF77/d_sqrt.o libF77/d_tan.o libF77/d_tanh.o -INT = libF77/i_abs.o libF77/i_dim.o libF77/i_dnnt.o libF77/i_indx.o \ - libF77/i_len.o libF77/i_mod.o libF77/i_nint.o libF77/i_sign.o -HALF = libF77/h_abs.o libF77/h_dim.o libF77/h_dnnt.o libF77/h_indx.o \ - libF77/h_len.o libF77/h_mod.o libF77/h_nint.o libF77/h_sign.o -CMP = libF77/l_ge.o libF77/l_gt.o libF77/l_le.o libF77/l_lt.o \ - libF77/hl_ge.o libF77/hl_gt.o libF77/hl_le.o libF77/hl_lt.o -EFL = libF77/ef1asc_.o libF77/ef1cmc_.o -CHAR = libF77/s_cat.o libF77/s_cmp.o libF77/s_copy.o -F90BIT = libF77/lbitbits.o libF77/lbitshft.o libF77/qbitbits.o \ - libF77/qbitshft.o -FOBJ = $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) $(HALF) $(CMP) \ - $(EFL) $(CHAR) $(F90BIT) - -IOBJ = libI77/VersionI.o libI77/backspace.o libI77/close.o libI77/dfe.o \ - libI77/dolio.o libI77/due.o libI77/endfile.o libI77/err.o \ - libI77/fmt.o libI77/fmtlib.o libI77/iio.o libI77/ilnw.o \ - libI77/inquire.o libI77/lread.o libI77/lwrite.o libI77/open.o \ - libI77/rdfmt.o libI77/rewind.o libI77/rsfe.o libI77/rsli.o \ - libI77/rsne.o libI77/sfe.o libI77/sue.o libI77/typesize.o \ - libI77/uio.o libI77/util.o libI77/wref.o libI77/wrtfmt.o \ - libI77/wsfe.o libI77/wsle.o libI77/wsne.o libI77/xwsne.o \ - libI77/ftell_.o - -UOBJ = libU77/VersionU.o libU77/gerror_.o libU77/perror_.o libU77/ierrno_.o \ - libU77/itime_.o libU77/time_.o libU77/unlink_.o libU77/fnum_.o \ - libU77/getpid_.o libU77/getuid_.o libU77/getgid_.o libU77/kill_.o \ - libU77/rand_.o libU77/srand_.o libU77/irand_.o libU77/sleep_.o \ - libU77/idate_.o libU77/ctime_.o libU77/etime_.o libU77/dtime_.o \ - libU77/isatty_.o libU77/ltime_.o libU77/fstat_.o libU77/stat_.o \ - libU77/lstat_.o libU77/access_.o libU77/link_.o libU77/getlog_.o \ - libU77/ttynam_.o libU77/getcwd_.o libU77/vxttime_.o \ - libU77/vxtidate_.o libU77/gmtime_.o libU77/fdate_.o libU77/secnds_.o \ - libU77/bes.o libU77/dbes.o libU77/chdir_.o libU77/chmod_.o \ - libU77/lnblnk_.o libU77/hostnm_.o libU77/rename_.o libU77/fgetc_.o \ - libU77/fputc_.o libU77/umask_.o libU77/system_clock_.o libU77/date_.o \ - libU77/second_.o libU77/flush1_.o +SUBDIRS = libI77 libF77 # flags_to_pass to recursive makes & configure (hence the quoting style) FLAGS_TO_PASS = \ @@ -156,71 +90,48 @@ CROSS_FLAGS_TO_PASS = \ RANLIB_TEST="$(RANLIB_TEST)" \ SHELL="$(SHELL)" -all: ../../include/f2c.h libi77 libf77 libu77 $(lib) - -$(lib): $(FOBJ) $(IOBJ) $(UOBJ) - -$(AR) $(AR_FLAGS) $(lib) $? - if $(RANLIB_TEST); then $(RANLIB) $(lib); \ - else true; fi +all: ../include/f2c.h libi77 libf77 libi77: libI77/Makefile if test "$(CROSS)"; then \ - cd libI77; $(MAKE) -f Makefile $(CROSS_FLAGS_TO_PASS) all ; \ + cd libI77; $(MAKE) $(CROSS_FLAGS_TO_PASS) all ; \ else \ - cd libI77; $(MAKE) -f Makefile $(FLAGS_TO_PASS) all ; \ + cd libI77; $(MAKE) $(FLAGS_TO_PASS) all ; \ fi - libf77: libF77/Makefile if test "$(CROSS)"; then \ - cd libF77; $(MAKE) -f Makefile $(CROSS_FLAGS_TO_PASS) all ; \ + cd libF77; $(MAKE) $(CROSS_FLAGS_TO_PASS) all ; \ else \ - cd libF77; $(MAKE) -f Makefile $(FLAGS_TO_PASS) all ; \ - fi - -libu77: libU77/Makefile - if test "$(CROSS)"; then \ - cd libU77; $(MAKE) -f Makefile $(CROSS_FLAGS_TO_PASS) all ; \ - else \ - cd libU77; $(MAKE) -f Makefile $(FLAGS_TO_PASS) all ; \ + cd libF77; $(MAKE) $(FLAGS_TO_PASS) all ; \ fi ${srcdir}/configure: ${srcdir}/configure.in - rm -f config.cache && cd ${srcdir} -${srcdir}/libU77/configure: ${srcdir}/libU77/configure.in - rm -f libU77/config.cache && cd ${srcdir}/libU77 -#../include/f2c.h libI77/Makefile libF77/Makefile libU77/Makefile Makefile: ${srcdir}/Makefile.in \ -# config.status libU77/config.status -# $(FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) config.status -# cd libU77; $(FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) config.status - + cd ${srcdir} && autoconf && rm -f config.cache +../include/f2c.h libI77/Makefile libF77/Makefile Makefile: Makefile.in \ + config.status + $(FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) config.status # Extra dependencies for the targets above: -libI77/Makefile: $(srcdir)/libI77/Makefile.in -libF77/Makefile: $(srcdir)/libF77/Makefile.in -libU77/Makefile: $(srcdir)/libU77/Makefile.in -../../include/f2c.h: $(srcdir)/f2c.h.in +libI77/Makefile: libI77/Makefile.in +libF77/Makefile: libF77/Makefile.in +# include is linked into .. +../include/f2c.h: f2c.h.in -#config.status: ${srcdir}/configure -# $(FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) config.status --recheck -#libU77/config.status: ${srcdir}/libU77/configure -# cd libU77; $(FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) config.status --recheck +config.status: configure + $(FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) config.status --recheck mostlyclean: - for i in libI77 libF77 libU77; do cd $$i; $(MAKE) -f Makefile mostlyclean; cd ..; done -clean: +clean: mostlyclean -rm -f config.log config.cache - for i in libI77 libF77 libU77; do cd $$i; $(MAKE) -f Makefile clean; cd ..; done + for i in libI77 libF77; do cd $$i; $(MAKE) clean; cd ..; done distclean: clean - -rm -f Makefile lib?77/Makefile config.status libU77/config.status ../../include/f2c.h - -maintainer-clean: distclean - -rm -f $(srcdir)/configure $(srcdir)/libU77/configure + -rm -f Makefile lib?77/Makefile config.status ../include/f2c.h uninstall: - rm ../../include/f2c.h + rm ../include/f2c.h -rebuilt: ${srcdir}/configure ${srcdir}/libU77/configure +rebuilt: ${srcdir}/configure + echo Fortran library rebuildable files rebuilt. -.PHONY: libf77 libi77 libu77 rebuilt mostlyclean clean distclean maintainer-clean \ - uninstall all +.PHONY: libf77 libi77 rebuilt diff --git a/gnu/usr.bin/gcc/f/runtime/README b/gnu/usr.bin/gcc/f/runtime/README index 32b68d36e81..ae93d591e5a 100644 --- a/gnu/usr.bin/gcc/f/runtime/README +++ b/gnu/usr.bin/gcc/f/runtime/README @@ -1,4 +1,4 @@ -970205 +950827 This directory contains the f2c library packaged for use with g77 to configure and build automatically (in principle!) as part of the top-level configure and @@ -26,6 +26,14 @@ Some key changes made by Burley: (#define Pad_UDread), because that's the behavior most users expect. +- f2c.h configured to default to always flushing after output so that + ERR= and IOSTAT= report disk-full errors (assuming the underlying + system library code does that correctly), again because that's the + behavior most users expect (#define ALWAYS_FLUSH). But you should + write CALL FLUSH or CALL FLUSH(IUNIT) as appropriate in your source + code, because auto-flushing will not necessarily be enabled by + default in future versions of g77's run-time library. + - f2c.h configured to default to outputting leading zeros before decimal points in formatted and list-directed output, to be compatible with many other compilers (#define WANT_LEAD_0). Either way is diff --git a/gnu/usr.bin/gcc/f/runtime/TODO b/gnu/usr.bin/gcc/f/runtime/TODO index 513396572fe..526736062e2 100644 --- a/gnu/usr.bin/gcc/f/runtime/TODO +++ b/gnu/usr.bin/gcc/f/runtime/TODO @@ -1,8 +1,8 @@ -970205 +950212 TODO list for the g77 library -* `Makefile.in's should be brought up to standard; I'm not sure they +* `Makefile.in's should be tarted up to standard; I'm not sure they have a complete set of targets at present. * Investigate building shared libraries on systems we know about. @@ -11,6 +11,9 @@ TODO list for the g77 library * Allow the library to be stripped to save space. +* libU77-type routines (and interface to much of libc). Some work has + already been done on this: ask d.love@dl.ac.uk. + * An interface to IEEE maths functions from libc where this makes sense. diff --git a/gnu/usr.bin/gcc/f/runtime/configure b/gnu/usr.bin/gcc/f/runtime/configure index 82388b5aa7c..0f412c86932 100644 --- a/gnu/usr.bin/gcc/f/runtime/configure +++ b/gnu/usr.bin/gcc/f/runtime/configure @@ -1587,7 +1587,7 @@ F2C_INTEGER=long int #elif FFECOM_f2cINTEGER == FFECOM_f2ccodeINT F2C_INTEGER=int #else -# error "Cannot find a suitable type for F2C_INTEGER" +# error Cannot find a suitable type for F2C_INTEGER #endif EOF @@ -1610,7 +1610,7 @@ F2C_INTEGER=long int #elif FFECOM_f2cINTEGER == FFECOM_f2ccodeINT F2C_INTEGER=int #else -# error "Cannot find a suitable type for F2C_INTEGER" +# error Cannot find a suitable type for F2C_INTEGER #endif EOF @@ -1631,72 +1631,7 @@ fi echo "$ac_t""$ac_cv_sys_f2cinteger" 1>&6 F2C_INTEGER=$ac_cv_sys_f2cinteger -ac_cpp=$late_ac_cpp - - -echo $ac_n "checking f2c long int type""... $ac_c" 1>&6 -echo "configure:1639: checking f2c long int type" >&5 -late_ac_cpp=$ac_cpp -ac_cpp="$late_ac_cpp -I$srcdir/.. -I../.. -I$srcdir/../.. -I$srcdir/../../config" -if eval "test \"`echo '$''{'ac_cv_sys_f2clongint'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5 | - egrep "F2C_LONGINT=long int" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_sys_f2clongint="long int" -fi -rm -f conftest* - -if test "$ac_cv_sys_f2clongint" = ""; then - cat > conftest.$ac_ext <&5 | - egrep "F2C_LONGINT=long long int" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_sys_f2clongint="long long int" -fi -rm -f conftest* - -fi -if test "$ac_cv_sys_f2clongint" = ""; then - echo "$ac_t""""" 1>&6 - { echo "configure: error: Can't determine type for f2c long int; config.log may help." 1>&2; exit 1; } -fi - -fi - -echo "$ac_t""$ac_cv_sys_f2clongint" 1>&6 -F2C_LONGINT=$ac_cv_sys_f2clongint -ac_cpp=$late_ac_cpp +ac_cpp=late_ac_cpp @@ -1723,6 +1658,10 @@ EOF +cat >> confdefs.h <<\EOF +#define ALWAYS_FLUSH 1 +EOF + cat >> confdefs.h <<\EOF @@ -1734,7 +1673,6 @@ EOF # got put here test -f libF77/makefile && mv libF77/makefile libF77/makefile.ori test -f libI77/makefile && mv libI77/makefile libI77/makefile.ori -test -f libU77/makefile && mv libU77/makefile libU77/makefile.ori trap '' 1 2 15 cat > confcache <<\EOF @@ -1848,7 +1786,7 @@ done ac_given_srcdir=$srcdir -trap 'rm -fr `echo "Makefile ../../include/f2c.h:f2c.h.in libI77/Makefile libF77/Makefile libU77/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile ../../include/f2c.h:f2c.h.in libI77/Makefile libF77/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/gnu/usr.bin/gcc/f/runtime/configure.in b/gnu/usr.bin/gcc/f/runtime/configure.in index 277dd061114..755894abd6e 100644 --- a/gnu/usr.bin/gcc/f/runtime/configure.in +++ b/gnu/usr.bin/gcc/f/runtime/configure.in @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -# Copyright (C) 1995, 1997 Free Software Foundation, Inc. +# Copyright (C) 1995 Free Software Foundation, Inc. # Contributed by Dave Love (d.love@dl.ac.uk). # #This file is part of GNU Fortran. @@ -204,7 +204,7 @@ F2C_INTEGER=long int #elif FFECOM_f2cINTEGER == FFECOM_f2ccodeINT F2C_INTEGER=int #else -# error "Cannot find a suitable type for F2C_INTEGER" +# error Cannot find a suitable type for F2C_INTEGER #endif ], ac_cv_sys_f2cinteger="long int",) @@ -218,7 +218,7 @@ F2C_INTEGER=long int #elif FFECOM_f2cINTEGER == FFECOM_f2ccodeINT F2C_INTEGER=int #else -# error "Cannot find a suitable type for F2C_INTEGER" +# error Cannot find a suitable type for F2C_INTEGER #endif ], ac_cv_sys_f2cinteger=int,) @@ -230,51 +230,9 @@ fi ) AC_MSG_RESULT($ac_cv_sys_f2cinteger) F2C_INTEGER=$ac_cv_sys_f2cinteger -ac_cpp=$late_ac_cpp +ac_cpp=late_ac_cpp AC_SUBST(F2C_INTEGER) -AC_MSG_CHECKING(f2c long int type) -late_ac_cpp=$ac_cpp -ac_cpp="$late_ac_cpp -I$srcdir/.. -I../.. -I$srcdir/../.. -I$srcdir/../../config" -AC_CACHE_VAL(ac_cv_sys_f2clongint, -AC_EGREP_CPP(F2C_LONGINT=long int, -[#include "proj.h" -#define FFECOM_DETERMINE_TYPES 1 -#include "com.h" -#if FFECOM_f2cLONGINT == FFECOM_f2ccodeLONG -F2C_LONGINT=long int -#elif FFECOM_f2cLONGINT == FFECOM_f2ccodeLONGLONG -F2C_LONGINT=long long int -#else -# error "Cannot find a suitable type for F2C_LONGINT" -#endif -], - ac_cv_sys_f2clongint="long int",) -if test "$ac_cv_sys_f2clongint" = ""; then - AC_EGREP_CPP(F2C_LONGINT=long long int, -[#include "proj.h" -#define FFECOM_DETERMINE_TYPES 1 -#include "com.h" -#if FFECOM_f2cLONGINT == FFECOM_f2ccodeLONG -F2C_LONGINT=long int -#elif FFECOM_f2cLONGINT == FFECOM_f2ccodeLONGLONG -F2C_LONGINT=long long int -#else -# error "Cannot find a suitable type for F2C_LONGINT" -#endif -], - ac_cv_sys_f2clongint="long long int",) -fi -if test "$ac_cv_sys_f2clongint" = ""; then - AC_MSG_RESULT("") - AC_MSG_ERROR([Can't determine type for f2c long int; config.log may help.]) -fi -) -AC_MSG_RESULT($ac_cv_sys_f2clongint) -F2C_LONGINT=$ac_cv_sys_f2clongint -ac_cpp=$late_ac_cpp -AC_SUBST(F2C_LONGINT) - dnl maybe check for drem/remainder AC_SUBST(CROSS) @@ -306,7 +264,7 @@ dnl on a case-by-case basis when it can be shown to not be necessary dnl (e.g. no ERR= or IOSTAT=) or when it is given the appropriate dnl compile-time option or, perhaps, source-code directive. -dnl AC_DEFINE(ALWAYS_FLUSH) +AC_DEFINE(ALWAYS_FLUSH) dnl Most Fortran implementations do this, so to make it easier dnl to compare the output of g77-compiled programs to those compiled @@ -319,9 +277,8 @@ AC_DEFINE(WANT_LEAD_0) # got put here test -f libF77/makefile && mv libF77/makefile libF77/makefile.ori test -f libI77/makefile && mv libI77/makefile libI77/makefile.ori -test -f libU77/makefile && mv libU77/makefile libU77/makefile.ori -AC_OUTPUT(Makefile ../../include/f2c.h:f2c.h.in libI77/Makefile libF77/Makefile libU77/Makefile) +AC_OUTPUT(Makefile ../../include/f2c.h:f2c.h.in libI77/Makefile libF77/Makefile) dnl We might have configuration options to: dnl * allow non-standard string concatenation (use libF77 s_catow.o, diff --git a/gnu/usr.bin/gcc/f/runtime/f2c.h.in b/gnu/usr.bin/gcc/f/runtime/f2c.h.in index 90374678100..9d1d5905bf7 100644 --- a/gnu/usr.bin/gcc/f/runtime/f2c.h.in +++ b/gnu/usr.bin/gcc/f/runtime/f2c.h.in @@ -21,10 +21,14 @@ typedef @F2C_INTEGER@ /* long int */ logical; typedef short int shortlogical; typedef char logical1; typedef char integer1; -typedef @F2C_LONGINT@ /* long long */ longint; /* system-dependent */ -typedef unsigned @F2C_LONGINT@ /* long long */ ulongint; /* system-dependent */ +/* integer*8 support from f2c not currently supported: */ +#if 0 +typedef @F2C_LONGINT@ /* long long */ longint; /* system-dependent */ +typedef unsigned @F2C_LONGINT@ ulongint; /* system-dependent */ #define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) #define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) +#endif +typedef long long int longint; #define TRUE_ (1) #define FALSE_ (0) @@ -37,15 +41,15 @@ typedef unsigned @F2C_LONGINT@ /* long long */ ulongint; /* system-dependent */ /* I/O stuff */ #ifdef f2c_i2 -#error "f2c_i2 will not work with g77!!!!" + #error f2c_i2 will not work with g77!!!! /* for -i2 */ typedef short flag; typedef short ftnlen; typedef short ftnint; #else -typedef @F2C_INTEGER@ /* long int */ flag; -typedef @F2C_INTEGER@ /* long int */ ftnlen; -typedef @F2C_INTEGER@ /* long int */ ftnint; +typedef @F2C_INTEGER@ /* int or long int */ flag; +typedef @F2C_INTEGER@ /* int or long int */ ftnlen; +typedef @F2C_INTEGER@ /* int or long int */ ftnint; #endif /*external read, write*/ diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/Makefile.in b/gnu/usr.bin/gcc/f/runtime/libF77/Makefile.in index a5ca2a65859..164c7bcef38 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/Makefile.in +++ b/gnu/usr.bin/gcc/f/runtime/libF77/Makefile.in @@ -38,7 +38,7 @@ DEFS = @DEFS@ CGFLAGS = -g0 # f2c.h should already be installed in xgcc's include directory but add that # to -I anyhow in case not using xgcc. -ALL_CFLAGS = -I. -I$(srcdir) -I../../../include $(CPPFLAGS) $(DEFS) $(CFLAGS) +ALL_CFLAGS = -I$(srcdir) -I../../../include $(CPPFLAGS) $(DEFS) $(CFLAGS) AR = @AR@ AR_FLAGS = rc RANLIB = @RANLIB@ @@ -50,12 +50,15 @@ CROSS = @CROSS@ .c.o: $(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $(CGFLAGS) $< +# Next two lines were removed because Solaris doesn't like `ld -x', and +# it seems there's no real benefit to doing this anyway. +# ld -r -x -o $@x $@ +# mv $@x $@ MISC = F77_aloc.o VersionF.o main.o s_rnge.o abort_.o getarg_.o iargc_.o\ getenv_.o signal_.o s_stop.o s_paus.o system_.o cabs.o\ derf_.o derfc_.o erf_.o erfc_.o sig_die.o exit.o -POW = pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o pow_ri.o pow_zi.o pow_zz.o \ - pow_qq.o +POW = pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o pow_ri.o pow_zi.o pow_zz.o CX = c_abs.o c_cos.o c_div.o c_exp.o c_log.o c_sin.o c_sqrt.o DCX = z_abs.o z_cos.o z_div.o z_exp.o z_log.o z_sin.o z_sqrt.o REAL = r_abs.o r_acos.o r_asin.o r_atan.o r_atn2.o r_cnjg.o r_cos.o\ @@ -72,24 +75,40 @@ HALF = h_abs.o h_dim.o h_dnnt.o h_indx.o h_len.o h_mod.o h_nint.o h_sign.o CMP = l_ge.o l_gt.o l_le.o l_lt.o hl_ge.o hl_gt.o hl_le.o hl_lt.o EFL = ef1asc_.o ef1cmc_.o CHAR = s_cat.o s_cmp.o s_copy.o -F90BIT = lbitbits.o lbitshft.o qbitbits.o qbitshft.o +F90BIT = lbitbits.o lbitshft.o -F2C_H = ../../../include/f2c.h +lib = ../../../libf2c.a -all: $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) \ - $(HALF) $(CMP) $(EFL) $(CHAR) $(F90BIT) +F2C_H = ../../include/f2c.h + +all: $(lib) + +$(lib): force $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) \ + $(HALF) $(CMP) $(EFL) $(CHAR) +# Don't worry if ar fails, that can happen when a root-like user installs a +# system built by a user to which the installer has insufficient access +# to modify libf2c.a. Probably a better solution to this should be +# found, but this should do for now. -- burley 951226 + -$(AR) $(AR_FLAGS) $(lib) $(MISC) $(POW) $(CX) $(DCX) $(REAL) \ + $(DBL) $(INT) $(HALF) $(CMP) $(EFL) $(CHAR) + if $(RANLIB_TEST); then $(RANLIB) $(lib); \ + else true; fi + +uninstall: +install: VersionF.o: Version.c $(CC) -c $(CGFLAGS) -o $@ $(srcdir)/Version.c +# Next two lines were removed because Solaris doesn't like `ld -x', and +# it seems there's no real benefit to doing this anyway. +# ld -r -x -o $@x $@ +# mv $@x $@ -mostlyclean clean: - -rm -f *.o - -distclean maintainer-clean: clean - -rm -f stage? include Makefile +clean: + rm -f *.o # Not quite all these actually do depend on f2c.h... $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) \ - $(HALF) $(CMP) $(EFL) $(CHAR) $(F90BIT): $(F2C_H) + $(HALF) $(CMP) $(EFL) $(CHAR): $(F2C_H) $(F90BIT) -.PHONY: mostlyclean clean distclean maintainer-clean all +force: diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/Version.c b/gnu/usr.bin/gcc/f/runtime/libF77/Version.c index 3ff823b199e..d38e01d1907 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/Version.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/Version.c @@ -3,7 +3,7 @@ static char junk[] = "\n@(#)LIBF77 VERSION 19960619\n"; /* */ -char __G77_LIBF77_VERSION__[] = "0.5.20"; +char __G77_LIBF77_VERSION__[] = "0.5.19"; /* 2.00 11 June 1980. File version.c added to library. @@ -52,8 +52,7 @@ char __G77_LIBF77_VERSION__[] = "0.5.20"; #include void -g77__fvers__ () +g77_libf77_version () { - fprintf (stderr, "__G77_LIBF77_VERSION__: %s", __G77_LIBF77_VERSION__); - fputs (junk, stderr); + fprintf (stderr, "__G77_LIBF77_VERSION__: %s\n", __G77_LIBF77_VERSION__); } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/c_cos.c b/gnu/usr.bin/gcc/f/runtime/libF77/c_cos.c index 9e833c168b3..09c8719848f 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/c_cos.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/c_cos.c @@ -3,19 +3,14 @@ #ifdef KR_headers extern double sin(), cos(), sinh(), cosh(); -VOID c_cos(resx, z) complex *resx, *z; +VOID c_cos(r, z) complex *r, *z; #else #undef abs #include -void c_cos(complex *resx, complex *z) +void c_cos(complex *r, complex *z) #endif { -complex res; - -res.r = cos(z->r) * cosh(z->i); -res.i = - sin(z->r) * sinh(z->i); - -resx->r = res.r; -resx->i = res.i; +r->r = cos(z->r) * cosh(z->i); +r->i = - sin(z->r) * sinh(z->i); } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/c_div.c b/gnu/usr.bin/gcc/f/runtime/libF77/c_div.c index 9568354bd53..0bb56b485e1 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/c_div.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/c_div.c @@ -2,16 +2,15 @@ #ifdef KR_headers extern VOID sig_die(); -VOID c_div(resx, a, b) -complex *a, *b, *resx; +VOID c_div(c, a, b) +complex *a, *b, *c; #else extern void sig_die(char*,int); -void c_div(complex *resx, complex *a, complex *b) +void c_div(complex *c, complex *a, complex *b) #endif { double ratio, den; double abr, abi; -complex res; if( (abr = b->r) < 0.) abr = - abr; @@ -23,18 +22,15 @@ if( abr <= abi ) sig_die("complex division by zero", 1); ratio = (double)b->r / b->i ; den = b->i * (1 + ratio*ratio); - res.r = (a->r*ratio + a->i) / den; - res.i = (a->i*ratio - a->r) / den; + c->r = (a->r*ratio + a->i) / den; + c->i = (a->i*ratio - a->r) / den; } else { ratio = (double)b->i / b->r ; den = b->r * (1 + ratio*ratio); - res.r = (a->r + a->i*ratio) / den; - res.i = (a->i - a->r*ratio) / den; + c->r = (a->r + a->i*ratio) / den; + c->i = (a->i - a->r*ratio) / den; } - -resx->r = res.r; -resx->i = res.i; } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/c_exp.c b/gnu/usr.bin/gcc/f/runtime/libF77/c_exp.c index 8d3d33d0fe3..68aebd3dbfb 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/c_exp.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/c_exp.c @@ -3,21 +3,17 @@ #ifdef KR_headers extern double exp(), cos(), sin(); - VOID c_exp(resx, z) complex *resx, *z; + VOID c_exp(r, z) complex *r, *z; #else #undef abs #include -void c_exp(complex *resx, complex *z) +void c_exp(complex *r, complex *z) #endif { double expx; -complex res; expx = exp(z->r); -res.r = expx * cos(z->i); -res.i = expx * sin(z->i); - -resx->r = res.r; -resx->i = res.i; +r->r = expx * cos(z->i); +r->i = expx * sin(z->i); } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/c_log.c b/gnu/usr.bin/gcc/f/runtime/libF77/c_log.c index 6715131ad1d..39dcfa50967 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/c_log.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/c_log.c @@ -2,20 +2,15 @@ #ifdef KR_headers extern double log(), f__cabs(), atan2(); -VOID c_log(resx, z) complex *resx, *z; +VOID c_log(r, z) complex *r, *z; #else #undef abs #include extern double f__cabs(double, double); -void c_log(complex *resx, complex *z) +void c_log(complex *r, complex *z) #endif { -complex res; - -res.i = atan2(z->i, z->r); -res.r = log( f__cabs(z->r, z->i) ); - -resx->r = res.r; -resx->i = res.i; +r->i = atan2(z->i, z->r); +r->r = log( f__cabs(z->r, z->i) ); } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/c_sin.c b/gnu/usr.bin/gcc/f/runtime/libF77/c_sin.c index 7bf3e392bed..620360ce53e 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/c_sin.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/c_sin.c @@ -3,19 +3,14 @@ #ifdef KR_headers extern double sin(), cos(), sinh(), cosh(); -VOID c_sin(resx, z) complex *resx, *z; +VOID c_sin(r, z) complex *r, *z; #else #undef abs #include -void c_sin(complex *resx, complex *z) +void c_sin(complex *r, complex *z) #endif { -complex res; - -res.r = sin(z->r) * cosh(z->i); -res.i = cos(z->r) * sinh(z->i); - -resx->r = res.r; -resx->i = res.i; +r->r = sin(z->r) * cosh(z->i); +r->i = cos(z->r) * sinh(z->i); } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/c_sqrt.c b/gnu/usr.bin/gcc/f/runtime/libF77/c_sqrt.c index 775977a87f7..4095ce17b5b 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/c_sqrt.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/c_sqrt.c @@ -3,36 +3,32 @@ #ifdef KR_headers extern double sqrt(), f__cabs(); -VOID c_sqrt(resx, z) complex *resx, *z; +VOID c_sqrt(r, z) complex *r, *z; #else #undef abs #include extern double f__cabs(double, double); -void c_sqrt(complex *resx, complex *z) +void c_sqrt(complex *r, complex *z) #endif { double mag, t; -complex res; if( (mag = f__cabs(z->r, z->i)) == 0.) - res.r = res.i = 0.; + r->r = r->i = 0.; else if(z->r > 0) { - res.r = t = sqrt(0.5 * (mag + z->r) ); + r->r = t = sqrt(0.5 * (mag + z->r) ); t = z->i / t; - res.i = 0.5 * t; + r->i = 0.5 * t; } else { t = sqrt(0.5 * (mag - z->r) ); if(z->i < 0) t = -t; - res.i = t; + r->i = t; t = z->i / t; - res.r = 0.5 * t; + r->r = 0.5 * t; } - -resx->r = res.r; -resx->i = res.i; } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/d_cnjg.c b/gnu/usr.bin/gcc/f/runtime/libF77/d_cnjg.c index 1afa3bc4061..c778c38758c 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/d_cnjg.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/d_cnjg.c @@ -2,16 +2,11 @@ VOID #ifdef KR_headers -d_cnjg(resx, z) doublecomplex *resx, *z; +d_cnjg(r, z) doublecomplex *r, *z; #else -d_cnjg(doublecomplex *resx, doublecomplex *z) +d_cnjg(doublecomplex *r, doublecomplex *z) #endif { -doublecomplex res; - -res.r = z->r; -res.i = - z->i; - -resx->r = res.r; -resx->i = res.i; +r->r = z->r; +r->i = - z->i; } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/pow_zi.c b/gnu/usr.bin/gcc/f/runtime/libF77/pow_zi.c index 898ea6be917..167e6acbc6a 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/pow_zi.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/pow_zi.c @@ -1,32 +1,25 @@ #include "f2c.h" #ifdef KR_headers -VOID pow_zi(resx, a, b) /* p = a**b */ - doublecomplex *resx, *a; integer *b; +VOID pow_zi(p, a, b) /* p = a**b */ + doublecomplex *p, *a; integer *b; #else extern void z_div(doublecomplex*, doublecomplex*, doublecomplex*); -void pow_zi(doublecomplex *resx, doublecomplex *a, integer *b) /* p = a**b */ +void pow_zi(doublecomplex *p, doublecomplex *a, integer *b) /* p = a**b */ #endif { integer n; unsigned long u; double t; doublecomplex x; -doublecomplex res; static doublecomplex one = {1.0, 0.0}; n = *b; +p->r = 1; +p->i = 0; if(n == 0) - { - resx->r = 1; - resx->i = 0; return; - } - -res.r = 1; -res.i = 0; - if(n < 0) { n = -n; @@ -42,9 +35,9 @@ for(u = n; ; ) { if(u & 01) { - t = res.r * x.r - res.i * x.i; - res.i = res.r * x.i + res.i * x.r; - res.r = t; + t = p->r * x.r - p->i * x.i; + p->i = p->r * x.i + p->i * x.r; + p->r = t; } if(u >>= 1) { @@ -55,7 +48,4 @@ for(u = n; ; ) else break; } - -resx->r = res.r; -resx->i = res.i; } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/r_cnjg.c b/gnu/usr.bin/gcc/f/runtime/libF77/r_cnjg.c index b6175eedfd7..e127ca969c4 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/r_cnjg.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/r_cnjg.c @@ -1,16 +1,11 @@ #include "f2c.h" #ifdef KR_headers -VOID r_cnjg(resx, z) complex *resx, *z; +VOID r_cnjg(r, z) complex *r, *z; #else -VOID r_cnjg(complex *resx, complex *z) +VOID r_cnjg(complex *r, complex *z) #endif { -complex res; - -res.r = z->r; -res.i = - z->i; - -resx->r = res.r; -resx->i = res.i; +r->r = z->r; +r->i = - z->i; } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/s_cat.c b/gnu/usr.bin/gcc/f/runtime/libF77/s_cat.c index 90a89be4b0c..7bfb11eb881 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/s_cat.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/s_cat.c @@ -12,8 +12,6 @@ extern void free(); extern void exit_(); #else -#undef min -#undef max #include extern char *F77_aloc(ftnlen, char*); #endif diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/s_paus.c b/gnu/usr.bin/gcc/f/runtime/libF77/s_paus.c index e78fa27a5a0..6a2e86e1262 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/s_paus.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/s_paus.c @@ -60,7 +60,7 @@ s_paus(char *s, ftnlen n) if( isatty(fileno(stdin)) ) s_1paus(stdin); else { -#if (defined (MSDOS) && !defined (GO32)) || defined(__CYGWIN32__) +#if defined (MSDOS) && !defined (GO32) FILE *fin; fin = fopen("con", "r"); if (!fin) { diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/signal_.c b/gnu/usr.bin/gcc/f/runtime/libF77/signal_.c index ce58d71b257..d848bf564d6 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/signal_.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/signal_.c @@ -25,4 +25,5 @@ ftnint signal_(integer *sigp, sig_proc proc) sig = (int)*sigp; return (ftnint)signal(sig, (sig_type)proc); + return 0; } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/z_cos.c b/gnu/usr.bin/gcc/f/runtime/libF77/z_cos.c index a811bbecc65..ef02be4c38c 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/z_cos.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/z_cos.c @@ -2,18 +2,13 @@ #ifdef KR_headers double sin(), cos(), sinh(), cosh(); -VOID z_cos(resx, z) doublecomplex *resx, *z; +VOID z_cos(r, z) doublecomplex *r, *z; #else #undef abs #include -void z_cos(doublecomplex *resx, doublecomplex *z) +void z_cos(doublecomplex *r, doublecomplex *z) #endif { -doublecomplex res; - -res.r = cos(z->r) * cosh(z->i); -res.i = - sin(z->r) * sinh(z->i); - -resx->r = res.r; -resx->i = res.i; +r->r = cos(z->r) * cosh(z->i); +r->i = - sin(z->r) * sinh(z->i); } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/z_div.c b/gnu/usr.bin/gcc/f/runtime/libF77/z_div.c index 88487210ef5..fd53733e882 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/z_div.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/z_div.c @@ -2,15 +2,14 @@ #ifdef KR_headers extern void sig_die(); -VOID z_div(resx, a, b) doublecomplex *a, *b, *resx; +VOID z_div(c, a, b) doublecomplex *a, *b, *c; #else extern void sig_die(char*, int); -void z_div(doublecomplex *resx, doublecomplex *a, doublecomplex *b) +void z_div(doublecomplex *c, doublecomplex *a, doublecomplex *b) #endif { double ratio, den; double abr, abi; -doublecomplex res; if( (abr = b->r) < 0.) abr = - abr; @@ -22,18 +21,16 @@ if( abr <= abi ) sig_die("complex division by zero", 1); ratio = b->r / b->i ; den = b->i * (1 + ratio*ratio); - res.r = (a->r*ratio + a->i) / den; - res.i = (a->i*ratio - a->r) / den; + c->r = (a->r*ratio + a->i) / den; + c->i = (a->i*ratio - a->r) / den; } else { ratio = b->i / b->r ; den = b->r * (1 + ratio*ratio); - res.r = (a->r + a->i*ratio) / den; - res.i = (a->i - a->r*ratio) / den; + c->r = (a->r + a->i*ratio) / den; + c->i = (a->i - a->r*ratio) / den; } -resx->r = res.r; -resx->i = res.i; } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/z_exp.c b/gnu/usr.bin/gcc/f/runtime/libF77/z_exp.c index 85fb63e4209..4e94a14b4cc 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/z_exp.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/z_exp.c @@ -2,20 +2,16 @@ #ifdef KR_headers double exp(), cos(), sin(); -VOID z_exp(resx, z) doublecomplex *resx, *z; +VOID z_exp(r, z) doublecomplex *r, *z; #else #undef abs #include -void z_exp(doublecomplex *resx, doublecomplex *z) +void z_exp(doublecomplex *r, doublecomplex *z) #endif { double expx; -doublecomplex res; expx = exp(z->r); -res.r = expx * cos(z->i); -res.i = expx * sin(z->i); - -resx->r = res.r; -resx->i = res.i; +r->r = expx * cos(z->i); +r->i = expx * sin(z->i); } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/z_log.c b/gnu/usr.bin/gcc/f/runtime/libF77/z_log.c index 48afca63d6d..097c0a1b120 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/z_log.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/z_log.c @@ -2,19 +2,15 @@ #ifdef KR_headers double log(), f__cabs(), atan2(); -VOID z_log(resx, z) doublecomplex *resx, *z; +VOID z_log(r, z) doublecomplex *r, *z; #else #undef abs #include extern double f__cabs(double, double); -void z_log(doublecomplex *resx, doublecomplex *z) +void z_log(doublecomplex *r, doublecomplex *z) #endif { -doublecomplex res; -res.i = atan2(z->i, z->r); -res.r = log( f__cabs( z->r, z->i ) ); - -resx->r = res.r; -resx->i = res.i; +r->i = atan2(z->i, z->r); +r->r = log( f__cabs( z->r, z->i ) ); } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/z_sin.c b/gnu/usr.bin/gcc/f/runtime/libF77/z_sin.c index 94456c9c30a..dece95e5c60 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/z_sin.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/z_sin.c @@ -2,18 +2,13 @@ #ifdef KR_headers double sin(), cos(), sinh(), cosh(); -VOID z_sin(resx, z) doublecomplex *resx, *z; +VOID z_sin(r, z) doublecomplex *r, *z; #else #undef abs #include -void z_sin(doublecomplex *resx, doublecomplex *z) +void z_sin(doublecomplex *r, doublecomplex *z) #endif { -doublecomplex res; - -res.r = sin(z->r) * cosh(z->i); -res.i = cos(z->r) * sinh(z->i); - -resx->r = res.r; -resx->i = res.i; +r->r = sin(z->r) * cosh(z->i); +r->i = cos(z->r) * sinh(z->i); } diff --git a/gnu/usr.bin/gcc/f/runtime/libF77/z_sqrt.c b/gnu/usr.bin/gcc/f/runtime/libF77/z_sqrt.c index f5db5651991..a469703129b 100644 --- a/gnu/usr.bin/gcc/f/runtime/libF77/z_sqrt.c +++ b/gnu/usr.bin/gcc/f/runtime/libF77/z_sqrt.c @@ -2,32 +2,28 @@ #ifdef KR_headers double sqrt(), f__cabs(); -VOID z_sqrt(resx, z) doublecomplex *resx, *z; +VOID z_sqrt(r, z) doublecomplex *r, *z; #else #undef abs #include extern double f__cabs(double, double); -void z_sqrt(doublecomplex *resx, doublecomplex *z) +void z_sqrt(doublecomplex *r, doublecomplex *z) #endif { double mag; -doublecomplex res; if( (mag = f__cabs(z->r, z->i)) == 0.) - res.r = res.i = 0.; + r->r = r->i = 0.; else if(z->r > 0) { - res.r = sqrt(0.5 * (mag + z->r) ); - res.i = z->i / res.r / 2; + r->r = sqrt(0.5 * (mag + z->r) ); + r->i = z->i / r->r / 2; } else { - res.i = sqrt(0.5 * (mag - z->r) ); + r->i = sqrt(0.5 * (mag - z->r) ); if(z->i < 0) - res.i = - res.i; - res.r = z->i / res.i / 2; + r->i = - r->i; + r->r = z->i / r->i / 2; } - -resx->r = res.r; -resx->i = res.i; } diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/Makefile.in b/gnu/usr.bin/gcc/f/runtime/libI77/Makefile.in index 34bc5fa3997..9dde6519245 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/Makefile.in +++ b/gnu/usr.bin/gcc/f/runtime/libI77/Makefile.in @@ -38,7 +38,7 @@ DEFS = @DEFS@ CGFLAGS = -g0 # f2c.h should already be installed in xgcc's include directory but add that # to -I anyhow in case not using xgcc. -ALL_CFLAGS = -I. -I$(srcdir) -I../../../include $(CPPFLAGS) $(DEFS) $(CFLAGS) +ALL_CFLAGS = -I$(srcdir) -I../../../include $(CPPFLAGS) $(DEFS) $(CFLAGS) AR = @AR@ AR_FLAGS = rc RANLIB = @RANLIB@ @@ -50,6 +50,10 @@ CROSS = @CROSS@ .c.o: $(CC) -c -DSkip_f2c_Undefs -DAllow_TYQUAD $(ALL_CFLAGS) $(CGFLAGS) $< +# Next two lines were removed because Solaris doesn't like `ld -x', and +# it seems there's no real benefit to doing this anyway. +# ld -r -x -o $@x $@ +# mv $@x $@ OBJ = VersionI.o backspace.o close.o dfe.o dolio.o due.o endfile.o err.o \ fmt.o fmtlib.o iio.o ilnw.o inquire.o lread.o lwrite.o open.o \ @@ -57,18 +61,33 @@ OBJ = VersionI.o backspace.o close.o dfe.o dolio.o due.o endfile.o err.o \ util.o wref.o wrtfmt.o wsfe.o wsle.o wsne.o xwsne.o \ ftell_.o -F2C_H = ../../../include/f2c.h +lib = ../../../libf2c.a -all: $(OBJ) +F2C_H = ../../include/f2c.h + +all: $(F2C_H) $(lib) + +$(lib): force $(OBJ) +# Don't worry if ar fails, that can happen when a root-like user installs a +# system built by a user to which the installer has insufficient access +# to modify libf2c.a. Probably a better solution to this should be +# found, but this should do for now. -- burley 951226 + -$(AR) $(AR_FLAGS) $(lib) $(OBJ) + if $(RANLIB_TEST); then $(RANLIB) $(lib); \ + else true; fi + +uninstall: +install: VersionI.o: Version.c $(CC) -c $(CGFLAGS) -o $@ $(srcdir)/Version.c +# Next two lines were removed because Solaris doesn't like `ld -x', and +# it seems there's no real benefit to doing this anyway. +# ld -r -x -o $@x $@ +# mv $@x $@ -mostlyclean clean: - -rm -f $(OBJ) - -distclean maintainer-clean: mostlyclean - -rm -f stage? include Makefile +clean: + rm -f $(OBJ) backspace.o: fio.h close.o: fio.h @@ -126,4 +145,4 @@ xwsne.o: fmt.h # May be pessimistic: $(OBJ): $(F2C_H) -.PHONY: mostlyclean clean distclean maintainer-clean all +force: diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/README b/gnu/usr.bin/gcc/f/runtime/libI77/README index daa6f6d2be1..3e822f8c506 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/README +++ b/gnu/usr.bin/gcc/f/runtime/libI77/README @@ -32,9 +32,6 @@ number of characters transmitted -- then insert the line at the end of fmt.h . This is necessary with at least some versions of Sun and DEC software. -In particular, if you get a warning about an improper -pointer/integer combination in compiling wref.c, then -you need to compile with -DUSE_STRLEN . If your system's fopen does not like the ANSI binary reading and writing modes "rb" and "wb", then you should diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/Version.c b/gnu/usr.bin/gcc/f/runtime/libI77/Version.c index d65c937b2bc..f59a17679db 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/Version.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/Version.c @@ -1,9 +1,9 @@ -static char junk[] = "\n@(#) LIBI77 VERSION pjw,dmg-mods 19961209\n"; +static char junk[] = "\n@(#) LIBI77 VERSION pjw,dmg-mods 19960925\n"; /* */ -char __G77_LIBI77_VERSION__[] = "0.5.20"; +char __G77_LIBI77_VERSION__[] = "0.5.19"; /* 2.01 $ format added @@ -242,15 +242,11 @@ wrtfmt.c: integer*1 values trouble you when using a K&R C compiler, switch to an ANSI compiler or use a compiler flag that makes characters signed. */ -/* 9 Dec. 1996: d[fu]e.c, err.c: complain about non-positive rec= - in direct read and write statements. - ftell_.c: change param "unit" to "Unit" for -DKR_headers. */ #include void -g77__ivers__ () +g77_libi77_version () { - fprintf (stderr, "__G77_LIBI77_VERSION__: %s", __G77_LIBI77_VERSION__); - fputs (junk, stderr); + fprintf (stderr, "__G77_LIBI77_VERSION__: %s\n", __G77_LIBI77_VERSION__); } diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/backspace.c b/gnu/usr.bin/gcc/f/runtime/libI77/backspace.c index d8e0b63bcfd..f995db22ed9 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/backspace.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/backspace.c @@ -15,9 +15,9 @@ integer f_back(alist *a) long x, y; char buf[32]; if(a->aunit >= MXUNIT || a->aunit < 0) - err(a->aerr,101,"backspace"); + err(a->aerr,101,"backspace") b= &f__units[a->aunit]; - if(b->useek==0) err(a->aerr,106,"backspace"); + if(b->useek==0) err(a->aerr,106,"backspace") if(b->ufd==NULL) { fk_open(1, 1, a->aunit); return(0); @@ -29,7 +29,7 @@ integer f_back(alist *a) if(b->uwrt) { (void) t_runc(a); if (f__nowreading(b)) - err(a->aerr,errno,"backspace"); + err(a->aerr,errno,"backspace") } if(b->url>0) { @@ -93,7 +93,7 @@ integer f_back(alist *a) (void) fseek(b->ufd, 0L, SEEK_SET); return(0); } - else if(n<=0) err(a->aerr,(EOF),"backspace"); + else if(n<=0) err(a->aerr,(EOF),"backspace") (void) fseek(b->ufd, x, SEEK_SET); } } diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/dfe.c b/gnu/usr.bin/gcc/f/runtime/libI77/dfe.c index 334c1dc9004..86fbe8ebb28 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/dfe.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/dfe.c @@ -93,11 +93,9 @@ c_dfe(cilist *a) if(f__curunit->ufd==NULL && fk_open(DIR,FMT,a->ciunit)) err(a->cierr,104,"dfe"); f__cf=f__curunit->ufd; - if(!f__curunit->ufmt) err(a->cierr,102,"dfe"); - if(!f__curunit->useek) err(a->cierr,104,"dfe"); + if(!f__curunit->ufmt) err(a->cierr,102,"dfe") + if(!f__curunit->useek) err(a->cierr,104,"dfe") f__fmtbuf=a->cifmt; - if(a->cirec <= 0) - err(a->cierr,130,"dfe"); (void) fseek(f__cf,(long)f__curunit->url * (a->cirec-1),SEEK_SET); f__curunit->uend = 0; return(0); @@ -110,8 +108,8 @@ integer s_rdfe(cilist *a) { int n; if(!f__init) f_init(); - f__reading=1; if(n=c_dfe(a))return(n); + f__reading=1; if(f__curunit->uwrt && f__nowreading(f__curunit)) err(a->cierr,errno,"read start"); f__getn = y_getc; @@ -132,8 +130,8 @@ integer s_wdfe(cilist *a) { int n; if(!f__init) f_init(); - f__reading=0; if(n=c_dfe(a)) return(n); + f__reading=0; if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit)) err(a->cierr,errno,"startwrt"); f__putn = y_putc; diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/due.c b/gnu/usr.bin/gcc/f/runtime/libI77/due.c index f32e44af2f7..d5ade7ac057 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/due.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/due.c @@ -16,11 +16,9 @@ c_due(cilist *a) f__elist=a; if(f__curunit->ufd==NULL && fk_open(DIR,UNF,a->ciunit) ) err(a->cierr,104,"due"); f__cf=f__curunit->ufd; - if(f__curunit->ufmt) err(a->cierr,102,"cdue"); - if(!f__curunit->useek) err(a->cierr,104,"cdue"); - if(f__curunit->ufd==NULL) err(a->cierr,114,"cdue"); - if(a->cirec <= 0) - err(a->cierr,130,"due"); + if(f__curunit->ufmt) err(a->cierr,102,"cdue") + if(!f__curunit->useek) err(a->cierr,104,"cdue") + if(f__curunit->ufd==NULL) err(a->cierr,114,"cdue") (void) fseek(f__cf,(long)(a->cirec-1)*f__curunit->url,SEEK_SET); f__curunit->uend = 0; return(0); @@ -32,8 +30,8 @@ integer s_rdue(cilist *a) #endif { int n; - f__reading=1; if(n=c_due(a)) return(n); + f__reading=1; if(f__curunit->uwrt && f__nowreading(f__curunit)) err(a->cierr,errno,"read start"); return(0); @@ -45,8 +43,8 @@ integer s_wdue(cilist *a) #endif { int n; - f__reading=0; if(n=c_due(a)) return(n); + f__reading=0; if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit)) err(a->cierr,errno,"write start"); return(0); diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/err.c b/gnu/usr.bin/gcc/f/runtime/libI77/err.c index 4f785cac1f4..171cb97f145 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/err.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/err.c @@ -6,7 +6,7 @@ #include "fio.h" #include "fmt.h" /* for struct syl */ #include "rawio.h" /* for fcntl.h, fdopen */ -#if defined (NON_UNIX_STDIO) || defined (MISSING_FILE_ELEMS) +#ifdef NON_UNIX_STDIO #ifdef KR_headers extern char *malloc(); #else @@ -75,8 +75,7 @@ char *F_err[] = "can't read file", /* 126 */ "can't write file", /* 127 */ "'new' file exists", /* 128 */ - "can't append to file", /* 129 */ - "non-positive record number" /* 130 */ + "can't append to file" /* 129 */ }; #define MAXERR (sizeof(F_err)/sizeof(char *)+100) diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/fio.h b/gnu/usr.bin/gcc/f/runtime/libI77/fio.h index 26354e44360..d3b8c275c8e 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/fio.h +++ b/gnu/usr.bin/gcc/f/runtime/libI77/fio.h @@ -80,8 +80,8 @@ extern int (*f__doend)(Void); extern FILE *f__cf; /*current file*/ extern unit *f__curunit; /*current unit*/ extern unit f__units[]; -#define err(f,m,s) do {if(f) errno= m; else f__fatal(m,s); return(m);} while(0) -#define errfl(f,m,s) do {return err__fl((int)f,m,s);} while(0) +#define err(f,m,s) {if(f) errno= m; else f__fatal(m,s); return(m);} +#define errfl(f,m,s) return err__fl((int)f,m,s) /*Table sizes*/ #define MXUNIT 100 diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/fmtlib.c b/gnu/usr.bin/gcc/f/runtime/libI77/fmtlib.c index 91483fc5290..1c6801e68b5 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/fmtlib.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/fmtlib.c @@ -5,8 +5,6 @@ #ifndef Allow_TYQUAD #undef longint #define longint long -#undef ulongint -#define ulongint unsigned long #endif #ifdef KR_headers @@ -15,17 +13,13 @@ char *f__icvt(value,ndigit,sign, base) longint value; int *ndigit,*sign; #else char *f__icvt(longint value, int *ndigit, int *sign, int base) #endif -{ - static char buf[MAXINTLENGTH+1]; +{ static char buf[MAXINTLENGTH+1]; register int i; - ulongint uvalue; - if(value > 0) { - uvalue = value; + if(value > 0) *sign = 0; - } else if (value < 0) { - uvalue = -value; + value = -value; *sign = 1; } else { @@ -36,10 +30,10 @@ char *f__icvt(longint value, int *ndigit, int *sign, int base) } i = MAXINTLENGTH; do { - buf[--i] = (uvalue%base) + '0'; - uvalue /= base; + buf[--i] = (value%base) + '0'; + value /= base; } - while(uvalue > 0); + while(value > 0); *ndigit = MAXINTLENGTH - i; return &buf[i]; } diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/ftell_.c b/gnu/usr.bin/gcc/f/runtime/libI77/ftell_.c index f3a69738d3d..8e5b825326d 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/ftell_.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/ftell_.c @@ -3,32 +3,32 @@ static FILE * #ifdef KR_headers -unit_chk(Unit, who) integer Unit; char *who; +unit_chk(unit, who) integer unit; char *who; #else -unit_chk(integer Unit, char *who) +unit_chk(integer unit, char *who) #endif { - if (Unit >= MXUNIT || Unit < 0) + if (unit >= MXUNIT || unit < 0) f__fatal(101, who); - return f__units[Unit].ufd; + return f__units[unit].ufd; } integer #ifdef KR_headers -ftell_(Unit) integer *Unit; +ftell_(unit) integer *unit; #else -ftell_(integer *Unit) +ftell_(integer *unit) #endif { FILE *f; - return (f = unit_chk(*Unit, "ftell")) ? ftell(f) : -1L; + return (f = unit_chk(*unit, "ftell")) ? ftell(f) : -1L; } int #ifdef KR_headers -fseek_(Unit, offset, xwhence) integer *Unit, *offset, *xwhence; +fseek_(unit, offset, xwhence) integer *unit, *offset, *xwhence; #else -fseek_(integer *Unit, integer *offset, integer *xwhence) +fseek_(integer *unit, integer *offset, integer *xwhence) #endif { int whence; @@ -49,6 +49,6 @@ fseek_(integer *Unit, integer *offset, integer *xwhence) break; } - return !(f = unit_chk(*Unit, "fseek")) + return !(f = unit_chk(*unit, "fseek")) || fseek(f, *offset, whence) ? 1 : 0; } diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/lread.c b/gnu/usr.bin/gcc/f/runtime/libI77/lread.c index 5ed2bb53dab..b987a5f18ab 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/lread.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/lread.c @@ -500,7 +500,7 @@ c_le(cilist *a) if(f__curunit->ufd==NULL && fk_open(SEQ,FMT,a->ciunit)) err(a->cierr,102,"lio"); f__cf=f__curunit->ufd; - if(!f__curunit->ufmt) err(a->cierr,103,"lio"); + if(!f__curunit->ufmt) err(a->cierr,103,"lio") return(0); } #ifdef KR_headers @@ -517,14 +517,14 @@ l_read(ftnint *number, char *ptr, ftnlen len, ftnint type) { if(f__lquit) return(0); if(l_eof) - err(f__elist->ciend, EOF, "list in"); + err(f__elist->ciend, EOF, "list in") if(f__lcount == 0) { f__ltype = 0; for(;;) { GETC(ch); switch(ch) { case EOF: - err(f__elist->ciend,(EOF),"list in"); + err(f__elist->ciend,(EOF),"list in") case ' ': case '\t': case '\n': diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/open.c b/gnu/usr.bin/gcc/f/runtime/libI77/open.c index 4ef02df94d3..14f1c7815a7 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/open.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/open.c @@ -82,7 +82,7 @@ integer f_open(olist *a) struct stat stb; #endif if(a->ounit>=MXUNIT || a->ounit<0) - err(a->oerr,101,"open"); + err(a->oerr,101,"open") if (!f__init) f_init(); f__curunit = b = &f__units[a->ounit]; @@ -125,7 +125,7 @@ integer f_open(olist *a) if (a->ofnm) { g_char(a->ofnm,a->ofnmlen,buf); if (!buf[0]) - err(a->oerr,107,"open"); + err(a->oerr,107,"open") } else sprintf(buf, "fort.%ld", a->ounit); @@ -139,7 +139,7 @@ integer f_open(olist *a) #else if(stat(buf,&stb)) #endif - err(a->oerr,errno,"open"); + err(a->oerr,errno,"open") break; case 's': case 'S': @@ -158,7 +158,7 @@ integer f_open(olist *a) #else if(!stat(buf,&stb)) #endif - err(a->oerr,128,"open"); + err(a->oerr,128,"open") /* no break */ case 'r': /* Fortran 90 replace option */ case 'R': @@ -182,7 +182,7 @@ integer f_open(olist *a) #endif if(f__isdev(buf)) { b->ufd = fopen(buf,f__r_mode[ufmt]); - if(b->ufd==NULL) err(a->oerr,errno,buf); + if(b->ufd==NULL) err(a->oerr,errno,buf) } else { if(!(b->ufd = fopen(buf, f__r_mode[ufmt]))) { @@ -208,7 +208,7 @@ integer f_open(olist *a) b->useek=f__canseek(b->ufd); #ifndef NON_UNIX_STDIO if((b->uinode=f__inode(buf,&b->udev))==-1) - err(a->oerr,108,"open"); + err(a->oerr,108,"open") #endif if(b->useek) if (a->orl) diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/rewind.c b/gnu/usr.bin/gcc/f/runtime/libI77/rewind.c index 1095ed9b520..e58daad7b8a 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/rewind.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/rewind.c @@ -13,7 +13,7 @@ integer f_rew(alist *a) if(b->ufd == NULL || b->uwrt == 3) return(0); if(!b->useek) - err(a->aerr,106,"rewind"); + err(a->aerr,106,"rewind") if(b->uwrt) { (void) t_runc(a); b->uwrt = 3; diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/rsne.c b/gnu/usr.bin/gcc/f/runtime/libI77/rsne.c index 6915fe87ad6..9e2acad3d7d 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/rsne.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/rsne.c @@ -29,7 +29,7 @@ typedef struct hashtab hashtab; static hashtab *nl_cache; - static int n_nlcache; + static n_nlcache; static hashentry **zot; static int colonseen; extern ftnlen f__typesize[]; diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/sfe.c b/gnu/usr.bin/gcc/f/runtime/libI77/sfe.c index 355e2700f42..eea9078eee4 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/sfe.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/sfe.c @@ -23,8 +23,8 @@ c_sfe(cilist *a) /* check */ if(a->ciunit >= MXUNIT || a->ciunit<0) err(a->cierr,101,"startio"); p = &f__units[a->ciunit]; - if(p->ufd==NULL && fk_open(SEQ,FMT,a->ciunit)) err(a->cierr,114,"sfe"); - if(!p->ufmt) err(a->cierr,102,"sfe"); + if(p->ufd==NULL && fk_open(SEQ,FMT,a->ciunit)) err(a->cierr,114,"sfe") + if(!p->ufmt) err(a->cierr,102,"sfe") return(0); } integer e_wsfe(Void) diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/sue.c b/gnu/usr.bin/gcc/f/runtime/libI77/sue.c index 90f4e3139f1..b1b8bc38548 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/sue.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/sue.c @@ -18,8 +18,8 @@ c_sue(cilist *a) if(f__curunit->ufd==NULL && fk_open(SEQ,UNF,a->ciunit)) err(a->cierr,114,"sue"); f__cf=f__curunit->ufd; - if(f__curunit->ufmt) err(a->cierr,103,"sue"); - if(!f__curunit->useek) err(a->cierr,103,"sue"); + if(f__curunit->ufmt) err(a->cierr,103,"sue") + if(!f__curunit->useek) err(a->cierr,103,"sue") return(0); } #ifdef KR_headers diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/uio.c b/gnu/usr.bin/gcc/f/runtime/libI77/uio.c index daefcd94f20..645392d7af5 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/uio.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/uio.c @@ -44,7 +44,7 @@ integer do_ud(ftnint *number, char *ptr, ftnlen len) #endif if (!(i = fread(ptr,(size_t)len,(size_t)(*number),f__cf)) && !(f__recpos - *number*len)) - err(f__elist->cierr,EOF,"do_ud"); + err(f__elist->cierr,EOF,"do_ud") if (i < *number) memset(ptr + i*len, 0, (*number - i)*len); return 0; diff --git a/gnu/usr.bin/gcc/f/runtime/libI77/wrtfmt.c b/gnu/usr.bin/gcc/f/runtime/libI77/wrtfmt.c index 74b85769769..a47af4da1bb 100644 --- a/gnu/usr.bin/gcc/f/runtime/libI77/wrtfmt.c +++ b/gnu/usr.bin/gcc/f/runtime/libI77/wrtfmt.c @@ -92,7 +92,7 @@ wrt_Z(Uint *n, int w, int minlen, ftnlen len) #endif { register char *s, *se; - register int i, w1; + register i, w1; static int one = 1; static char hex[] = "0123456789ABCDEF"; s = (char *)n; diff --git a/gnu/usr.bin/gcc/f/src.h b/gnu/usr.bin/gcc/f/src.h index 02279154d28..b5d7dfa8b50 100644 --- a/gnu/usr.bin/gcc/f/src.h +++ b/gnu/usr.bin/gcc/f/src.h @@ -87,9 +87,9 @@ extern bool ffesrc_ok_match_noninit_lower_; characters for which ffelex_is_firstnamechar returns TRUE. */ #define ffesrc_is_name_init(c) \ - ((isalpha ((c))) || (!(1 || ffe_is_90 ()) && ((c) == '_'))) + ((isalpha ((c))) || (!ffe_is_90 () && ((c) == '_'))) #define ffesrc_is_name_noninit(c) \ - ((isalnum ((c))) || (!(1 || ffe_is_90 ()) && ((c) == '_'))) + ((isalnum ((c))) || (!ffe_is_90 () && ((c) == '_'))) /* Test if source-translated character matches given alphabetic character (passed in both uppercase and lowercase, to allow for custom speedup diff --git a/gnu/usr.bin/gcc/f/sta.c b/gnu/usr.bin/gcc/f/sta.c index 2c1672f832d..79073f205f4 100644 --- a/gnu/usr.bin/gcc/f/sta.c +++ b/gnu/usr.bin/gcc/f/sta.c @@ -1,5 +1,5 @@ /* sta.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -78,7 +78,7 @@ bool ffesta_line_has_semicolons = FALSE; the confirmed stmt and forget the rest. */ -#define FFESTA_maxPOSSIBLES_ 8/* Never more than this # of possibles. */ +#define FFESTA_maxPOSSIBLES_ 100/* Never more than this # of possibles. */ /* Internal typedefs. */ @@ -94,7 +94,6 @@ struct _ffesta_possible_ ffestaPossible_ next; ffestaPossible_ previous; ffelexHandler handler; - bool named; }; struct _ffesta_possible_root_ @@ -110,7 +109,7 @@ static bool ffesta_is_inhibited_ = FALSE; static ffelexToken ffesta_token_0_; /* For use by ffest possibility handling. */ static ffestaPossible_ ffesta_possibles_[FFESTA_maxPOSSIBLES_]; -static int ffesta_num_possibles_ = 0; /* Number of possibilities. */ +static int ffesta_num_possibles_ = 0; /* Next possibility to use. */ static struct _ffesta_possible_root_ ffesta_possible_nonexecs_; static struct _ffesta_possible_root_ ffesta_possible_execs_; static ffestaPossible_ ffesta_current_possible_; @@ -130,7 +129,8 @@ static bool ffesta_inhibit_confirmation_ = FALSE; /* Static functions (internal). */ -static void ffesta_add_possible_ (ffelexHandler fn, bool exec, bool named); +static void ffesta_add_possible_exec_ (ffelexHandler fn); +static void ffesta_add_possible_nonexec_ (ffelexHandler fn); static bool ffesta_inhibited_exec_transition_ (void); static void ffesta_reset_possibles_ (void); static ffelexHandler ffesta_save_ (ffelexToken t); @@ -140,16 +140,19 @@ static ffelexHandler ffesta_send_two_ (ffelexToken t); #endif /* Internal macros. */ - -#define ffesta_add_possible_exec_(fn) (ffesta_add_possible_ (fn, TRUE, TRUE)) -#define ffesta_add_possible_nonexec_(fn) (ffesta_add_possible_ (fn, FALSE, TRUE)) -#define ffesta_add_possible_unnamed_exec_(fn) (ffesta_add_possible_ (fn, TRUE, FALSE)) -#define ffesta_add_possible_unnamed_nonexec_(fn) (ffesta_add_possible_ (fn, FALSE, FALSE)) -/* Add possible statement to appropriate list. */ + +/* ffesta_add_possible_exec_ -- Add possible executable statement to list + + ffelexHandler ffestb_some_executable_stmt_handler_; + ffesta_add_possible_exec_(ffestb_some_executable_stmt_handler_); + + Adds a possible statement to the list of executable statements, with the + specified statement handler as the recipient of the first token in the + statement. */ static void -ffesta_add_possible_ (ffelexHandler fn, bool exec, bool named) +ffesta_add_possible_exec_ (ffelexHandler fn) { ffestaPossible_ p; @@ -157,21 +160,38 @@ ffesta_add_possible_ (ffelexHandler fn, bool exec, bool named) p = ffesta_possibles_[ffesta_num_possibles_++]; - if (exec) - { - p->next = (ffestaPossible_) &ffesta_possible_execs_.first; - p->previous = ffesta_possible_execs_.last; - } - else - { - p->next = (ffestaPossible_) &ffesta_possible_nonexecs_.first; - p->previous = ffesta_possible_nonexecs_.last; - } + p->next = (ffestaPossible_) &ffesta_possible_execs_.first; + p->previous = ffesta_possible_execs_.last; + p->next->previous = p; + p->previous->next = p; + + p->handler = fn; +} + +/* ffesta_add_possible_nonexec_ -- Add possible nonexecutable statement to list + + ffelexHandler ffestb_some_nonexecutable_stmt_handler_; + ffesta_add_possible_nonexec_(ffestb_some_nonexecutable_stmt_handler_); + + Adds a possible statement to the list of nonexecutable statements, with the + specified statement handler as the recipient of the first token in the + statement. */ + +static void +ffesta_add_possible_nonexec_ (ffelexHandler fn) +{ + ffestaPossible_ p; + + assert (ffesta_num_possibles_ < FFESTA_maxPOSSIBLES_); + + p = ffesta_possibles_[ffesta_num_possibles_++]; + + p->next = (ffestaPossible_) &ffesta_possible_nonexecs_.first; + p->previous = ffesta_possible_nonexecs_.last; p->next->previous = p; p->previous->next = p; p->handler = fn; - p->named = named; } /* ffesta_inhibited_exec_transition_ -- Do exec transition while inhibited @@ -370,44 +390,15 @@ ffesta_save_ (ffelexToken t) ffesta_tokens[0] = ffesta_token_0_; if (ffesta_confirmed_possible_ == NULL) { /* No confirmed success, just use first - named possible, or first possible if - no named possibles. */ - ffestaPossible_ possible = ffesta_possible_nonexecs_.first; - ffestaPossible_ first = NULL; - ffestaPossible_ first_named = NULL; - ffestaPossible_ first_exec = NULL; - - for (;;) + possible. */ + ffesta_current_possible_ = ffesta_possible_nonexecs_.first; + ffesta_current_handler_ = ffesta_current_possible_->handler; + if (ffesta_current_handler_ == NULL) { - if (possible->handler == NULL) - { - if (possible == (ffestaPossible_) &ffesta_possible_nonexecs_) - { - possible = first_exec = ffesta_possible_execs_.first; - continue; - } - else - break; - } - if (first == NULL) - first = possible; - if (possible->named - && (first_named == NULL)) - first_named = possible; - - possible = possible->next; + ffesta_current_possible_ = ffesta_possible_execs_.first; + ffesta_current_handler_ = ffesta_current_possible_->handler; + assert (ffesta_current_handler_ != NULL); } - - if (first_named != NULL) - ffesta_current_possible_ = first_named; - else if (ffesta_seen_first_exec - && (first_exec != NULL)) - ffesta_current_possible_ = first_exec; - else - ffesta_current_possible_ = first; - - ffesta_current_handler_ = ffesta_current_possible_->handler; - assert (ffesta_current_handler_ != NULL); } else { /* Confirmed success, use it. */ @@ -578,6 +569,7 @@ static ffelexHandler ffesta_second_ (ffelexToken t) { ffelexHandler next; + bool include_only = FALSE; /* Initially valid INCLUDE form when TRUE. */ ffesymbol s; assert (ffelex_token_type (t) != FFELEX_typeNAMES); @@ -592,12 +584,6 @@ ffesta_second_ (ffelexToken t) switch (ffesta_first_kw) { -#if FFESTR_VXT - case FFESTR_firstACCEPT: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V019); - break; -#endif - #if FFESTR_F90 case FFESTR_firstALLOCATABLE: ffestb_args.dimlist.len = FFESTR_firstlALLOCATABLE; @@ -615,77 +601,18 @@ ffesta_second_ (ffelexToken t) break; #endif - case FFESTR_firstASSIGN: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R838); - break; - case FFESTR_firstBACKSPACE: ffestb_args.beru.len = FFESTR_firstlBACKSPACE; ffestb_args.beru.badname = "BACKSPACE"; ffesta_add_possible_exec_ ((ffelexHandler) ffestb_beru); break; - case FFESTR_firstBLOCK: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_block); - break; - - case FFESTR_firstBLOCKDATA: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_blockdata); - break; - - case FFESTR_firstBYTE: - ffestb_args.decl.len = FFESTR_firstlBYTE; - ffestb_args.decl.type = FFESTP_typeBYTE; - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_gentype); - break; - - case FFESTR_firstCALL: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R1212); - break; - - case FFESTR_firstCASE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R810); - break; - - case FFESTR_firstCHRCTR: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_chartype); - break; - - case FFESTR_firstCLOSE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R907); - break; - - case FFESTR_firstCOMMON: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R547); - break; - case FFESTR_firstCMPLX: ffestb_args.decl.len = FFESTR_firstlCMPLX; ffestb_args.decl.type = FFESTP_typeCOMPLEX; ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_gentype); break; -#if FFESTR_F90 - case FFESTR_firstCONTAINS: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R1228); - break; -#endif - - case FFESTR_firstCONTINUE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R841); - break; - - case FFESTR_firstCYCLE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R834); - break; - - case FFESTR_firstDATA: - if (ffe_is_pedantic_not_90 ()) - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R528); - else - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R528); - break; - #if FFESTR_F90 case FFESTR_firstDEALLOCATE: ffestb_args.heap.len = FFESTR_firstlDEALLOCATE; @@ -703,29 +630,12 @@ ffesta_second_ (ffelexToken t) break; #endif -#if FFESTR_VXT - case FFESTR_firstDEFINEFILE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V025); - break; - - case FFESTR_firstDELETE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V021); - break; -#endif case FFESTR_firstDIMENSION: ffestb_args.R524.len = FFESTR_firstlDIMENSION; ffestb_args.R524.badname = "DIMENSION"; ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R524); break; - case FFESTR_firstDO: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_do); - break; - - case FFESTR_firstDBL: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_double); - break; - case FFESTR_firstDBLCMPLX: ffestb_args.decl.len = FFESTR_firstlDBLCMPLX; ffestb_args.decl.type = FFESTP_typeDBLCMPLX; @@ -738,14 +648,6 @@ ffesta_second_ (ffelexToken t) ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_dbltype); break; - case FFESTR_firstDOWHILE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_dowhile); - break; - - case FFESTR_firstELSE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_else); - break; - case FFESTR_firstELSEIF: ffestb_args.elsexyz.second = FFESTR_secondIF; ffesta_add_possible_exec_ ((ffelexHandler) ffestb_elsexyz); @@ -916,26 +818,12 @@ ffesta_second_ (ffelexToken t) ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_dummy); break; - case FFESTR_firstEQUIVALENCE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R544); - break; - - case FFESTR_firstEXIT: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R835); - break; - case FFESTR_firstEXTERNAL: ffestb_args.varlist.len = FFESTR_firstlEXTERNAL; ffestb_args.varlist.badname = "EXTERNAL"; ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_varlist); break; -#if FFESTR_VXT - case FFESTR_firstFIND: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V026); - break; -#endif - /* WARNING: don't put anything that might cause an item to precede FORMAT in the list of possible statements (it's added below) without making sure FORMAT still is first. It has to run with @@ -953,19 +841,6 @@ ffesta_second_ (ffelexToken t) ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_dummy); break; - case FFESTR_firstGOTO: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_goto); - break; - - case FFESTR_firstIF: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_if); - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R840); - break; - - case FFESTR_firstIMPLICIT: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_R539); - break; - case FFESTR_firstINCLUDE: ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_S3P4); switch (ffelex_token_type (t)) @@ -974,6 +849,7 @@ ffesta_second_ (ffelexToken t) case FFELEX_typeNAME: case FFELEX_typeAPOSTROPHE: case FFELEX_typeQUOTE: + include_only = TRUE; break; default: @@ -981,16 +857,24 @@ ffesta_second_ (ffelexToken t) } break; - case FFESTR_firstINQUIRE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R923); - break; - case FFESTR_firstINTGR: ffestb_args.decl.len = FFESTR_firstlINTGR; ffestb_args.decl.type = FFESTP_typeINTEGER; ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_gentype); break; + case FFESTR_firstBYTE: + ffestb_args.decl.len = FFESTR_firstlBYTE; + ffestb_args.decl.type = FFESTP_typeBYTE; + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_gentype); + break; + + case FFESTR_firstWORD: + ffestb_args.decl.len = FFESTR_firstlWORD; + ffestb_args.decl.type = FFESTP_typeWORD; + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_gentype); + break; + #if FFESTR_F90 case FFESTR_firstINTENT: ffestb_args.varlist.len = FFESTR_firstlINTENT; @@ -999,12 +883,6 @@ ffesta_second_ (ffelexToken t) break; #endif -#if FFESTR_F90 - case FFESTR_firstINTERFACE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R1202); - break; -#endif - case FFESTR_firstINTRINSIC: ffestb_args.varlist.len = FFESTR_firstlINTRINSIC; ffestb_args.varlist.badname = "INTRINSIC"; @@ -1017,32 +895,6 @@ ffesta_second_ (ffelexToken t) ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_gentype); break; -#if FFESTR_VXT - case FFESTR_firstMAP: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V012); - break; -#endif - -#if FFESTR_F90 - case FFESTR_firstMODULE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_module); - break; -#endif - - case FFESTR_firstNAMELIST: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R542); - break; - -#if FFESTR_F90 - case FFESTR_firstNULLIFY: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R624); - break; -#endif - - case FFESTR_firstOPEN: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R904); - break; - #if FFESTR_F90 case FFESTR_firstOPTIONAL: ffestb_args.varlist.len = FFESTR_firstlOPTIONAL; @@ -1051,11 +903,6 @@ ffesta_second_ (ffelexToken t) break; #endif - case FFESTR_firstPARAMETER: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R537); - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V027); - break; - case FFESTR_firstPAUSE: ffestb_args.halt.len = FFESTR_firstlPAUSE; ffesta_add_possible_exec_ ((ffelexHandler) ffestb_halt); @@ -1069,23 +916,13 @@ ffesta_second_ (ffelexToken t) break; #endif - case FFESTR_firstPRINT: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R911); - break; - #if HARD_F90 case FFESTR_firstPRIVATE: ffestb_args.varlist.len = FFESTR_firstlPRIVATE; ffestb_args.varlist.badname = "ACCESS"; ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_varlist); break; -#endif - case FFESTR_firstPROGRAM: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R1102); - break; - -#if HARD_F90 case FFESTR_firstPUBLIC: ffestb_args.varlist.len = FFESTR_firstlPUBLIC; ffestb_args.varlist.badname = "ACCESS"; @@ -1093,73 +930,23 @@ ffesta_second_ (ffelexToken t) break; #endif - case FFESTR_firstREAD: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R909); - break; - case FFESTR_firstREAL: ffestb_args.decl.len = FFESTR_firstlREAL; ffestb_args.decl.type = FFESTP_typeREAL; ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_gentype); break; -#if FFESTR_VXT - case FFESTR_firstRECORD: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V016); - break; -#endif - -#if FFESTR_F90 - case FFESTR_firstRECURSIVE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_recursive); - break; -#endif - - case FFESTR_firstRETURN: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R1227); - break; - case FFESTR_firstREWIND: ffestb_args.beru.len = FFESTR_firstlREWIND; ffestb_args.beru.badname = "REWIND"; ffesta_add_possible_exec_ ((ffelexHandler) ffestb_beru); break; -#if FFESTR_VXT - case FFESTR_firstREWRITE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V018); - break; -#endif - - case FFESTR_firstSAVE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R522); - break; - - case FFESTR_firstSELECT: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R809); - break; - - case FFESTR_firstSELECTCASE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R809); - break; - -#if HARD_F90 - case FFESTR_firstSEQUENCE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R423B); - break; -#endif - case FFESTR_firstSTOP: ffestb_args.halt.len = FFESTR_firstlSTOP; ffesta_add_possible_exec_ ((ffelexHandler) ffestb_halt); break; -#if FFESTR_VXT - case FFESTR_firstSTRUCTURE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V003); - break; -#endif - case FFESTR_firstSUBROUTINE: ffestb_args.dummy.len = FFESTR_firstlSUBROUTINE; ffestb_args.dummy.badname = "SUBROUTINE"; @@ -1175,22 +962,6 @@ ffesta_second_ (ffelexToken t) break; #endif - case FFESTR_firstTYPE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V020); - break; - -#if FFESTR_F90 - case FFESTR_firstTYPE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_type); - break; -#endif - -#if HARD_F90 - case FFESTR_firstTYPE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_typetype); - break; -#endif - #if FFESTR_VXT case FFESTR_firstUNLOCK: ffestb_args.beru.len = FFESTR_firstlUNLOCK; @@ -1199,47 +970,109 @@ ffesta_second_ (ffelexToken t) break; #endif -#if FFESTR_VXT - case FFESTR_firstUNION: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V009); - break; -#endif - -#if FFESTR_F90 - case FFESTR_firstUSE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R1107); - break; -#endif - case FFESTR_firstVIRTUAL: ffestb_args.R524.len = FFESTR_firstlVIRTUAL; ffestb_args.R524.badname = "VIRTUAL"; ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R524); break; - case FFESTR_firstVOLATILE: - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V014); - break; - -#if HARD_F90 - case FFESTR_firstWHERE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_where); - break; -#endif + default: - case FFESTR_firstWORD: - ffestb_args.decl.len = FFESTR_firstlWORD; - ffestb_args.decl.type = FFESTP_typeWORD; - ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_gentype); - break; + /* For now, a decent error message for an unconfirmed stmt, rather than + just whatever is at the top of the list. */ - case FFESTR_firstWRITE: - ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R910); + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_unimplemented); break; + } - default: - break; + if (!include_only) + { + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_block); /* BLOCK. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_blockdata); /* BLOCKDATA. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_chartype); /* CHARACTER. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_do); /* DO. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_double); /* DOUBLE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_dowhile); /* DOWHILE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_else); /* ELSE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_goto); /* GOTO. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_if); /* IF. */ +#if FFESTR_F90 + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_module); /* MODULE. */ +#endif +#if FFESTR_F90 + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_recursive); /* RECURSIVE. */ +#endif +#if FFESTR_F90 + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_type); /* TYPE. */ +#endif +#if HARD_F90 + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_typetype); /* TYPE(). */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_where); /* WHERE. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R423B); /* SEQUENCE. */ +#endif + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R522); /* SAVE. */ + if (ffe_is_pedantic_not_90 ()) + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R528); /* DATA. */ + else + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R528); /* DATA. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R537); /* PARAMETER. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_decl_R539); /* IMPLICIT. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R542); /* NAMELIST. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R544); /* EQUIVALENCE. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R547); /* COMMON. */ +#if FFESTR_F90 + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R624); /* NULLIFY. */ +#endif + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R809); /* SELECTCASE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R810); /* CASE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R834); /* CYCLE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R835); /* EXIT. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R838); /* ASSIGN. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R840); /* Arithmetic IF. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R841); /* CONTINUE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R904); /* OPEN. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R907); /* CLOSE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R909); /* READ. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R910); /* WRITE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R911); /* PRINT. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R923); /* INQUIRE. */ + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R1102); /* PROGRAM. */ +#if FFESTR_F90 + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R1107); /* USE. */ +#endif +#if FFESTR_F90 + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R1202); /* INTERFACE. */ +#endif + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R1212); /* CALL. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R1227); /* RETURN. */ +#if FFESTR_F90 + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_R1228); /* CONTAINS. */ +#endif +#if FFESTR_VXT + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V003); /* STRUCTURE. */ +#endif +#if FFESTR_VXT + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V009); /* UNION. */ +#endif +#if FFESTR_VXT + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V012); /* MAP. */ +#endif + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V014); /* VOLATILE. */ +#if FFESTR_VXT + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V016); /* RECORD. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V018); /* REWRITE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V019); /* ACCEPT. */ +#endif + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V020); /* TYPE. */ +#if FFESTR_VXT + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V021); /* DELETE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V025); /* DEFINEFILE. */ + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_V026); /* FIND. */ +#endif + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_V027); /* VXT PARAMETER. */ } + else + include_only = FALSE; /* Now check the default cases, which are always "live" (meaning that no other possibility can override them). These are where the second token @@ -1252,7 +1085,7 @@ ffesta_second_ (ffelexToken t) if (((s == NULL) || (ffesymbol_dims (s) == NULL)) && !ffesta_seen_first_exec) { /* Not known as array; may be stmt function. */ - ffesta_add_possible_unnamed_nonexec_ ((ffelexHandler) ffestb_R1229); + ffesta_add_possible_nonexec_ ((ffelexHandler) ffestb_R1229); /* If the symbol is (or will be due to implicit typing) of CHARACTER type, then the statement might be an assignment @@ -1266,11 +1099,11 @@ ffesta_second_ (ffelexToken t) if (ffeimplic_peek_symbol_type (s, ffelex_token_text (ffesta_token_0_)) == FFEINFO_basictypeCHARACTER) - ffesta_add_possible_unnamed_exec_ ((ffelexHandler) ffestb_let); + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_let); } else /* Not statement function if known as an array. */ - ffesta_add_possible_unnamed_exec_ ((ffelexHandler) ffestb_let); + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_let); break; #if FFESTR_F90 @@ -1280,7 +1113,7 @@ ffesta_second_ (ffelexToken t) #if FFESTR_F90 case FFELEX_typePOINTS: #endif - ffesta_add_possible_unnamed_exec_ ((ffelexHandler) ffestb_let); + ffesta_add_possible_exec_ ((ffelexHandler) ffestb_let); break; case FFELEX_typeCOLON: @@ -1330,7 +1163,6 @@ ffesta_second_ (ffelexToken t) assert (ffesta_current_handler_ != NULL); if (!ffesta_seen_first_exec) { /* Need to do exec transition now. */ - ffesta_tokens[0] = ffesta_token_0_; if (!ffestc_exec_transition ()) goto no_stmts; /* :::::::::::::::::::: */ } diff --git a/gnu/usr.bin/gcc/f/stb.c b/gnu/usr.bin/gcc/f/stb.c index 09bf59b20eb..ac03ae7685b 100644 --- a/gnu/usr.bin/gcc/f/stb.c +++ b/gnu/usr.bin/gcc/f/stb.c @@ -1,5 +1,5 @@ /* stb.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -1849,6 +1849,19 @@ ffestb_subr_label_list_1_ (ffelexToken t) } } +/* ffestb_unimplemented -- Report a not-implemented error for stmt + + return ffestb_unimplemented; // to lexer after seeing EOS + + Issue an error via ffest_ffebad_start and return via ffesta_zero. */ + +ffelexHandler +ffestb_unimplemented (ffelexToken t) +{ + ffesta_ffebad_1t (FFEBAD_UNIMPL_STMT, ffesta_tokens[0]); + return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero); +} + /* ffestb_do -- Parse the DO statement return ffestb_do; // to lexer @@ -9063,12 +9076,14 @@ ffestb_R10012_ (ffelexToken t) return (ffelexHandler) ffestb_R10014_ (t); case FFELEX_typeCOMMA: + ffesta_confirmed (); ffebad_start (FFEBAD_FORMAT_EXTRA_COMMA); ffebad_here (0, ffelex_token_where_line (t), ffelex_token_where_column (t)); ffebad_finish (); return (ffelexHandler) ffestb_R10012_; case FFELEX_typeCLOSE_PAREN: + ffesta_confirmed (); ffebad_start (FFEBAD_FORMAT_EXTRA_COMMA); ffebad_here (0, ffelex_token_where_line (t), ffelex_token_where_column (t)); ffebad_finish (); @@ -9104,7 +9119,7 @@ ffestb_R10012_ (ffelexToken t) return (ffelexHandler) ffestb_R100114_ (t); case FFELEX_typeQUOTE: - if (ffe_is_vxt ()) + if (ffe_is_vxt_not_90 ()) break; /* Error, probably something like FORMAT("17) = X. */ ffelex_set_expecting_hollerith (-1, '\"', @@ -9352,7 +9367,7 @@ ffestb_R10014_ (ffelexToken t) return (ffelexHandler) ffestb_R100111_; case FFELEX_typeQUOTE: - if (ffe_is_vxt ()) + if (ffe_is_vxt_not_90 ()) break; /* A totally bad character in a VXT FORMAT. */ ffebad_start (FFEBAD_FORMAT_SPURIOUS_NUMBER); ffebad_here (0, ffelex_token_where_line (ffestb_local_.format.pre.t), @@ -17987,13 +18002,13 @@ ffestb_V0201_ (ffelexToken ft, ffebld expr, ffelexToken t) { case FFELEX_typeEOS: case FFELEX_typeSEMICOLON: - if (!ffe_is_vxt () && (expr != NULL) + if (!ffe_is_vxt_not_90 () && (expr != NULL) && (ffebld_op (expr) == FFEBLD_opSYMTER)) break; comma = FALSE; /* Fall through. */ case FFELEX_typeCOMMA: - if (!ffe_is_vxt () && comma && (expr != NULL) + if (!ffe_is_vxt_not_90 () && comma && (expr != NULL) && (ffebld_op (expr) == FFEBLD_opPAREN) && (ffebld_op (ffebld_left (expr)) == FFEBLD_opSYMTER)) break; @@ -20364,9 +20379,13 @@ ffestb_R1229 (ffelexToken t) return (ffelexHandler) ffestb_subr_name_list_; bad_0: /* :::::::::::::::::::: */ -bad_1: /* :::::::::::::::::::: */ - ffesta_ffebad_2t (FFEBAD_UNREC_STMT, ffesta_tokens[0], t); + ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "statement-function-definition", ffesta_tokens[0]); return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero); + +bad_1: /* :::::::::::::::::::: */ + ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "statement-function-definition", t); + return (ffelexHandler) ffelex_swallow_tokens (t, + (ffelexHandler) ffesta_zero); /* Invalid second token. */ } /* ffestb_R12291_ -- "STMTFUNCTION" OPEN_PAREN dummy-name-list CLOSE_PAREN @@ -20402,7 +20421,7 @@ ffestb_R12291_ (ffelexToken t) } bad: /* :::::::::::::::::::: */ - ffesta_ffebad_2t (FFEBAD_UNREC_STMT, ffesta_tokens[0], t); + ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "statement-function-definition", t); ffelex_token_kill (ffestb_subrargs_.name_list.close_paren); ffestt_tokenlist_kill (ffestb_subrargs_.name_list.args); return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero); diff --git a/gnu/usr.bin/gcc/f/stb.h b/gnu/usr.bin/gcc/f/stb.h index a3385d9a596..79bed32cfc2 100644 --- a/gnu/usr.bin/gcc/f/stb.h +++ b/gnu/usr.bin/gcc/f/stb.h @@ -1,5 +1,5 @@ /* stb.h -- Private #include File (module.h template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -132,6 +132,7 @@ extern struct _ffestb_args_ ffestb_args; /* Declare functions with prototypes. */ +ffelexHandler ffestb_unimplemented (ffelexToken t); ffelexHandler ffestb_beru (ffelexToken t); ffelexHandler ffestb_block (ffelexToken t); ffelexHandler ffestb_blockdata (ffelexToken t); diff --git a/gnu/usr.bin/gcc/f/stc.c b/gnu/usr.bin/gcc/f/stc.c index bc803e67e82..5512bcbab6b 100644 --- a/gnu/usr.bin/gcc/f/stc.c +++ b/gnu/usr.bin/gcc/f/stc.c @@ -1,5 +1,5 @@ /* stc.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -2686,16 +2686,16 @@ ffestc_order_entry_ () goto recurse; /* :::::::::::::::::::: */ case FFESTV_stateSUBROUTINE0: - ffestw_set_state (ffestw_stack_top (), FFESTV_stateSUBROUTINE1); + case FFESTV_stateSUBROUTINE1: + ffestw_set_state (ffestw_stack_top (), FFESTV_stateSUBROUTINE2); break; case FFESTV_stateFUNCTION0: - ffestw_set_state (ffestw_stack_top (), FFESTV_stateFUNCTION1); + case FFESTV_stateFUNCTION1: + ffestw_set_state (ffestw_stack_top (), FFESTV_stateFUNCTION2); break; - case FFESTV_stateSUBROUTINE1: case FFESTV_stateSUBROUTINE2: - case FFESTV_stateFUNCTION1: case FFESTV_stateFUNCTION2: case FFESTV_stateSUBROUTINE3: case FFESTV_stateFUNCTION3: @@ -2848,25 +2848,25 @@ ffestc_order_format_ () goto recurse; /* :::::::::::::::::::: */ case FFESTV_statePROGRAM0: + case FFESTV_statePROGRAM1: ffestw_update (NULL); - ffestw_set_state (ffestw_stack_top (), FFESTV_statePROGRAM1); + ffestw_set_state (ffestw_stack_top (), FFESTV_statePROGRAM2); return FFESTC_orderOK_; case FFESTV_stateSUBROUTINE0: + case FFESTV_stateSUBROUTINE1: ffestw_update (NULL); - ffestw_set_state (ffestw_stack_top (), FFESTV_stateSUBROUTINE1); + ffestw_set_state (ffestw_stack_top (), FFESTV_stateSUBROUTINE2); return FFESTC_orderOK_; case FFESTV_stateFUNCTION0: + case FFESTV_stateFUNCTION1: ffestw_update (NULL); - ffestw_set_state (ffestw_stack_top (), FFESTV_stateFUNCTION1); + ffestw_set_state (ffestw_stack_top (), FFESTV_stateFUNCTION2); return FFESTC_orderOK_; - case FFESTV_statePROGRAM1: case FFESTV_statePROGRAM2: - case FFESTV_stateSUBROUTINE1: case FFESTV_stateSUBROUTINE2: - case FFESTV_stateFUNCTION1: case FFESTV_stateFUNCTION2: case FFESTV_statePROGRAM3: case FFESTV_stateSUBROUTINE3: @@ -6309,7 +6309,6 @@ ffestc_R501_item (ffelexToken name, ffebld kind, ffelexToken kindt, ffestpDimtype nd; bool is_init = (init != NULL) || clist; bool is_assumed; - bool is_ugly_assumed; ffeinfoRank rank; ffestc_check_item_ (); @@ -6336,11 +6335,7 @@ ffestc_R501_item (ffelexToken name, ffebld kind, ffelexToken kindt, if (is_assumed) na |= FFESYMBOL_attrsANYLEN; - is_ugly_assumed = (ffe_is_ugly_assumed () - && ((sa & FFESYMBOL_attrsDUMMY) - || (ffesymbol_where (s) == FFEINFO_whereDUMMY))); - - nd = ffestt_dimlist_type (dims, is_ugly_assumed); + nd = ffestt_dimlist_type (dims); switch (nd) { case FFESTP_dimtypeNONE: @@ -6461,8 +6456,7 @@ ffestc_R501_item (ffelexToken name, ffebld kind, ffelexToken kindt, { ffesymbol_set_dims (s, ffestt_dimlist_as_expr (dims, &rank, &array_size, - &extents, - is_ugly_assumed)); + &extents)); ffesymbol_set_arraysize (s, array_size); ffesymbol_set_extents (s, extents); if (!(0 && ffe_is_90 ()) @@ -7212,7 +7206,6 @@ ffestc_R524_item (ffelexToken name, ffesttDimList dims) ffesymbolAttrs na; ffestpDimtype nd; ffeinfoRank rank; - bool is_ugly_assumed; ffestc_check_item_ (); assert (name != NULL); @@ -7228,11 +7221,7 @@ ffestc_R524_item (ffelexToken name, ffesttDimList dims) /* First figure out what kind of object this is based solely on the current object situation (dimension list). */ - is_ugly_assumed = (ffe_is_ugly_assumed () - && ((sa & FFESYMBOL_attrsDUMMY) - || (ffesymbol_where (s) == FFEINFO_whereDUMMY))); - - nd = ffestt_dimlist_type (dims, is_ugly_assumed); + nd = ffestt_dimlist_type (dims); switch (nd) { case FFESTP_dimtypeKNOWN: @@ -7301,8 +7290,7 @@ ffestc_R524_item (ffelexToken name, ffesttDimList dims) ffesymbol_set_state (s, FFESYMBOL_stateSEEN); ffesymbol_set_dims (s, ffestt_dimlist_as_expr (dims, &rank, &array_size, - &extents, - is_ugly_assumed)); + &extents)); ffesymbol_set_arraysize (s, array_size); ffesymbol_set_extents (s, extents); if (!(0 && ffe_is_90 ()) @@ -8233,7 +8221,6 @@ ffestc_R547_item_object (ffelexToken name, ffesttDimList dims) ffestpDimtype nd; ffebld e; ffeinfoRank rank; - bool is_ugly_assumed; if (ffestc_parent_ok_ && (ffestc_local_.common.symbol == NULL)) ffestc_R547_item_cblock (NULL); /* As if "COMMON [//] ...". */ @@ -8252,11 +8239,7 @@ ffestc_R547_item_object (ffelexToken name, ffesttDimList dims) /* First figure out what kind of object this is based solely on the current object situation (dimension list). */ - is_ugly_assumed = (ffe_is_ugly_assumed () - && ((sa & FFESYMBOL_attrsDUMMY) - || (ffesymbol_where (s) == FFEINFO_whereDUMMY))); - - nd = ffestt_dimlist_type (dims, is_ugly_assumed); + nd = ffestt_dimlist_type (dims); switch (nd) { case FFESTP_dimtypeNONE: @@ -8342,8 +8325,7 @@ ffestc_R547_item_object (ffelexToken name, ffesttDimList dims) { ffesymbol_set_dims (s, ffestt_dimlist_as_expr (dims, &rank, &array_size, - &extents, - is_ugly_assumed)); + &extents)); ffesymbol_set_arraysize (s, array_size); ffesymbol_set_extents (s, extents); if (!(0 && ffe_is_90 ()) @@ -11829,7 +11811,6 @@ ffestc_R1207_item (ffelexToken name) ffesymbol_set_attrs (s, na); ffesymbol_set_state (s, FFESYMBOL_stateSEEN); ffesymbol_set_explicitwhere (s, TRUE); - ffesymbol_globalize (s); ffesymbol_signal_unreported (s); } @@ -11889,6 +11870,7 @@ ffestc_R1208_item (ffelexToken name) ffeintrinGen gen; ffeintrinSpec spec; ffeintrinImp imp; + ffeinfoKind kind; ffestc_check_item_ (); assert (name != NULL); @@ -11908,7 +11890,7 @@ ffestc_R1208_item (ffelexToken name) else if (!(sa & ~FFESYMBOL_attrsTYPE)) { if (ffeintrin_is_intrinsic (ffelex_token_text (name), name, TRUE, - &gen, &spec, &imp) + &gen, &spec, &imp, &kind) && ((imp == FFEINTRIN_impNONE) #if 0 /* Don't bother with this for now. */ || ((ffeintrin_basictype (spec) @@ -11920,6 +11902,13 @@ ffestc_R1208_item (ffelexToken name) #endif || !(sa & FFESYMBOL_attrsTYPE))) na = sa | FFESYMBOL_attrsINTRINSIC; + else if (kind == FFEINFO_kindANY) + { /* Already diagnosed. */ + na = sa | FFESYMBOL_attrsINTRINSIC | FFESYMBOL_attrsANY; + ffesymbol_set_attrs (s, na); + ffesymbol_set_state (s, FFESYMBOL_stateUNDERSTOOD); + ffesymbol_set_info (s, ffeinfo_new_any ()); + } else na = FFESYMBOL_attrsetNONE; } @@ -11943,7 +11932,7 @@ ffestc_R1208_item (ffelexToken name) ffeinfo_new (FFEINFO_basictypeNONE, FFEINFO_kindtypeNONE, 0, - FFEINFO_kindNONE, + kind, FFEINFO_whereINTRINSIC, FFETARGET_charactersizeNONE)); ffesymbol_set_explicitwhere (s, TRUE); @@ -12363,7 +12352,6 @@ ffestc_R1226 (ffelexToken entryname, ffesttTokenList args, switch (ffestw_state (ffestw_stack_top ())) { - case FFESTV_stateFUNCTION1: case FFESTV_stateFUNCTION2: case FFESTV_stateFUNCTION3: in_func = TRUE; @@ -12375,7 +12363,6 @@ ffestc_R1226 (ffelexToken entryname, ffesttTokenList args, in_spec = FALSE; break; - case FFESTV_stateSUBROUTINE1: case FFESTV_stateSUBROUTINE2: case FFESTV_stateSUBROUTINE3: in_func = FALSE; diff --git a/gnu/usr.bin/gcc/f/std.c b/gnu/usr.bin/gcc/f/std.c index ea497425d9c..303317fcd84 100644 --- a/gnu/usr.bin/gcc/f/std.c +++ b/gnu/usr.bin/gcc/f/std.c @@ -1,5 +1,5 @@ /* std.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/ste.c b/gnu/usr.bin/gcc/f/ste.c index e1f6b36c079..3ad03bf12bc 100644 --- a/gnu/usr.bin/gcc/f/ste.c +++ b/gnu/usr.bin/gcc/f/ste.c @@ -1,5 +1,5 @@ /* ste.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -2351,25 +2351,16 @@ ffeste_R809 (ffestw block, ffebld expr) else { texpr = ffecom_expr (expr); - if (ffeinfo_basictype (ffebld_info (expr)) - != FFEINFO_basictypeCHARACTER) - { - expand_start_case (1, texpr, TREE_TYPE (texpr), - "SELECT CASE statement"); - ffestw_set_select_texpr (block, texpr); - ffestw_set_select_break (block, FALSE); - push_momentary (); - } - else - { - ffebad_start_msg ("SELECT CASE on CHARACTER type (at %0) not supported -- sorry", - FFEBAD_severityFATAL); - ffebad_here (0, ffestw_line (block), ffestw_col (block)); - ffebad_finish (); - ffestw_set_select_texpr (block, error_mark_node); - } + assert (ffeinfo_basictype (ffebld_info (expr)) + != FFEINFO_basictypeCHARACTER); + expand_start_case (1, texpr, TREE_TYPE (texpr), + "SELECT CASE statement"); + ffestw_set_select_texpr (block, texpr); + ffestw_set_select_break (block, FALSE); + push_momentary (); } - } + } /* ~~~handle character and special-case + character*1 */ ffecom_pop_calltemps (); #else diff --git a/gnu/usr.bin/gcc/f/storag.c b/gnu/usr.bin/gcc/f/storag.c index 67126197610..9b30b5e8638 100644 --- a/gnu/usr.bin/gcc/f/storag.c +++ b/gnu/usr.bin/gcc/f/storag.c @@ -1,5 +1,5 @@ /* storag.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/storag.h b/gnu/usr.bin/gcc/f/storag.h index 89c5f95b726..74a0065e779 100644 --- a/gnu/usr.bin/gcc/f/storag.h +++ b/gnu/usr.bin/gcc/f/storag.h @@ -1,5 +1,5 @@ /* storag.h -- Public #include File (module.h template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/stt.c b/gnu/usr.bin/gcc/f/stt.c index d0fd582355b..0995daad23c 100644 --- a/gnu/usr.bin/gcc/f/stt.c +++ b/gnu/usr.bin/gcc/f/stt.c @@ -1,5 +1,5 @@ /* stt.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -189,7 +189,7 @@ ffestt_dimlist_append (ffesttDimList list, ffebld lower, ffebld upper, new->t = t; } -/* Convert list of dims into ffebld format. +/* ffestt_dimlist_as_expr -- Convert list of dims into ffebld format ffesttDimList list; ffeinfoRank rank; @@ -199,15 +199,11 @@ ffestt_dimlist_append (ffesttDimList list, ffebld lower, ffebld upper, The dims in the list are converted to a list of ITEMs; the rank of the array, an expression representing the array size, a list of extent - expressions, and the list of ITEMs are returned. - - If is_ugly_assumed, treat a final dimension with no lower bound - and an upper bound of 1 as a * bound. */ + expressions, and the list of ITEMs are returned. */ ffebld ffestt_dimlist_as_expr (ffesttDimList list, ffeinfoRank *rank, - ffebld *array_size, ffebld *extents, - bool is_ugly_assumed) + ffebld *array_size, ffebld *extents) { ffesttDimList next; ffebld expr; @@ -243,10 +239,9 @@ ffestt_dimlist_as_expr (ffesttDimList list, ffeinfoRank *rank, > high) zero = TRUE; if ((next->next == list) - && is_ugly_assumed + && ffe_is_ugly_assumed () && (next->lower == NULL) - && (high == 1) - && (ffebld_conter_orig (next->upper) == NULL)) + && (high == 1)) { star = TRUE; ffebld_append_item (&bottom, @@ -478,18 +473,16 @@ ffestt_dimlist_kill (ffesttDimList list) } } -/* Determine type of list of dimensions. +/* ffestt_dimlist_type -- Determine type of list of dims - Return KNOWN for all-constant bounds, ADJUSTABLE for constant - and variable but no * bounds, ASSUMED for constant and * but - not variable bounds, ADJUSTABLEASSUMED for constant and variable - and * bounds. + ffesttDimList list; + ffestpDimtype type; + type = ffestt_dimlist_type(list); - If is_ugly_assumed, treat a final dimension with no lower bound - and an upper bound of 1 as a * bound. */ + The dims in the list are dumped with commas separating them. */ ffestpDimtype -ffestt_dimlist_type (ffesttDimList list, bool is_ugly_assumed) +ffestt_dimlist_type (ffesttDimList list) { ffesttDimList next; ffestpDimtype type; @@ -500,38 +493,18 @@ ffestt_dimlist_type (ffesttDimList list, bool is_ugly_assumed) type = FFESTP_dimtypeKNOWN; for (next = list->next; next != list; next = next->next) { - bool ugly_assumed = FALSE; - - if ((next->next == list) - && is_ugly_assumed - && (next->lower == NULL) - && (next->upper != NULL) - && (ffebld_op (next->upper) == FFEBLD_opCONTER) - && (ffebld_constant_integerdefault (ffebld_conter (next->upper)) - == 1) - && (ffebld_conter_orig (next->upper) == NULL)) - ugly_assumed = TRUE; - if (next->lower != NULL) { if (ffebld_op (next->lower) != FFEBLD_opCONTER) - { - if (type == FFESTP_dimtypeASSUMED) - type = FFESTP_dimtypeADJUSTABLEASSUMED; - else - type = FFESTP_dimtypeADJUSTABLE; - } + type = FFESTP_dimtypeADJUSTABLE; } if (next->upper != NULL) { - if (ugly_assumed - || (ffebld_op (next->upper) == FFEBLD_opSTAR)) - { - if (type == FFESTP_dimtypeADJUSTABLE) - type = FFESTP_dimtypeADJUSTABLEASSUMED; - else - type = FFESTP_dimtypeASSUMED; - } + if (ffebld_op (next->upper) == FFEBLD_opSTAR) + if (type == FFESTP_dimtypeKNOWN) + type = FFESTP_dimtypeASSUMED; + else + type = FFESTP_dimtypeADJUSTABLEASSUMED; else if (ffebld_op (next->upper) != FFEBLD_opCONTER) type = FFESTP_dimtypeADJUSTABLE; } diff --git a/gnu/usr.bin/gcc/f/stt.h b/gnu/usr.bin/gcc/f/stt.h index 827841ea983..b199d195316 100644 --- a/gnu/usr.bin/gcc/f/stt.h +++ b/gnu/usr.bin/gcc/f/stt.h @@ -169,12 +169,11 @@ void ffestt_caselist_kill (ffesttCaseList list); void ffestt_dimlist_append (ffesttDimList list, ffebld lower, ffebld upper, ffelexToken t); ffebld ffestt_dimlist_as_expr (ffesttDimList list, ffeinfoRank *rank, - ffebld *array_size, ffebld *extents, - bool is_ugly_assumed); + ffebld *array_size, ffebld *extents); ffesttDimList ffestt_dimlist_create (void); void ffestt_dimlist_dump (ffesttDimList list); void ffestt_dimlist_kill (ffesttDimList list); -ffestpDimtype ffestt_dimlist_type (ffesttDimList dims, bool is_ugly_assumed); +ffestpDimtype ffestt_dimlist_type (ffesttDimList dims); void ffestt_exprlist_append (ffesttExprList list, ffebld expr, ffelexToken t); ffesttExprList ffestt_exprlist_create (void); void ffestt_exprlist_drive (ffesttExprList list, void (*fn) ()); diff --git a/gnu/usr.bin/gcc/f/stu.c b/gnu/usr.bin/gcc/f/stu.c index ae3b5a44479..8138dc74605 100644 --- a/gnu/usr.bin/gcc/f/stu.c +++ b/gnu/usr.bin/gcc/f/stu.c @@ -1,5 +1,5 @@ /* stu.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -300,8 +300,6 @@ ffestu_sym_end_transition (ffesymbol s) ffesymbol_resolve_intrin (s); s = ffecom_sym_learned (s); ffestorag_end_layout (s); - if (nwh == FFEINFO_whereGLOBAL) - ffesymbol_globalize (s); ffesymbol_signal_unreported (s); /* For debugging purposes. */ } @@ -704,7 +702,7 @@ ffestu_sym_exec_transition (ffesymbol s) resolve_intrin = FALSE; } else if (ffeintrin_is_intrinsic (ffesymbol_text (s), NULL, FALSE, - &gen, &spec, &imp)) + &gen, &spec, &imp, &nkd)) { ffesymbol_signal_change (s); ffesymbol_set_state (s, FFESYMBOL_stateUNDERSTOOD); @@ -715,7 +713,7 @@ ffestu_sym_exec_transition (ffesymbol s) ffeinfo_new (FFEINFO_basictypeNONE, FFEINFO_kindtypeNONE, 0, - FFEINFO_kindNONE, + nkd, FFEINFO_whereINTRINSIC, FFETARGET_charactersizeNONE)); ffesymbol_resolve_intrin (s); @@ -822,8 +820,6 @@ ffestu_sym_exec_transition (ffesymbol s) else if (resolve_intrin) ffesymbol_resolve_intrin (s); ffestorag_exec_layout (s); - if (nwh == FFEINFO_whereGLOBAL) - ffesymbol_globalize (s); ffesymbol_signal_unreported (s); /* For debugging purposes. */ } diff --git a/gnu/usr.bin/gcc/f/symbol.c b/gnu/usr.bin/gcc/f/symbol.c index 8b6595dcddd..f4978a0dc24 100644 --- a/gnu/usr.bin/gcc/f/symbol.c +++ b/gnu/usr.bin/gcc/f/symbol.c @@ -1,5 +1,5 @@ /* Implementation of Fortran symbol manager - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -359,6 +359,7 @@ ffesymbol_check (ffesymbol s, ffelexToken t, bool maybe_intrin) ffeintrinGen gen; ffeintrinSpec spec; ffeintrinImp imp; + ffeinfoKind kind; if (!ffesrc_check_symbol () || ((s->check_state != FFESYMBOL_checkstateNONE_) @@ -376,7 +377,7 @@ ffesymbol_check (ffesymbol s, ffelexToken t, bool maybe_intrin) if (maybe_intrin && ffeintrin_is_intrinsic (ffelex_token_text (t), NULL, FALSE, - &gen, &spec, &imp)) + &gen, &spec, &imp, &kind)) { s->check_state = FFESYMBOL_checkstatePENDING_; s->check_token = ffelex_token_use (t); @@ -862,13 +863,6 @@ ffesymbol_error (ffesymbol s, ffelexToken t) ffesymbol_signal_unreported (s); } -void -ffesymbol_globalize (ffesymbol s) -{ - if (ffesymbol_global (s) == NULL) - ffesymbol_set_global (s, ffeglobal_promoted (s)); -} - void ffesymbol_init_0 () { diff --git a/gnu/usr.bin/gcc/f/symbol.def b/gnu/usr.bin/gcc/f/symbol.def index ad100d4ebbe..1bb47345783 100644 --- a/gnu/usr.bin/gcc/f/symbol.def +++ b/gnu/usr.bin/gcc/f/symbol.def @@ -1,5 +1,5 @@ /* Definitions and documentations for attributes used in GNU F77 compiler - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/symbol.h b/gnu/usr.bin/gcc/f/symbol.h index 0a5188e9464..f2c95c80210 100644 --- a/gnu/usr.bin/gcc/f/symbol.h +++ b/gnu/usr.bin/gcc/f/symbol.h @@ -1,5 +1,5 @@ /* Interface definitions for Fortran symbol manager - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -79,6 +79,7 @@ enum _ffesymbol_checkstate_ typedef enum _ffesymbol_checkstate_ ffesymbolCheckState_; #define ffesymbolCheckState_f_ "" +#include "bad.h" #include "bld.h" #include "com.h" #include "equiv.h" @@ -190,7 +191,6 @@ void ffesymbol_error (ffesymbol s, ffelexToken t); #define ffesymbol_funcresult(s) ((s)->func_result) #define ffesymbol_generic(s) ((s)->generic) #define ffesymbol_global(s) ((s)->global) -void ffesymbol_globalize (ffesymbol s); #define ffesymbol_hook(s) ((s)->hook) #define ffesymbol_implementation(s) ((s)->implementation) #define ffesymbol_info(s) ((s)->info) @@ -211,7 +211,6 @@ void ffesymbol_init_4 (void); #define ffesymbol_kind(s) ffeinfo_kind((s)->info) ffesymbol ffesymbol_lookup_local (ffelexToken t); #define ffesymbol_maxentrynum(s) ((s)->max_entry_num) -#define ffesymbol_name(s) ((s)->name) #define ffesymbol_namelist(s) ((s)->namelist) #define ffesymbol_namelisted(s) ((s)->namelisted) #define ffesymbol_numentries(s) ((s)->num_entries) diff --git a/gnu/usr.bin/gcc/f/target.c b/gnu/usr.bin/gcc/f/target.c index 828e7adcf75..308771569d5 100644 --- a/gnu/usr.bin/gcc/f/target.c +++ b/gnu/usr.bin/gcc/f/target.c @@ -1,5 +1,5 @@ /* target.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. diff --git a/gnu/usr.bin/gcc/f/target.h b/gnu/usr.bin/gcc/f/target.h index 216d7704bd3..d68f49235db 100644 --- a/gnu/usr.bin/gcc/f/target.h +++ b/gnu/usr.bin/gcc/f/target.h @@ -1,5 +1,5 @@ /* target.h -- Public #include File (module.h template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -45,7 +45,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #if !defined (REAL_ARITHMETIC) \ && ((TARGET_FLOAT_FORMAT != HOST_FLOAT_FORMAT) \ || (FLOAT_WORDS_BIG_ENDIAN != HOST_FLOAT_WORDS_BIG_ENDIAN)) -#error "g77 requires ability to access exact FP representation of target machine" +#error g77 requires ability to access exact FP representation of target machine #endif /* Simple definitions and enumerations. */ @@ -82,6 +82,9 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef FFETARGET_defaultIS_PEDANTIC #define FFETARGET_defaultIS_PEDANTIC 0 #endif +#ifndef FFETARGET_defaultIS_VXT_NOT_90 +#define FFETARGET_defaultIS_VXT_NOT_90 0 +#endif #ifndef FFETARGET_defaultCASE_INTRIN #define FFETARGET_defaultCASE_INTRIN FFE_caseLOWER #endif @@ -94,6 +97,24 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef FFETARGET_defaultCASE_SYMBOL #define FFETARGET_defaultCASE_SYMBOL FFE_caseNONE #endif +#ifndef FFETARGET_defaultSTATE_DCP +#define FFETARGET_defaultSTATE_DCP FFE_intrinsicstateENABLED +#endif +#ifndef FFETARGET_defaultSTATE_F2C +#define FFETARGET_defaultSTATE_F2C FFE_intrinsicstateENABLED +#endif +#ifndef FFETARGET_defaultSTATE_F90 +#define FFETARGET_defaultSTATE_F90 FFE_intrinsicstateDELETED +#endif +#ifndef FFETARGET_defaultSTATE_MIL +#define FFETARGET_defaultSTATE_MIL FFE_intrinsicstateENABLED +#endif +#ifndef FFETARGET_defaultSTATE_UNIX +#define FFETARGET_defaultSTATE_UNIX FFE_intrinsicstateENABLED +#endif +#ifndef FFETARGET_defaultSTATE_VXT +#define FFETARGET_defaultSTATE_VXT FFE_intrinsicstateDELETED +#endif #ifndef FFETARGET_defaultFIXED_LINE_LENGTH #define FFETARGET_defaultFIXED_LINE_LENGTH 72 @@ -247,13 +268,8 @@ typedef long long ffetargetOffset; #define ffetargetOffset_f "ll" #if FFETARGET_okINTEGER1 -#ifndef __alpha__ typedef long int ffetargetInteger1; #define ffetargetInteger1_f "l" -#else -typedef int ffetargetInteger1; -#define ffetargetInteger1_f "" -#endif #endif #if FFETARGET_okINTEGER2 typedef signed char ffetargetInteger2; @@ -288,13 +304,8 @@ typedef ? ffetargetInteger8; ? #endif #if FFETARGET_okLOGICAL1 -#ifndef __alpha__ typedef long int ffetargetLogical1; #define ffetargetLogical1_f "l" -#else -typedef int ffetargetLogical1; -#define ffetargetLogical1_f "" -#endif #endif #if FFETARGET_okLOGICAL2 typedef signed char ffetargetLogical2; @@ -330,59 +341,19 @@ typedef ? ffetargetLogical8; #endif #if FFETARGET_okREAL1 #ifdef REAL_ARITHMETIC -#ifndef __alpha__ -typedef long int ffetargetReal1; -#define ffetargetReal1_f "l" -#define ffetarget_cvt_r1_to_rv_ REAL_VALUE_UNTO_TARGET_SINGLE -#define ffetarget_cvt_rv_to_r1_ REAL_VALUE_TO_TARGET_SINGLE +typedef HOST_WIDE_INT ffetargetReal1; #else -typedef int ffetargetReal1; -#define ffetargetReal1_f "" -#define ffetarget_cvt_r1_to_rv_(in) \ - ({ REAL_VALUE_TYPE _rv; \ - _rv = REAL_VALUE_UNTO_TARGET_SINGLE ((long) (in)); \ - _rv; }) -#define ffetarget_cvt_rv_to_r1_(in, out) \ - ({ long _tmp; \ - REAL_VALUE_TO_TARGET_SINGLE ((in), _tmp); \ - (out) = (ffetargetReal1) _tmp; }) -#endif -#else /* REAL_ARITHMETIC */ typedef float ffetargetReal1; #define ffetargetReal1_f "" -#endif /* REAL_ARITHMETIC */ +#endif #endif #if FFETARGET_okREAL2 #ifdef REAL_ARITHMETIC -#ifndef __alpha__ typedef struct { - long int v[2]; + HOST_WIDE_INT v[2]; } ffetargetReal2; -#define ffetargetReal2_f "l" -#define ffetarget_cvt_r2_to_rv_ REAL_VALUE_UNTO_TARGET_DOUBLE -#define ffetarget_cvt_rv_to_r2_ REAL_VALUE_TO_TARGET_DOUBLE -#else -typedef struct - { - int v[2]; - } -ffetargetReal2; -#define ffetargetReal2_f "" -#define ffetarget_cvt_r2_to_rv_(in) \ - ({ REAL_VALUE_TYPE _rv; \ - long _tmp[2]; \ - _tmp[0] = (in)[0]; \ - _tmp[1] = (in)[1]; \ - _rv = REAL_VALUE_UNTO_TARGET_DOUBLE (_tmp); \ - _rv; }) -#define ffetarget_cvt_rv_to_r2_(in, out) \ - ({ long _tmp[2]; \ - REAL_VALUE_TO_TARGET_DOUBLE ((in), _tmp); \ - (out)[0] = (int) (_tmp[0]); \ - (out)[1] = (int) (_tmp[1]); }) -#endif #else typedef double ffetargetReal2; #define ffetargetReal2_f "" @@ -856,36 +827,28 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); /* Define macros. */ -#if BUILT_FOR_280 -#define FFETARGET_REAL_VALUE_FROM_INT_(resr, lf, kt) \ - REAL_VALUE_FROM_INT (resr, (long) lf, (long) ((lf < 0) ? -1 : 0), ((kt == 1) ? SFmode : DFmode)) -#else -#define FFETARGET_REAL_VALUE_FROM_INT_(resr, lf, kt) \ - REAL_VALUE_FROM_INT (resr, (long) lf, (long) ((lf < 0) ? -1 : 0)) -#endif - #ifdef REAL_ARITHMETIC #define ffetarget_add_complex1(res,l,r) \ ({ REAL_VALUE_TYPE lr, li, rr, ri, resr, resi; \ - lr = ffetarget_cvt_r1_to_rv_ ((l).real); \ - li = ffetarget_cvt_r1_to_rv_ ((l).imaginary); \ - rr = ffetarget_cvt_r1_to_rv_ ((r).real); \ - ri = ffetarget_cvt_r1_to_rv_ ((r).imaginary); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l).real); \ + li = REAL_VALUE_FROM_TARGET_SINGLE ((l).imaginary); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r).real); \ + ri = REAL_VALUE_FROM_TARGET_SINGLE ((r).imaginary); \ REAL_ARITHMETIC (resr, PLUS_EXPR, lr, rr); \ REAL_ARITHMETIC (resi, PLUS_EXPR, li, ri); \ - ffetarget_cvt_rv_to_r1_ (resr, (res)->real); \ - ffetarget_cvt_rv_to_r1_ (resi, (res)->imaginary); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, (res)->real); \ + REAL_VALUE_TO_TARGET_SINGLE (resi, (res)->imaginary); \ FFEBAD; }) #define ffetarget_add_complex2(res,l,r) \ ({ REAL_VALUE_TYPE lr, li, rr, ri, resr, resi; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).real.v[0])); \ - li = ffetarget_cvt_r2_to_rv_ (&((l).imaginary.v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).real.v[0])); \ - ri = ffetarget_cvt_r2_to_rv_ (&((r).imaginary.v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).real.v[0])); \ + li = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).imaginary.v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).real.v[0])); \ + ri = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).imaginary.v[0])); \ REAL_ARITHMETIC (resr, PLUS_EXPR, lr, rr); \ REAL_ARITHMETIC (resi, PLUS_EXPR, li, ri); \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->real.v[0])); \ - ffetarget_cvt_rv_to_r2_ (resi, &((res)->imaginary.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->real.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resi, (long *) &((res)->imaginary.v[0])); \ FFEBAD; }) #else #define ffetarget_add_complex1(res,l,r) \ @@ -902,17 +865,17 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_add_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr, resr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ REAL_ARITHMETIC (resr, PLUS_EXPR, lr, rr); \ - ffetarget_cvt_rv_to_r1_ (resr, *(res)); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, *(res)); \ FFEBAD; }) #define ffetarget_add_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr, resr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ REAL_ARITHMETIC (resr, PLUS_EXPR, lr, rr); \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->v[0])); \ FFEBAD; }) #else #define ffetarget_add_real1(res,l,r) (*(res) = (l) + (r), FFEBAD) @@ -964,10 +927,10 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_convert_complex1_complex2(res,l) \ ({ REAL_VALUE_TYPE lr, li; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).real.v[0])); \ - li = ffetarget_cvt_r2_to_rv_ (&((l).imaginary.v[0])); \ - ffetarget_cvt_rv_to_r1_ (lr, (res)->real); \ - ffetarget_cvt_rv_to_r1_ (li, (res)->imaginary), \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).real.v[0])); \ + li = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).imaginary.v[0])); \ + REAL_VALUE_TO_TARGET_SINGLE (lr, (res)->real); \ + REAL_VALUE_TO_TARGET_SINGLE (li, (res)->imaginary), \ FFEBAD; }) #else #define ffetarget_convert_complex1_complex2(res,l) \ @@ -977,10 +940,10 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #define ffetarget_convert_complex1_integer(res,l) \ ({ REAL_VALUE_TYPE resi, resr; \ ffetargetInteger1 lf = (l); \ - FFETARGET_REAL_VALUE_FROM_INT_ (resr, lf, 1); \ + REAL_VALUE_FROM_INT (resr, (long) lf, (long) ((lf < 0) ? -1 : 0)); \ resi = dconst0; \ - ffetarget_cvt_rv_to_r1_ (resr, (res)->real); \ - ffetarget_cvt_rv_to_r1_ (resi, (res)->imaginary); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, (res)->real); \ + REAL_VALUE_TO_TARGET_SINGLE (resi, (res)->imaginary); \ FFEBAD; }) #else #define ffetarget_convert_complex1_integer(res,l) \ @@ -993,13 +956,13 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_convert_complex1_real1(res,l) \ ((res)->real = (l), \ - ffetarget_cvt_rv_to_r1_ (dconst0, (res)->imaginary), \ + REAL_VALUE_TO_TARGET_SINGLE (dconst0, (res)->imaginary), \ FFEBAD) #define ffetarget_convert_complex1_real2(res,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - ffetarget_cvt_rv_to_r1_ (lr, (res)->real); \ - ffetarget_cvt_rv_to_r1_ (dconst0, (res)->imaginary), \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + REAL_VALUE_TO_TARGET_SINGLE (lr, (res)->real); \ + REAL_VALUE_TO_TARGET_SINGLE (dconst0, (res)->imaginary), \ FFEBAD; }) #else #define ffetarget_convert_complex1_real1(res,l) \ @@ -1016,10 +979,10 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_convert_complex2_complex1(res,l) \ ({ REAL_VALUE_TYPE lr, li; \ - lr = ffetarget_cvt_r1_to_rv_ ((l).real); \ - li = ffetarget_cvt_r1_to_rv_ ((l).imaginary); \ - ffetarget_cvt_rv_to_r2_ (lr, &((res)->real.v[0])); \ - ffetarget_cvt_rv_to_r2_ (li, &((res)->imaginary.v[0])), \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l).real); \ + li = REAL_VALUE_FROM_TARGET_SINGLE ((l).imaginary); \ + REAL_VALUE_TO_TARGET_DOUBLE (lr, (long *) &((res)->real.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (li, (long *) &((res)->imaginary.v[0])), \ FFEBAD; }) #else #define ffetarget_convert_complex2_complex1(res,l) \ @@ -1029,10 +992,10 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #define ffetarget_convert_complex2_integer(res,l) \ ({ REAL_VALUE_TYPE resi, resr; \ ffetargetInteger1 lf = (l); \ - FFETARGET_REAL_VALUE_FROM_INT_ (resr, lf, 2); \ + REAL_VALUE_FROM_INT (resr, (long) lf, (long) ((lf < 0) ? -1 : 0)); \ resi = dconst0; \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->real.v[0])); \ - ffetarget_cvt_rv_to_r2_ (resi, &((res)->imaginary.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->real.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resi, (long *) &((res)->imaginary.v[0])); \ FFEBAD; }) #else #define ffetarget_convert_complex2_integer(res,l) \ @@ -1045,13 +1008,13 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_convert_complex2_real1(res,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r1_to_rv_ (l); \ - ffetarget_cvt_rv_to_r2_ (lr, &((res)->real.v[0])); \ - ffetarget_cvt_rv_to_r2_ (dconst0, &((res)->imaginary.v[0])), \ + lr = REAL_VALUE_FROM_TARGET_SINGLE (l); \ + REAL_VALUE_TO_TARGET_DOUBLE (lr, (long *) &((res)->real.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (dconst0, (long *) &((res)->imaginary.v[0])), \ FFEBAD; }) #define ffetarget_convert_complex2_real2(res,l) \ ((res)->real = (l), \ - ffetarget_cvt_rv_to_r2_ (dconst0, &((res)->imaginary.v[0])), \ + REAL_VALUE_TO_TARGET_DOUBLE (dconst0, (long *) &((res)->imaginary.v[0])), \ FFEBAD) #else #define ffetarget_convert_complex2_real1(res,l) \ @@ -1202,25 +1165,25 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_convert_integer1_real1(res,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r1_to_rv_ (l); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE (l); \ REAL_VALUE_TO_INT (&ffetarget_long_val_, &ffetarget_long_junk_, lr); \ *(res) = ffetarget_long_val_; \ FFEBAD; }) #define ffetarget_convert_integer1_real2(res,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ REAL_VALUE_TO_INT (&ffetarget_long_val_, &ffetarget_long_junk_, lr); \ *(res) = ffetarget_long_val_; \ FFEBAD; }) #define ffetarget_convert_integer1_complex1(res,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l).real); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l).real); \ REAL_VALUE_TO_INT (&ffetarget_long_val_, &ffetarget_long_junk_, lr); \ *(res) = ffetarget_long_val_; \ FFEBAD; }) #define ffetarget_convert_integer1_complex2(res,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).real.v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).real.v[0])); \ REAL_VALUE_TO_INT (&ffetarget_long_val_, &ffetarget_long_junk_, lr); \ *(res) = ffetarget_long_val_; \ FFEBAD; }) @@ -1249,8 +1212,8 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #define ffetarget_convert_real1_integer1(res,l) \ ({ REAL_VALUE_TYPE resr; \ ffetargetInteger1 lf = (l); \ - FFETARGET_REAL_VALUE_FROM_INT_ (resr, lf, 1); \ - ffetarget_cvt_rv_to_r1_ (resr, *(res)); \ + REAL_VALUE_FROM_INT (resr, (long) lf, (long) ((lf < 0) ? -1 : 0)); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, *(res)); \ FFEBAD; }) #else #define ffetarget_convert_real1_integer1(res,l) (*(res) = (l), FFEBAD) @@ -1258,8 +1221,8 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_convert_real1_real2(res,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - ffetarget_cvt_rv_to_r1_ (lr, *(res)); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + REAL_VALUE_TO_TARGET_SINGLE (lr, *(res)); \ FFEBAD; }) #else #define ffetarget_convert_real1_real2(res,l) (*(res) = (l), FFEBAD) @@ -1283,8 +1246,8 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #define ffetarget_convert_real2_integer(res,l) \ ({ REAL_VALUE_TYPE resr; \ ffetargetInteger1 lf = (l); \ - FFETARGET_REAL_VALUE_FROM_INT_ (resr, lf, 2); \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->v[0])); \ + REAL_VALUE_FROM_INT (resr, (long) lf, (long) ((lf < 0) ? -1 : 0)); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->v[0])); \ FFEBAD; }) #define ffetarget_convert_real2_integer1 ffetarget_convert_real2_integer #else @@ -1293,8 +1256,8 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_convert_real2_real1(res,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - ffetarget_cvt_rv_to_r2_ (lr, &((res)->v[0])); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + REAL_VALUE_TO_TARGET_DOUBLE (lr, (long *) &((res)->v[0])); \ FFEBAD; }) #else #define ffetarget_convert_real2_real1(res,l) (*(res) = (l), FFEBAD) @@ -1311,27 +1274,27 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_divide_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr, resr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ REAL_VALUES_EQUAL (rr, dconst0) \ - ? ({ ffetarget_cvt_rv_to_r1_ (dconst0, *(res)); \ + ? ({ REAL_VALUE_TO_TARGET_SINGLE (dconst0, *(res)); \ FFEBAD_DIV_BY_ZERO; \ }) \ : ({ REAL_ARITHMETIC (resr, RDIV_EXPR, lr, rr); \ - ffetarget_cvt_rv_to_r1_ (resr, *(res)); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, *(res)); \ FFEBAD; \ }); \ }) #define ffetarget_divide_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr, resr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ REAL_VALUES_EQUAL (rr, dconst0) \ - ? ({ ffetarget_cvt_rv_to_r2_ (dconst0, &((res)->v[0])); \ + ? ({ REAL_VALUE_TO_TARGET_DOUBLE (dconst0, (long *) &((res)->v[0])); \ FFEBAD_DIV_BY_ZERO; \ }) \ : ({ REAL_ARITHMETIC (resr, RDIV_EXPR, lr, rr); \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->v[0])); \ FFEBAD; \ }); \ }) @@ -1346,19 +1309,19 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_eq_complex1(res,l,r) \ ({ REAL_VALUE_TYPE lr, li, rr, ri; \ - lr = ffetarget_cvt_r1_to_rv_ ((l).real); \ - li = ffetarget_cvt_r1_to_rv_ ((l).imaginary); \ - rr = ffetarget_cvt_r1_to_rv_ ((r).real); \ - ri = ffetarget_cvt_r1_to_rv_ ((r).imaginary); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l).real); \ + li = REAL_VALUE_FROM_TARGET_SINGLE ((l).imaginary); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r).real); \ + ri = REAL_VALUE_FROM_TARGET_SINGLE ((r).imaginary); \ *(res) = (REAL_VALUES_EQUAL (lr, rr) && REAL_VALUES_EQUAL (li, ri)) \ ? TRUE : FALSE; \ FFEBAD; }) #define ffetarget_eq_complex2(res,l,r) \ ({ REAL_VALUE_TYPE lr, li, rr, ri; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).real.v[0])); \ - li = ffetarget_cvt_r2_to_rv_ (&((l).imaginary.v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).real.v[0])); \ - ri = ffetarget_cvt_r2_to_rv_ (&((r).imaginary.v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).real.v[0])); \ + li = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).imaginary.v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).real.v[0])); \ + ri = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).imaginary.v[0])); \ *(res) = (REAL_VALUES_EQUAL (lr, rr) && REAL_VALUES_EQUAL (li, ri)) \ ? TRUE : FALSE; \ FFEBAD; }) @@ -1381,14 +1344,14 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_eq_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ *(res) = REAL_VALUES_EQUAL (lr, rr) ? TRUE : FALSE; \ FFEBAD; }) #define ffetarget_eq_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ *(res) = REAL_VALUES_EQUAL (lr, rr) ? TRUE : FALSE; \ FFEBAD; }) #else @@ -1416,14 +1379,14 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_ge_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ *(res) = REAL_VALUES_LESS (lr, rr) ? FALSE : TRUE; \ FFEBAD; }) #define ffetarget_ge_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ *(res) = REAL_VALUES_LESS (lr, rr) ? FALSE : TRUE; \ FFEBAD; }) #else @@ -1443,15 +1406,15 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_gt_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ *(res) = (REAL_VALUES_LESS (lr, rr) || REAL_VALUES_EQUAL (lr, rr)) \ ? FALSE : TRUE; \ FFEBAD; }) #define ffetarget_gt_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ *(res) = (REAL_VALUES_LESS (lr, rr) || REAL_VALUES_EQUAL (lr, rr)) \ ? FALSE : TRUE; \ FFEBAD; }) @@ -1470,22 +1433,17 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #define ffetarget_init_2() #define ffetarget_init_3() #define ffetarget_init_4() -#ifndef __alpha__ #define ffetarget_integerdefault_is_magical(i) \ (((unsigned long int) i) == FFETARGET_integerBIG_MAGICAL) -#else -#define ffetarget_integerdefault_is_magical(i) \ - (((unsigned int) i) == FFETARGET_integerBIG_MAGICAL) -#endif #ifdef REAL_ARITHMETIC #define ffetarget_iszero_real1(l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ REAL_VALUES_EQUAL (lr, dconst0); \ }) #define ffetarget_iszero_real2(l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ REAL_VALUES_EQUAL (lr, dconst0); \ }) #else @@ -1505,15 +1463,15 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_le_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ *(res) = (REAL_VALUES_LESS (lr, rr) || REAL_VALUES_EQUAL (lr, rr)) \ ? TRUE : FALSE; \ FFEBAD; }) #define ffetarget_le_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ *(res) = (REAL_VALUES_LESS (lr, rr) || REAL_VALUES_EQUAL (lr, rr)) \ ? TRUE : FALSE; \ FFEBAD; }) @@ -1534,14 +1492,14 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_lt_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ *(res) = REAL_VALUES_LESS (lr, rr) ? TRUE : FALSE; \ FFEBAD; }) #define ffetarget_lt_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ *(res) = REAL_VALUES_LESS (lr, rr) ? TRUE : FALSE; \ FFEBAD; }) #else @@ -1554,9 +1512,9 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #define ffetarget_length_characterdefault ffetarget_length_character1 #ifdef REAL_ARITHMETIC #define ffetarget_make_real1(res,lr) \ - ffetarget_cvt_rv_to_r1_ ((lr), *(res)) + REAL_VALUE_TO_TARGET_SINGLE ((lr), *(res)) #define ffetarget_make_real2(res,lr) \ - ffetarget_cvt_rv_to_r2_ ((lr), &((res)->v[0])) + REAL_VALUE_TO_TARGET_DOUBLE ((lr), (long *) &((res)->v[0])) #else #define ffetarget_make_real1(res,lr) (*(res) = (lr)) #define ffetarget_make_real2(res,lr) (*(res) = (lr)) @@ -1568,17 +1526,17 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_multiply_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr, resr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ REAL_ARITHMETIC (resr, MULT_EXPR, lr, rr); \ - ffetarget_cvt_rv_to_r1_ (resr, *(res)); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, *(res)); \ FFEBAD; }) #define ffetarget_multiply_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr, resr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ REAL_ARITHMETIC (resr, MULT_EXPR, lr, rr); \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->v[0])); \ FFEBAD; }) #else #define ffetarget_multiply_real1(res,l,r) (*(res) = (l) * (r), FFEBAD) @@ -1587,19 +1545,19 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_ne_complex1(res,l,r) \ ({ REAL_VALUE_TYPE lr, li, rr, ri; \ - lr = ffetarget_cvt_r1_to_rv_ ((l).real); \ - li = ffetarget_cvt_r1_to_rv_ ((l).imaginary); \ - rr = ffetarget_cvt_r1_to_rv_ ((r).real); \ - ri = ffetarget_cvt_r1_to_rv_ ((r).imaginary); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l).real); \ + li = REAL_VALUE_FROM_TARGET_SINGLE ((l).imaginary); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r).real); \ + ri = REAL_VALUE_FROM_TARGET_SINGLE ((r).imaginary); \ *(res) = (REAL_VALUES_EQUAL (lr, rr) && REAL_VALUES_EQUAL (li, ri)) \ ? FALSE : TRUE; \ FFEBAD; }) #define ffetarget_ne_complex2(res,l,r) \ ({ REAL_VALUE_TYPE lr, li, rr, ri; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).real.v[0])); \ - li = ffetarget_cvt_r2_to_rv_ (&((l).imaginary.v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).real.v[0])); \ - ri = ffetarget_cvt_r2_to_rv_ (&((r).imaginary.v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).real.v[0])); \ + li = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).imaginary.v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).real.v[0])); \ + ri = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).imaginary.v[0])); \ *(res) = (REAL_VALUES_EQUAL (lr, rr) && REAL_VALUES_EQUAL (li, ri)) \ ? FALSE : TRUE; \ FFEBAD; }) @@ -1622,14 +1580,14 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_ne_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ *(res) = REAL_VALUES_EQUAL (lr, rr) ? FALSE : TRUE; \ FFEBAD; }) #define ffetarget_ne_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ *(res) = REAL_VALUES_EQUAL (lr, rr) ? FALSE : TRUE; \ FFEBAD; }) #else @@ -1696,13 +1654,13 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_print_real1(f,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ REAL_VALUE_TO_DECIMAL (lr, bad_fmt_val??, ffetarget_string_); \ fputs (ffetarget_string_, (f)); \ }) #define ffetarget_print_real2(f,l) \ ({ REAL_VALUE_TYPE lr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ REAL_VALUE_TO_DECIMAL (lr, bad_fmt_val??, ffetarget_string_); \ fputs (ffetarget_string_, (f)); \ }) @@ -1713,22 +1671,22 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); fprintf ((f), "%" ffetargetReal2_f "g", (v)) #endif #ifdef REAL_ARITHMETIC -#define ffetarget_real1_one(res) ffetarget_cvt_rv_to_r1_ (dconst1, *(res)) -#define ffetarget_real2_one(res) ffetarget_cvt_rv_to_r2_ (dconst1, &((res)->v[0])) +#define ffetarget_real1_one(res) REAL_VALUE_TO_TARGET_SINGLE (dconst1, *(res)) +#define ffetarget_real2_one(res) REAL_VALUE_TO_TARGET_DOUBLE (dconst1, (long *) &((res)->v[0])) #else #define ffetarget_real1_one(res) (*(res) = (float) 1.) #define ffetarget_real2_one(res) (*(res) = 1.) #endif #ifdef REAL_ARITHMETIC -#define ffetarget_real1_two(res) ffetarget_cvt_rv_to_r1_ (dconst2, *(res)) -#define ffetarget_real2_two(res) ffetarget_cvt_rv_to_r2_ (dconst2, &((res)->v[0])) +#define ffetarget_real1_two(res) REAL_VALUE_TO_TARGET_SINGLE (dconst2, *(res)) +#define ffetarget_real2_two(res) REAL_VALUE_TO_TARGET_DOUBLE (dconst2, (long *) &((res)->v[0])) #else #define ffetarget_real1_two(res) (*(res) = (float) 2.) #define ffetarget_real2_two(res) (*(res) = 2.) #endif #ifdef REAL_ARITHMETIC -#define ffetarget_real1_zero(res) ffetarget_cvt_rv_to_r1_ (dconst0, *(res)) -#define ffetarget_real2_zero(res) ffetarget_cvt_rv_to_r2_ (dconst0, &((res)->v[0])) +#define ffetarget_real1_zero(res) REAL_VALUE_TO_TARGET_SINGLE (dconst0, *(res)) +#define ffetarget_real2_zero(res) REAL_VALUE_TO_TARGET_DOUBLE (dconst0, (long *) &((res)->v[0])) #else #define ffetarget_real1_zero(res) (*(res) = (float) 0.) #define ffetarget_real2_zero(res) (*(res) = 0.) @@ -1740,25 +1698,25 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_subtract_complex1(res,l,r) \ ({ REAL_VALUE_TYPE lr, li, rr, ri, resr, resi; \ - lr = ffetarget_cvt_r1_to_rv_ ((l).real); \ - li = ffetarget_cvt_r1_to_rv_ ((l).imaginary); \ - rr = ffetarget_cvt_r1_to_rv_ ((r).real); \ - ri = ffetarget_cvt_r1_to_rv_ ((r).imaginary); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l).real); \ + li = REAL_VALUE_FROM_TARGET_SINGLE ((l).imaginary); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r).real); \ + ri = REAL_VALUE_FROM_TARGET_SINGLE ((r).imaginary); \ REAL_ARITHMETIC (resr, MINUS_EXPR, lr, rr); \ REAL_ARITHMETIC (resi, MINUS_EXPR, li, ri); \ - ffetarget_cvt_rv_to_r1_ (resr, (res)->real); \ - ffetarget_cvt_rv_to_r1_ (resi, (res)->imaginary); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, (res)->real); \ + REAL_VALUE_TO_TARGET_SINGLE (resi, (res)->imaginary); \ FFEBAD; }) #define ffetarget_subtract_complex2(res,l,r) \ ({ REAL_VALUE_TYPE lr, li, rr, ri, resr, resi; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).real.v[0])); \ - li = ffetarget_cvt_r2_to_rv_ (&((l).imaginary.v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).real.v[0])); \ - ri = ffetarget_cvt_r2_to_rv_ (&((r).imaginary.v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).real.v[0])); \ + li = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).imaginary.v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).real.v[0])); \ + ri = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).imaginary.v[0])); \ REAL_ARITHMETIC (resr, MINUS_EXPR, lr, rr); \ REAL_ARITHMETIC (resi, MINUS_EXPR, li, ri); \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->real.v[0])); \ - ffetarget_cvt_rv_to_r2_ (resi, &((res)->imaginary.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->real.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resi, (long *) &((res)->imaginary.v[0])); \ FFEBAD; }) #else #define ffetarget_subtract_complex1(res,l,r) \ @@ -1775,17 +1733,17 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_subtract_real1(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr, resr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ - rr = ffetarget_cvt_r1_to_rv_ ((r)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ + rr = REAL_VALUE_FROM_TARGET_SINGLE ((r)); \ REAL_ARITHMETIC (resr, MINUS_EXPR, lr, rr); \ - ffetarget_cvt_rv_to_r1_ (resr, *(res)); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, *(res)); \ FFEBAD; }) #define ffetarget_subtract_real2(res,l,r) \ ({ REAL_VALUE_TYPE lr, rr, resr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ - rr = ffetarget_cvt_r2_to_rv_ (&((r).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ + rr = REAL_VALUE_FROM_TARGET_DOUBLE (&((r).v[0])); \ REAL_ARITHMETIC (resr, MINUS_EXPR, lr, rr); \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->v[0])); \ FFEBAD; }) #else #define ffetarget_subtract_real1(res,l,r) (*(res) = (l) - (r), FFEBAD) @@ -1801,21 +1759,21 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_uminus_complex1(res,l) \ ({ REAL_VALUE_TYPE lr, li, resr, resi; \ - lr = ffetarget_cvt_r1_to_rv_ ((l).real); \ - li = ffetarget_cvt_r1_to_rv_ ((l).imaginary); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l).real); \ + li = REAL_VALUE_FROM_TARGET_SINGLE ((l).imaginary); \ resr = REAL_VALUE_NEGATE (lr); \ resi = REAL_VALUE_NEGATE (li); \ - ffetarget_cvt_rv_to_r1_ (resr, (res)->real); \ - ffetarget_cvt_rv_to_r1_ (resi, (res)->imaginary); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, (res)->real); \ + REAL_VALUE_TO_TARGET_SINGLE (resi, (res)->imaginary); \ FFEBAD; }) #define ffetarget_uminus_complex2(res,l) \ ({ REAL_VALUE_TYPE lr, li, resr, resi; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).real.v[0])); \ - li = ffetarget_cvt_r2_to_rv_ (&((l).imaginary.v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).real.v[0])); \ + li = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).imaginary.v[0])); \ resr = REAL_VALUE_NEGATE (lr); \ resi = REAL_VALUE_NEGATE (li); \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->real.v[0])); \ - ffetarget_cvt_rv_to_r2_ (resi, &((res)->imaginary.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->real.v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resi, (long *) &((res)->imaginary.v[0])); \ FFEBAD; }) #else #define ffetarget_uminus_complex1(res,l) \ @@ -1830,23 +1788,23 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len); #ifdef REAL_ARITHMETIC #define ffetarget_uminus_real1(res,l) \ ({ REAL_VALUE_TYPE lr, resr; \ - lr = ffetarget_cvt_r1_to_rv_ ((l)); \ + lr = REAL_VALUE_FROM_TARGET_SINGLE ((l)); \ resr = REAL_VALUE_NEGATE (lr); \ - ffetarget_cvt_rv_to_r1_ (resr, *(res)); \ + REAL_VALUE_TO_TARGET_SINGLE (resr, *(res)); \ FFEBAD; }) #define ffetarget_uminus_real2(res,l) \ ({ REAL_VALUE_TYPE lr, resr; \ - lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \ + lr = REAL_VALUE_FROM_TARGET_DOUBLE (&((l).v[0])); \ resr = REAL_VALUE_NEGATE (lr); \ - ffetarget_cvt_rv_to_r2_ (resr, &((res)->v[0])); \ + REAL_VALUE_TO_TARGET_DOUBLE (resr, (long *) &((res)->v[0])); \ FFEBAD; }) #else #define ffetarget_uminus_real1(res,l) (*(res) = -(l), FFEBAD) #define ffetarget_uminus_real2(res,l) (*(res) = -(l), FFEBAD) #endif #ifdef REAL_ARITHMETIC -#define ffetarget_value_real1(lr) ffetarget_cvt_r1_to_rv_ ((lr)) -#define ffetarget_value_real2(lr) ffetarget_cvt_r2_to_rv_ (&((lr).v[0])) +#define ffetarget_value_real1(lr) REAL_VALUE_FROM_TARGET_SINGLE ((lr)) +#define ffetarget_value_real2(lr) REAL_VALUE_FROM_TARGET_DOUBLE (&((lr).v[0])) #else #define ffetarget_value_real1 #define ffetarget_value_real2 diff --git a/gnu/usr.bin/gcc/f/top.c b/gnu/usr.bin/gcc/f/top.c index 1d22cc9add3..6599de944fc 100644 --- a/gnu/usr.bin/gcc/f/top.c +++ b/gnu/usr.bin/gcc/f/top.c @@ -1,5 +1,5 @@ /* top.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -65,7 +65,6 @@ bool ffe_is_do_internal_checks_ = TRUE; bool ffe_is_90_ = FFETARGET_defaultIS_90; bool ffe_is_automatic_ = FFETARGET_defaultIS_AUTOMATIC; bool ffe_is_backslash_ = FFETARGET_defaultIS_BACKSLASH; -bool ffe_is_emulate_complex_ = TRUE; bool ffe_is_underscoring_ = FFETARGET_defaultEXTERNAL_UNDERSCORED || FFETARGET_defaultUNDERSCORED_EXTERNAL_UNDERSCORED; bool ffe_is_second_underscore_ = FFETARGET_defaultUNDERSCORED_EXTERNAL_UNDERSCORED; @@ -81,18 +80,16 @@ bool ffe_is_mainprog_; /* TRUE if current prog unit known to be main. */ bool ffe_is_onetrip_ = FALSE; bool ffe_is_silent_ = TRUE; -bool ffe_is_typeless_boz_ = FALSE; +bool ffe_is_typeless_boz_ = TRUE; /* Will become FALSE as of 0.5.20 or so. */ bool ffe_is_pedantic_ = FFETARGET_defaultIS_PEDANTIC; bool ffe_is_saveall_; /* TRUE if mainprog or SAVE (no args) seen. */ bool ffe_is_ugly_args_ = TRUE; -bool ffe_is_ugly_assign_ = FALSE; /* Try and store pointer to ASSIGN labels in INTEGER vars. */ bool ffe_is_ugly_assumed_ = FALSE; /* DIMENSION X([...,]1) => DIMENSION X([...,]*) */ bool ffe_is_ugly_comma_ = FALSE; -bool ffe_is_ugly_complex_ = FALSE; bool ffe_is_ugly_init_ = TRUE; bool ffe_is_ugly_logint_ = FALSE; bool ffe_is_version_ = FALSE; -bool ffe_is_vxt_ = FALSE; +bool ffe_is_vxt_not_90_ = FFETARGET_defaultIS_VXT_NOT_90; bool ffe_is_warn_implicit_ = FALSE; bool ffe_is_warn_surprising_ = FALSE; bool ffe_is_zeros_ = FALSE; @@ -100,12 +97,12 @@ ffeCase ffe_case_intrin_ = FFETARGET_defaultCASE_INTRIN; ffeCase ffe_case_match_ = FFETARGET_defaultCASE_MATCH; ffeCase ffe_case_source_ = FFETARGET_defaultCASE_SOURCE; ffeCase ffe_case_symbol_ = FFETARGET_defaultCASE_SYMBOL; -ffeIntrinsicState ffe_intrinsic_state_gnu_ = FFE_intrinsicstateENABLED; -ffeIntrinsicState ffe_intrinsic_state_f2c_ = FFE_intrinsicstateENABLED; -ffeIntrinsicState ffe_intrinsic_state_f90_ = FFE_intrinsicstateENABLED; -ffeIntrinsicState ffe_intrinsic_state_mil_ = FFE_intrinsicstateENABLED; -ffeIntrinsicState ffe_intrinsic_state_unix_ = FFE_intrinsicstateENABLED; -ffeIntrinsicState ffe_intrinsic_state_vxt_ = FFE_intrinsicstateENABLED; +ffeIntrinsicState ffe_intrinsic_state_dcp_ = FFETARGET_defaultSTATE_DCP; +ffeIntrinsicState ffe_intrinsic_state_f2c_ = FFETARGET_defaultSTATE_F2C; +ffeIntrinsicState ffe_intrinsic_state_f90_ = FFETARGET_defaultSTATE_F90; +ffeIntrinsicState ffe_intrinsic_state_mil_ = FFETARGET_defaultSTATE_MIL; +ffeIntrinsicState ffe_intrinsic_state_unix_ = FFETARGET_defaultSTATE_UNIX; +ffeIntrinsicState ffe_intrinsic_state_vxt_ = FFETARGET_defaultSTATE_VXT; int ffe_fixed_line_length_ = FFETARGET_defaultFIXED_LINE_LENGTH; mallocPool ffe_file_pool_ = NULL; mallocPool ffe_any_unit_pool_ = NULL; @@ -175,7 +172,6 @@ ffe_decode_option (char *opt) flag_move_all_movables = 1; flag_reduce_all_givs = 1; flag_rerun_loop_opt = 1; - flag_argument_noalias = 2; #endif } else if (strcmp (&opt[2], "ident") == 0) @@ -233,33 +229,23 @@ ffe_decode_option (char *opt) ffe_set_is_pedantic (TRUE); else if (strcmp (&opt[2], "no-pedantic") == 0) ffe_set_is_pedantic (FALSE); - else if (strcmp (&opt[2], "vxt") == 0) - ffe_set_is_vxt (TRUE); - else if (strcmp (&opt[2], "not-vxt") == 0) - ffe_set_is_vxt (FALSE); else if (strcmp (&opt[2], "vxt-not-f90") == 0) - warning ("%s no longer supported -- try -fvxt", opt); + ffe_set_is_vxt_not_90 (TRUE); else if (strcmp (&opt[2], "f90-not-vxt") == 0) - warning ("%s no longer supported -- try -fno-vxt -ff90", opt); + ffe_set_is_vxt_not_90 (FALSE); else if (strcmp (&opt[2], "ugly") == 0) { - warning ("%s is overloaded with meanings and likely to be removed;", opt); - warning ("use only the specific -fugly-* options you need"); ffe_set_is_ugly_args (TRUE); - ffe_set_is_ugly_assign (TRUE); ffe_set_is_ugly_assumed (TRUE); ffe_set_is_ugly_comma (TRUE); - ffe_set_is_ugly_complex (TRUE); ffe_set_is_ugly_init (TRUE); ffe_set_is_ugly_logint (TRUE); } else if (strcmp (&opt[2], "no-ugly") == 0) { ffe_set_is_ugly_args (FALSE); - ffe_set_is_ugly_assign (FALSE); ffe_set_is_ugly_assumed (FALSE); ffe_set_is_ugly_comma (FALSE); - ffe_set_is_ugly_complex (FALSE); ffe_set_is_ugly_init (FALSE); ffe_set_is_ugly_logint (FALSE); } @@ -267,10 +253,6 @@ ffe_decode_option (char *opt) ffe_set_is_ugly_args (TRUE); else if (strcmp (&opt[2], "no-ugly-args") == 0) ffe_set_is_ugly_args (FALSE); - else if (strcmp (&opt[2], "ugly-assign") == 0) - ffe_set_is_ugly_assign (TRUE); - else if (strcmp (&opt[2], "no-ugly-assign") == 0) - ffe_set_is_ugly_assign (FALSE); else if (strcmp (&opt[2], "ugly-assumed") == 0) ffe_set_is_ugly_assumed (TRUE); else if (strcmp (&opt[2], "no-ugly-assumed") == 0) @@ -279,10 +261,6 @@ ffe_decode_option (char *opt) ffe_set_is_ugly_comma (TRUE); else if (strcmp (&opt[2], "no-ugly-comma") == 0) ffe_set_is_ugly_comma (FALSE); - else if (strcmp (&opt[2], "ugly-complex") == 0) - ffe_set_is_ugly_complex (TRUE); - else if (strcmp (&opt[2], "no-ugly-complex") == 0) - ffe_set_is_ugly_complex (FALSE); else if (strcmp (&opt[2], "ugly-init") == 0) ffe_set_is_ugly_init (TRUE); else if (strcmp (&opt[2], "no-ugly-init") == 0) @@ -299,10 +277,6 @@ ffe_decode_option (char *opt) ffe_set_is_init_local_zero (TRUE); else if (strcmp (&opt[2], "no-init-local-zero") == 0) ffe_set_is_init_local_zero (FALSE); - else if (strcmp (&opt[2], "emulate-complex") == 0) - ffe_set_is_emulate_complex (TRUE); - else if (strcmp (&opt[2], "no-emulate-complex") == 0) - ffe_set_is_emulate_complex (FALSE); else if (strcmp (&opt[2], "backslash") == 0) ffe_set_is_backslash (TRUE); else if (strcmp (&opt[2], "no-backslash") == 0) @@ -407,14 +381,14 @@ ffe_decode_option (char *opt) ffe_set_case_source (FFE_caseNONE); ffe_set_case_symbol (FFE_caseNONE); } - else if (strcmp (&opt[2], "gnu-intrinsics-delete") == 0) - ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDELETED); - else if (strcmp (&opt[2], "gnu-intrinsics-hide") == 0) - ffe_set_intrinsic_state_gnu (FFE_intrinsicstateHIDDEN); - else if (strcmp (&opt[2], "gnu-intrinsics-disable") == 0) - ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDISABLED); - else if (strcmp (&opt[2], "gnu-intrinsics-enable") == 0) - ffe_set_intrinsic_state_gnu (FFE_intrinsicstateENABLED); + else if (strcmp (&opt[2], "dcp-intrinsics-delete") == 0) + ffe_set_intrinsic_state_dcp (FFE_intrinsicstateDELETED); + else if (strcmp (&opt[2], "dcp-intrinsics-hide") == 0) + ffe_set_intrinsic_state_dcp (FFE_intrinsicstateHIDDEN); + else if (strcmp (&opt[2], "dcp-intrinsics-disable") == 0) + ffe_set_intrinsic_state_dcp (FFE_intrinsicstateDISABLED); + else if (strcmp (&opt[2], "dcp-intrinsics-enable") == 0) + ffe_set_intrinsic_state_dcp (FFE_intrinsicstateENABLED); else if (strcmp (&opt[2], "f2c-intrinsics-delete") == 0) ffe_set_intrinsic_state_f2c (FFE_intrinsicstateDELETED); else if (strcmp (&opt[2], "f2c-intrinsics-hide") == 0) diff --git a/gnu/usr.bin/gcc/f/top.h b/gnu/usr.bin/gcc/f/top.h index cc6d84bc8a3..99685932773 100644 --- a/gnu/usr.bin/gcc/f/top.h +++ b/gnu/usr.bin/gcc/f/top.h @@ -1,5 +1,5 @@ /* top.h -- Public #include File (module.h template V1.0) - Copyright (C) 1995-1997 Free Software Foundation, Inc. + Copyright (C) 1995 Free Software Foundation, Inc. Contributed by James Craig Burley (burley@gnu.ai.mit.edu). This file is part of GNU Fortran. @@ -82,7 +82,6 @@ extern bool ffe_is_do_internal_checks_; extern bool ffe_is_90_; extern bool ffe_is_automatic_; extern bool ffe_is_backslash_; -extern bool ffe_is_emulate_complex_; extern bool ffe_is_underscoring_; extern bool ffe_is_second_underscore_; extern bool ffe_is_debug_kludge_; @@ -100,14 +99,12 @@ extern bool ffe_is_typeless_boz_; extern bool ffe_is_pedantic_; extern bool ffe_is_saveall_; extern bool ffe_is_ugly_args_; -extern bool ffe_is_ugly_assign_; extern bool ffe_is_ugly_assumed_; extern bool ffe_is_ugly_comma_; -extern bool ffe_is_ugly_complex_; extern bool ffe_is_ugly_init_; extern bool ffe_is_ugly_logint_; extern bool ffe_is_version_; -extern bool ffe_is_vxt_; +extern bool ffe_is_vxt_not_90_; extern bool ffe_is_warn_implicit_; extern bool ffe_is_warn_surprising_; extern bool ffe_is_zeros_; @@ -115,7 +112,7 @@ extern ffeCase ffe_case_intrin_; extern ffeCase ffe_case_match_; extern ffeCase ffe_case_source_; extern ffeCase ffe_case_symbol_; -extern ffeIntrinsicState ffe_intrinsic_state_gnu_; +extern ffeIntrinsicState ffe_intrinsic_state_dcp_; extern ffeIntrinsicState ffe_intrinsic_state_f2c_; extern ffeIntrinsicState ffe_intrinsic_state_f90_; extern ffeIntrinsicState ffe_intrinsic_state_mil_; @@ -157,9 +154,9 @@ void ffe_terminate_4 (void); #define ffe_case_match() ffe_case_match_ #define ffe_case_source() ffe_case_source_ #define ffe_case_symbol() ffe_case_symbol_ +#define ffe_intrinsic_state_dcp() ffe_intrinsic_state_dcp_ #define ffe_intrinsic_state_f2c() ffe_intrinsic_state_f2c_ #define ffe_intrinsic_state_f90() ffe_intrinsic_state_f90_ -#define ffe_intrinsic_state_gnu() ffe_intrinsic_state_gnu_ #define ffe_intrinsic_state_mil() ffe_intrinsic_state_mil_ #define ffe_intrinsic_state_unix() ffe_intrinsic_state_unix_ #define ffe_intrinsic_state_vxt() ffe_intrinsic_state_vxt_ @@ -169,7 +166,6 @@ void ffe_terminate_4 (void); #define ffe_is_debug_kludge() ffe_is_debug_kludge_ #define ffe_is_do_internal_checks() ffe_is_do_internal_checks_ #define ffe_is_dollar_ok() ffe_is_dollar_ok_ -#define ffe_is_emulate_complex() ffe_is_emulate_complex_ #define ffe_is_f2c() ffe_is_f2c_ #define ffe_is_f2c_library() ffe_is_f2c_library_ #define ffe_is_ffedebug() ffe_is_ffedebug_ @@ -185,15 +181,13 @@ void ffe_terminate_4 (void); #define ffe_is_silent() ffe_is_silent_ #define ffe_is_typeless_boz() ffe_is_typeless_boz_ #define ffe_is_ugly_args() ffe_is_ugly_args_ -#define ffe_is_ugly_assign() ffe_is_ugly_assign_ #define ffe_is_ugly_assumed() ffe_is_ugly_assumed_ #define ffe_is_ugly_comma() ffe_is_ugly_comma_ -#define ffe_is_ugly_complex() ffe_is_ugly_complex_ #define ffe_is_ugly_init() ffe_is_ugly_init_ #define ffe_is_ugly_logint() ffe_is_ugly_logint_ #define ffe_is_underscoring() ffe_is_underscoring_ #define ffe_is_version() ffe_is_version_ -#define ffe_is_vxt() ffe_is_vxt_ +#define ffe_is_vxt_not_90() ffe_is_vxt_not_90_ #define ffe_is_warn_implicit() ffe_is_warn_implicit_ #define ffe_is_warn_surprising() ffe_is_warn_surprising_ #define ffe_is_zeros() ffe_is_zeros_ @@ -205,9 +199,9 @@ void ffe_terminate_4 (void); #define ffe_set_case_match(f) (ffe_case_match_ = (f)) #define ffe_set_case_source(f) (ffe_case_source_ = (f)) #define ffe_set_case_symbol(f) (ffe_case_symbol_ = (f)) +#define ffe_set_intrinsic_state_dcp(s) (ffe_intrinsic_state_dcp_ = (s)) #define ffe_set_intrinsic_state_f2c(s) (ffe_intrinsic_state_f2c_ = (s)) #define ffe_set_intrinsic_state_f90(s) (ffe_intrinsic_state_f90_ = (s)) -#define ffe_set_intrinsic_state_gnu(s) (ffe_intrinsic_state_gnu_ = (s)) #define ffe_set_intrinsic_state_mil(s) (ffe_intrinsic_state_mil_ = (s)) #define ffe_set_intrinsic_state_unix(s) (ffe_intrinsic_state_unix_ = (s)) #define ffe_set_intrinsic_state_vxt(s) (ffe_intrinsic_state_vxt_ = (s)) @@ -217,7 +211,6 @@ void ffe_terminate_4 (void); #define ffe_set_is_debug_kludge(f) (ffe_is_debug_kludge_ = (f)) #define ffe_set_is_do_internal_checks(f) (ffe_set_is_do_internal_checks_ = (f)) #define ffe_set_is_dollar_ok(f) (ffe_is_dollar_ok_ = (f)) -#define ffe_set_is_emulate_complex(f) (ffe_is_emulate_complex_ = (f)) #define ffe_set_is_f2c(f) (ffe_is_f2c_ = (f)) #define ffe_set_is_f2c_library(f) (ffe_is_f2c_library_ = (f)) #define ffe_set_is_ffedebug(f) (ffe_is_ffedebug_ = (f)) @@ -232,15 +225,13 @@ void ffe_terminate_4 (void); #define ffe_set_is_silent(f) (ffe_is_silent_ = (f)) #define ffe_set_is_typeless_boz(f) (ffe_is_typeless_boz_ = (f)) #define ffe_set_is_ugly_args(f) (ffe_is_ugly_args_ = (f)) -#define ffe_set_is_ugly_assign(f) (ffe_is_ugly_assign_ = (f)) #define ffe_set_is_ugly_assumed(f) (ffe_is_ugly_assumed_ = (f)) #define ffe_set_is_ugly_comma(f) (ffe_is_ugly_comma_ = (f)) -#define ffe_set_is_ugly_complex(f) (ffe_is_ugly_complex_ = (f)) #define ffe_set_is_ugly_init(f) (ffe_is_ugly_init_ = (f)) #define ffe_set_is_ugly_logint(f) (ffe_is_ugly_logint_ = (f)) #define ffe_set_is_underscoring(f) (ffe_is_underscoring_ = (f)) #define ffe_set_is_version(f) (ffe_is_version_ = (f)) -#define ffe_set_is_vxt(f) (ffe_is_vxt_ = (f)) +#define ffe_set_is_vxt_not_90(f) (ffe_is_vxt_not_90_ = (f)) #define ffe_set_is_warn_implicit(f) (ffe_is_warn_implicit_ = (f)) #define ffe_set_is_warn_surprising(f) (ffe_is_warn_surprising_ = (f)) #define ffe_set_is_zeros(f) (ffe_is_zeros_ = (f)) diff --git a/gnu/usr.bin/gcc/f/type.c b/gnu/usr.bin/gcc/f/type.c index 48da8d785f6..cc15f8bfd33 100644 --- a/gnu/usr.bin/gcc/f/type.c +++ b/gnu/usr.bin/gcc/f/type.c @@ -37,8 +37,7 @@ ffetype_lookup_kind (ffetype base_type, int kind) return base_type->kinds_->type_[kind]; } -ffetype -ffetype_lookup_star (ffetype base_type, int star) +ffetype ffetype_lookup_star (ffetype base_type, int star) { if ((base_type->stars_ == NULL) || (star < 0) @@ -48,8 +47,7 @@ ffetype_lookup_star (ffetype base_type, int star) return base_type->stars_->type_[star]; } -ffetype -ffetype_new (void) +ffetype ffetype_new (void) { ffetype type; @@ -64,8 +62,7 @@ ffetype_new (void) return type; } -void -ffetype_set_kind (ffetype base_type, int kind, ffetype type) +void ffetype_set_kind (ffetype base_type, int kind, ffetype type) { if (base_type->kinds_ == NULL) { @@ -84,8 +81,7 @@ ffetype_set_kind (ffetype base_type, int kind, ffetype type) base_type->kinds_->type_[kind] = type; } -void -ffetype_set_star (ffetype base_type, int star, ffetype type) +void ffetype_set_star (ffetype base_type, int star, ffetype type) { if (base_type->stars_ == NULL) { diff --git a/gnu/usr.bin/gcc/f/zzz.c b/gnu/usr.bin/gcc/f/zzz.c index 29bc188c4f8..55ea8226c3f 100644 --- a/gnu/usr.bin/gcc/f/zzz.c +++ b/gnu/usr.bin/gcc/f/zzz.c @@ -51,6 +51,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif /* !defined (__TIME__) */ #endif /* !defined (FFEZZZ_TIME) */ -char *ffezzz_version_string = "0.5.20"; +char *ffezzz_version_string = "0.5.19.1"; char *ffezzz_date = FFEZZZ_DATE; char *ffezzz_time = FFEZZZ_TIME; diff --git a/gnu/usr.bin/gcc/flags.h b/gnu/usr.bin/gcc/flags.h index a3845fa0acf..4f35ee2c1da 100644 --- a/gnu/usr.bin/gcc/flags.h +++ b/gnu/usr.bin/gcc/flags.h @@ -352,19 +352,6 @@ extern int flag_gnu_linker; /* Tag all structures with __attribute__(packed) */ extern int flag_pack_struct; - -/* 1 if alias checking is enabled: symbols do not alias each other - and parameters do not alias the current stack frame. */ -extern int flag_alias_check; - -/* This flag is only tested if alias checking is enabled. - 0 if pointer arguments may alias each other. True in C. - 1 if pointer arguments may not alias each other but may alias - global variables. - 2 if pointer arguments may not alias each other and may not - alias global variables. True in Fortran. - The value is ignored if flag_alias_check is 0. */ -extern int flag_argument_noalias; /* Other basic status info about current function. */ diff --git a/gnu/usr.bin/gcc/fold-const.c b/gnu/usr.bin/gcc/fold-const.c index e256259b76b..cf57a37d606 100644 --- a/gnu/usr.bin/gcc/fold-const.c +++ b/gnu/usr.bin/gcc/fold-const.c @@ -79,7 +79,6 @@ static tree range_test PROTO((enum tree_code, tree, enum tree_code, static tree unextend PROTO((tree, int, int, tree)); static tree fold_truthop PROTO((enum tree_code, tree, tree, tree)); static tree strip_compound_expr PROTO((tree, tree)); -static int multiple_of_p PROTO((tree, tree, tree)); #ifndef BRANCH_COST #define BRANCH_COST 1 @@ -3065,106 +3064,6 @@ strip_compound_expr (t, s) return t; } -/* Determine if first argument is a multiple of second argument. - Return 0 if it is not, or is not easily determined to so be. - - An example of the sort of thing we care about (at this point -- - this routine could surely be made more general, and expanded - to do what the *_DIV_EXPR's fold() cases do now) is discovering - that - - SAVE_EXPR (I) * SAVE_EXPR (J * 8) - - is a multiple of - - SAVE_EXPR (J * 8) - - when we know that the two `SAVE_EXPR (J * 8)' nodes are the - same node (which means they will have the same value at run - time, even though we don't know when they'll be assigned). - - This code also handles discovering that - - SAVE_EXPR (I) * SAVE_EXPR (J * 8) - - is a multiple of - - 8 - - (of course) so we don't have to worry about dealing with a - possible remainder. - - Note that we _look_ inside a SAVE_EXPR only to determine - how it was calculated; it is not safe for fold() to do much - of anything else with the internals of a SAVE_EXPR, since - fold() cannot know when it will be evaluated at run time. - For example, the latter example above _cannot_ be implemented - as - - SAVE_EXPR (I) * J - - or any variant thereof, since the value of J at evaluation time - of the original SAVE_EXPR is not necessarily the same at the time - the new expression is evaluated. The only optimization of this - sort that would be valid is changing - - SAVE_EXPR (I) * SAVE_EXPR (SAVE_EXPR (J) * 8) - divided by - 8 - - to - - SAVE_EXPR (I) * SAVE_EXPR (J) - - (where the same SAVE_EXPR (J) is used in the original and the - transformed version). */ - -static int -multiple_of_p (type, top, bottom) - tree type; - tree top; - tree bottom; -{ - if (operand_equal_p (top, bottom, 0)) - return 1; - - if (TREE_CODE (type) != INTEGER_TYPE) - return 0; - - switch (TREE_CODE (top)) - { - case MULT_EXPR: - return (multiple_of_p (type, TREE_OPERAND (top, 0), bottom) - || multiple_of_p (type, TREE_OPERAND (top, 1), bottom)); - - case PLUS_EXPR: - case MINUS_EXPR: - return (multiple_of_p (type, TREE_OPERAND (top, 0), bottom) - && multiple_of_p (type, TREE_OPERAND (top, 1), bottom)); - - case NOP_EXPR: - /* Punt if conversion from non-integral or wider integral type. */ - if ((TREE_CODE (TREE_TYPE (TREE_OPERAND (top, 0))) != INTEGER_TYPE) - || (TYPE_PRECISION (type) - < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (top, 0))))) - return 0; - /* Fall through. */ - case SAVE_EXPR: - return multiple_of_p (type, TREE_OPERAND (top, 0), bottom); - - case INTEGER_CST: - if ((TREE_CODE (bottom) != INTEGER_CST) - || (tree_int_cst_sgn (top) < 0) - || (tree_int_cst_sgn (bottom) < 0)) - return 0; - return integer_zerop (const_binop (TRUNC_MOD_EXPR, - top, bottom, 0)); - - default: - return 0; - } -} - /* Perform constant folding and related simplification of EXPR. The related simplifications include x*1 => x, x*0 => 0, etc., and application of the associative law. @@ -4110,13 +4009,6 @@ fold (expr) case ROUND_DIV_EXPR: case FLOOR_DIV_EXPR: case CEIL_DIV_EXPR: - if (integer_onep (arg1)) - return non_lvalue (convert (type, arg0)); - /* If arg0 is a multiple of arg1, then rewrite to the fastest div - operation, EXACT_DIV_EXPR. Otherwise, handle folding of - general divide. */ - if (multiple_of_p (type, arg0, arg1)) - return fold (build (EXACT_DIV_EXPR, type, arg0, arg1)); case EXACT_DIV_EXPR: if (integer_onep (arg1)) return non_lvalue (convert (type, arg0)); diff --git a/gnu/usr.bin/gcc/gcc.texi b/gnu/usr.bin/gcc/gcc.texi index 7f80c69c31b..bfcf1997090 100644 --- a/gnu/usr.bin/gcc/gcc.texi +++ b/gnu/usr.bin/gcc/gcc.texi @@ -148,7 +148,7 @@ original English. @center Richard M. Stallman @sp 3 @center Last updated 29 June 1996 -@center (Revised for GNU Fortran 1997-01-10) +@center (Revised for GNU Fortran 1996-03-06) @sp 1 @c The version number appears twice more in this file. diff --git a/gnu/usr.bin/gcc/glimits.h b/gnu/usr.bin/gcc/glimits.h index 685772c8cad..ff25a97ace3 100644 --- a/gnu/usr.bin/gcc/glimits.h +++ b/gnu/usr.bin/gcc/glimits.h @@ -63,11 +63,7 @@ /* Minimum and maximum values a `signed long int' can hold. (Same as `int'). */ #ifndef __LONG_MAX__ -# ifndef __alpha__ -# define __LONG_MAX__ 2147483647L -# else -# define __LONG_MAX__ 9223372036854775807LL -# endif /* __alpha__ */ +#define __LONG_MAX__ 2147483647L #endif #undef LONG_MIN #define LONG_MIN (-LONG_MAX-1) diff --git a/gnu/usr.bin/gcc/invoke.texi b/gnu/usr.bin/gcc/invoke.texi index b8dc858b99d..bf2ee7956cc 100644 --- a/gnu/usr.bin/gcc/invoke.texi +++ b/gnu/usr.bin/gcc/invoke.texi @@ -1,4 +1,4 @@ -@c Copyright (C) 1988, 89, 92-95, 1997 Free Software Foundation, Inc. +@c Copyright (C) 1988, 89, 92, 93, 94, 1995 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -331,8 +331,6 @@ in addition to the above: -freg-struct-return -fshared-data -fshort-enums -fshort-double -fvolatile -fvolatile-global -fverbose-asm -fpack-struct +e0 +e1 --fargument-alias -fargument-noalias --fargument-noalias-global @end smallexample @end table @@ -1959,10 +1957,6 @@ optimizations triggered by this option, and the options as well, were contributed by Toon Moene (@code{toon@@moene.indiv.nluug.nl}). -These three options are intended to be removed someday, once -they have helped determine the efficacy of various -approaches to improving the performance of Fortran code. - Please let us (@code{fortran@@gnu.ai.mit.edu}) know how use of these options affects the performance of your production code. @@ -4276,78 +4270,6 @@ compilation). With @samp{+e1}, G++ actually generates the code implementing virtual functions defined in the code, and makes them publicly visible. - -@cindex aliasing of parameters -@cindex parameters, aliased -@item -fargument-alias -@item -fargument-noalias -@item -fargument-noalias-global -Specify the possible relationships among parameters and between -parameters and global data. - -@samp{-fargument-alias} specifies that arguments (parameters) may -alias each other and may alias global storage. -@samp{-fargument-noalias} specifies that arguments do not alias -each other, but may alias global storage. -@samp{-fargument-noalias-global} specifies that arguments do not -alias each other and do not alias global storage. - -For code written in C, C++, and Objective-C, @samp{-fargument-alias} -is the default. -For code written in Fortran, @samp{-fargument-noalias-global} is -the default, though this is pertinent only on systems where -@code{g77} is installed. -(See the documentation for other compilers for information on the -defaults for their respective languages.) - -Normally, @code{gcc} assumes that a write through a pointer -passed as a parameter to the current function might modify a -value pointed to by another pointer passed as a parameter, or -in global storage. - -For example, consider this code: - -@example -void x(int *i, int *j) -@{ - extern int k; - - ++*i; - ++*j; - ++k; -@} -@end example - -When compiling the above function, @code{gcc} assumes that @samp{i} might -be a pointer to the same variable as @samp{j}, and that either @samp{i}, -@samp{j}, or both might be a pointer to @samp{k}. - -Therefore, @code{gcc} does not assume it can generate code to read -@samp{*i}, @samp{*j}, and @samp{k} into separate registers, increment -each register, then write the incremented values back out. - -Instead, @code{gcc} must generate code that reads @samp{*i}, -increments it, and writes it back before reading @samp{*j}, -in case @samp{i} and @samp{j} are aliased, and, similarly, -that writes @samp{*j} before reading @samp{k}. -The result is code that, on many systems, takes longer to execute, -due to the way many processors schedule instruction execution. - -Compiling the above code with the @samp{-fargument-noalias} option -allows @code{gcc} to assume that @samp{i} and @samp{j} do not alias -each other, but either might alias @samp{k}. - -Compiling the above code with the @samp{-fargument-noalias-global} -option allows @code{gcc} to assume that no combination of @samp{i}, -@samp{j}, and @samp{k} are aliases for each other. - -@emph{Note:} Use the @samp{-fargument-noalias} and -@samp{-fargument-noalias-global} options with care. -While they can result in faster executables, they can -also result in executables with subtle bugs, bugs that -show up only when compiled for specific target systems, -or bugs that show up only when compiled by specific versions -of @code{g77}. @end table @node Environment Variables diff --git a/gnu/usr.bin/gcc/local-alloc.c b/gnu/usr.bin/gcc/local-alloc.c index 800861d7ff2..647b2d53304 100644 --- a/gnu/usr.bin/gcc/local-alloc.c +++ b/gnu/usr.bin/gcc/local-alloc.c @@ -544,7 +544,7 @@ validate_equiv_mem_from_store (dest, set) if ((GET_CODE (dest) == REG && reg_overlap_mentioned_p (dest, equiv_mem)) || (GET_CODE (dest) == MEM - && true_dependence (dest, VOIDmode, equiv_mem, rtx_varies_p))) + && true_dependence (dest, equiv_mem))) equiv_mem_modified = 1; } @@ -629,7 +629,7 @@ memref_referenced_p (memref, x) return 0; case MEM: - if (true_dependence (memref, VOIDmode, x, rtx_varies_p)) + if (true_dependence (memref, x)) return 1; break; diff --git a/gnu/usr.bin/gcc/loop.c b/gnu/usr.bin/gcc/loop.c index 5fb24ca016d..3e780203977 100644 --- a/gnu/usr.bin/gcc/loop.c +++ b/gnu/usr.bin/gcc/loop.c @@ -110,7 +110,8 @@ int *loop_number_exit_count; unsigned HOST_WIDE_INT loop_n_iterations; -/* Nonzero if there is a subroutine call in the current loop. */ +/* Nonzero if there is a subroutine call in the current loop. + (unknown_address_altered is also nonzero in this case.) */ static int loop_has_call; @@ -158,7 +159,7 @@ static char *moved_once; /* Array of MEMs that are stored in this loop. If there are too many to fit here, we just turn on unknown_address_altered. */ -#define NUM_STORES 50 +#define NUM_STORES 20 static rtx loop_store_mems[NUM_STORES]; /* Index of first available slot in above array. */ @@ -2198,8 +2199,7 @@ prescan_loop (start, end) } else if (GET_CODE (insn) == CALL_INSN) { - if (! CONST_CALL_P (insn)) - unknown_address_altered = 1; + unknown_address_altered = 1; loop_has_call = 1; } else @@ -2777,7 +2777,7 @@ invariant_p (x) /* See if there is any dependence between a store and this load. */ for (i = loop_store_mems_idx - 1; i >= 0; i--) - if (true_dependence (loop_store_mems[i], VOIDmode, x, rtx_varies_p)) + if (true_dependence (loop_store_mems[i], x)) return 0; /* It's not invalidated by a store in memory @@ -4375,8 +4375,6 @@ record_giv (v, insn, src_reg, dest_reg, mult_val, add_val, benefit, v->new_reg = 0; v->final_value = 0; v->same_insn = 0; - v->unrolled = 0; - v->shared = 0; /* The v->always_computable field is used in update_giv_derive, to determine whether a giv can be used to derive another giv. For a @@ -4654,11 +4652,8 @@ check_final_value (v, loop_start, loop_end) if (GET_CODE (p) == JUMP_INSN && JUMP_LABEL (p) && LABEL_NAME (JUMP_LABEL (p)) - && ((INSN_UID (JUMP_LABEL (p)) >= max_uid_for_loop) - || (INSN_UID (v->insn) >= max_uid_for_loop) - || (INSN_UID (last_giv_use) >= max_uid_for_loop) - || (INSN_LUID (JUMP_LABEL (p)) < INSN_LUID (v->insn) - && INSN_LUID (JUMP_LABEL (p)) > INSN_LUID (loop_start)) + && ((INSN_LUID (JUMP_LABEL (p)) < INSN_LUID (v->insn) + && INSN_LUID (JUMP_LABEL (p)) > INSN_LUID (loop_start)) || (INSN_LUID (JUMP_LABEL (p)) > INSN_LUID (last_giv_use) && INSN_LUID (JUMP_LABEL (p)) < INSN_LUID (loop_end)))) { @@ -5565,8 +5560,6 @@ emit_iv_add_mult (b, m, a, reg, insert_before) end_sequence (); emit_insn_before (seq, insert_before); - - record_base_value (REGNO (reg), b); } /* Test whether A * B can be computed without diff --git a/gnu/usr.bin/gcc/loop.h b/gnu/usr.bin/gcc/loop.h index e83063a5ad2..4c9c483e411 100644 --- a/gnu/usr.bin/gcc/loop.h +++ b/gnu/usr.bin/gcc/loop.h @@ -88,9 +88,6 @@ struct induction unsigned maybe_dead : 1; /* 1 if this giv might be dead. In that case, we won't use it to eliminate a biv, it would probably lose. */ - unsigned unrolled : 1; /* 1 if new register has been allocated in - unrolled loop. */ - unsigned shared : 1; int lifetime; /* Length of life of this giv */ int times_used; /* # times this giv is used. */ rtx derive_adjustment; /* If nonzero, is an adjustment to be diff --git a/gnu/usr.bin/gcc/real.c b/gnu/usr.bin/gcc/real.c index 121a51d2609..082cfd03af1 100644 --- a/gnu/usr.bin/gcc/real.c +++ b/gnu/usr.bin/gcc/real.c @@ -5624,75 +5624,9 @@ make_nan (nan, sign, mode) *nan = (sign << 15) | *p; } -/* This is the inverse of the function `etarsingle' invoked by - REAL_VALUE_TO_TARGET_SINGLE. */ - -REAL_VALUE_TYPE -ereal_unto_float (f) - long f; -{ - REAL_VALUE_TYPE r; - unsigned EMUSHORT s[2]; - unsigned EMUSHORT e[NE]; - - /* Convert 32 bit integer to array of 16 bit pieces in target machine order. - This is the inverse operation to what the function `endian' does. */ - if (REAL_WORDS_BIG_ENDIAN) - { - s[0] = (unsigned EMUSHORT) (f >> 16); - s[1] = (unsigned EMUSHORT) f; - } - else - { - s[0] = (unsigned EMUSHORT) f; - s[1] = (unsigned EMUSHORT) (f >> 16); - } - /* Convert and promote the target float to E-type. */ - e24toe (s, e); - /* Output E-type to REAL_VALUE_TYPE. */ - PUT_REAL (e, &r); - return r; -} - - -/* This is the inverse of the function `etardouble' invoked by - REAL_VALUE_TO_TARGET_DOUBLE. */ - -REAL_VALUE_TYPE -ereal_unto_double (d) - long d[]; -{ - REAL_VALUE_TYPE r; - unsigned EMUSHORT s[4]; - unsigned EMUSHORT e[NE]; - - /* Convert array of HOST_WIDE_INT to equivalent array of 16-bit pieces. */ - if (REAL_WORDS_BIG_ENDIAN) - { - s[0] = (unsigned EMUSHORT) (d[0] >> 16); - s[1] = (unsigned EMUSHORT) d[0]; - s[2] = (unsigned EMUSHORT) (d[1] >> 16); - s[3] = (unsigned EMUSHORT) d[1]; - } - else - { - /* Target float words are little-endian. */ - s[0] = (unsigned EMUSHORT) d[0]; - s[1] = (unsigned EMUSHORT) (d[0] >> 16); - s[2] = (unsigned EMUSHORT) d[1]; - s[3] = (unsigned EMUSHORT) (d[1] >> 16); - } - /* Convert target double to E-type. */ - e53toe (s, e); - /* Output E-type to REAL_VALUE_TYPE. */ - PUT_REAL (e, &r); - return r; -} - - /* Convert an SFmode target `float' value to a REAL_VALUE_TYPE. - This is somewhat like ereal_unto_float, but the input types - for these are different. */ + This is the inverse of the function `etarsingle' invoked by + REAL_VALUE_TO_TARGET_SINGLE. */ REAL_VALUE_TYPE ereal_from_float (f) @@ -5723,8 +5657,8 @@ ereal_from_float (f) /* Convert a DFmode target `double' value to a REAL_VALUE_TYPE. - This is somewhat like ereal_unto_double, but the input types - for these are different. + This is the inverse of the function `etardouble' invoked by + REAL_VALUE_TO_TARGET_DOUBLE. The DFmode is stored as an array of HOST_WIDE_INT in the target's data format, with no holes in the bit packing. The first element diff --git a/gnu/usr.bin/gcc/real.h b/gnu/usr.bin/gcc/real.h index 716c835ddb0..799e158c95f 100644 --- a/gnu/usr.bin/gcc/real.h +++ b/gnu/usr.bin/gcc/real.h @@ -151,8 +151,6 @@ extern long etarsingle PROTO((REAL_VALUE_TYPE)); extern void ereal_to_decimal PROTO((REAL_VALUE_TYPE, char *)); extern int ereal_cmp PROTO((REAL_VALUE_TYPE, REAL_VALUE_TYPE)); extern int ereal_isneg PROTO((REAL_VALUE_TYPE)); -extern REAL_VALUE_TYPE ereal_unto_float PROTO((long)); -extern REAL_VALUE_TYPE ereal_unto_double PROTO((long *)); extern REAL_VALUE_TYPE ereal_from_float PROTO((HOST_WIDE_INT)); extern REAL_VALUE_TYPE ereal_from_double PROTO((HOST_WIDE_INT *)); @@ -199,12 +197,6 @@ extern REAL_VALUE_TYPE real_value_truncate (); /* IN is a REAL_VALUE_TYPE. OUT is a long. */ #define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) ((OUT) = etarsingle ((IN))) -/* Inverse of REAL_VALUE_TO_TARGET_DOUBLE. */ -#define REAL_VALUE_UNTO_TARGET_DOUBLE(d) (ereal_unto_double (d)) - -/* Inverse of REAL_VALUE_TO_TARGET_SINGLE. */ -#define REAL_VALUE_UNTO_TARGET_SINGLE(f) (ereal_unto_float (f)) - /* d is an array of HOST_WIDE_INT that holds a double precision value in the target computer's floating point format. */ #define REAL_VALUE_FROM_TARGET_DOUBLE(d) (ereal_from_double (d)) diff --git a/gnu/usr.bin/gcc/reload.c b/gnu/usr.bin/gcc/reload.c index 04bbe4af661..d797e74df89 100644 --- a/gnu/usr.bin/gcc/reload.c +++ b/gnu/usr.bin/gcc/reload.c @@ -1,5 +1,5 @@ /* Search an insn for pseudo regs that must be in hard regs and are not. - Copyright (C) 1987, 88, 89, 92-5, 1996 Free Software Foundation, Inc. + Copyright (C) 1987, 88, 89, 92, 93, 94, 1995 Free Software Foundation, Inc. This file is part of GNU CC. @@ -291,7 +291,6 @@ static int output_reloadnum; static int push_secondary_reload PROTO((int, rtx, int, int, enum reg_class, enum machine_mode, enum reload_type, enum insn_code *)); -static enum reg_class find_valid_class PROTO((enum machine_mode, int)); static int push_reload PROTO((rtx, rtx, rtx *, rtx *, enum reg_class, enum machine_mode, enum machine_mode, int, int, int, enum reload_type)); @@ -361,9 +360,6 @@ push_secondary_reload (in_p, x, opnum, optional, reload_class, reload_mode, /* If X is a paradoxical SUBREG, use the inner value to determine both the mode and object being reloaded. */ if (GET_CODE (x) == SUBREG -#ifdef CLASS_CANNOT_CHANGE_SIZE - && reload_class != CLASS_CANNOT_CHANGE_SIZE -#endif && (GET_MODE_SIZE (GET_MODE (x)) > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))) { @@ -692,38 +688,6 @@ clear_secondary_mem () } #endif /* SECONDARY_MEMORY_NEEDED */ -/* Find the largest class for which every register number plus N is valid in - M1 (if in range). Abort if no such class exists. */ - -static enum reg_class -find_valid_class (m1, n) - enum machine_mode m1; - int n; -{ - int class; - int regno; - enum reg_class best_class; - int best_size = 0; - - for (class = 1; class < N_REG_CLASSES; class++) - { - int bad = 0; - for (regno = 0; regno < FIRST_PSEUDO_REGISTER && ! bad; regno++) - if (TEST_HARD_REG_BIT (reg_class_contents[class], regno) - && TEST_HARD_REG_BIT (reg_class_contents[class], regno + n) - && ! HARD_REGNO_MODE_OK (regno + n, m1)) - bad = 1; - - if (! bad && reg_class_size[class] > best_size) - best_class = class, best_size = reg_class_size[class]; - } - - if (best_size == 0) - abort (); - - return best_class; -} - /* Record one reload that needs to be performed. IN is an rtx saying where the data are to be found before this instruction. OUT says where they must be stored after the instruction. @@ -929,8 +893,7 @@ push_reload (in, out, inloc, outloc, class, if (in != 0 && GET_CODE (in) == SUBREG && GET_CODE (SUBREG_REG (in)) == REG && REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER - && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (in)) + SUBREG_WORD (in), - inmode) + && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (in)), inmode) || (GET_MODE_SIZE (inmode) <= UNITS_PER_WORD && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (in))) > UNITS_PER_WORD) @@ -945,8 +908,7 @@ push_reload (in, out, inloc, outloc, class, RELOAD_OTHER, we are guaranteed that this inner reload will be output before the outer reload. */ push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), NULL_PTR, - find_valid_class (inmode, SUBREG_WORD (in)), - VOIDmode, VOIDmode, 0, 0, opnum, type); + GENERAL_REGS, VOIDmode, VOIDmode, 0, 0, opnum, type); dont_remove_subreg = 1; } @@ -1019,8 +981,7 @@ push_reload (in, out, inloc, outloc, class, if (out != 0 && GET_CODE (out) == SUBREG && GET_CODE (SUBREG_REG (out)) == REG && REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER - && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (out)) + SUBREG_WORD (out), - outmode) + && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (out)), outmode) || (GET_MODE_SIZE (outmode) <= UNITS_PER_WORD && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (out))) > UNITS_PER_WORD) @@ -1036,9 +997,7 @@ push_reload (in, out, inloc, outloc, class, output after the outer reload. */ dont_remove_subreg = 1; push_reload (SUBREG_REG (out), SUBREG_REG (out), &SUBREG_REG (out), - &SUBREG_REG (out), - find_valid_class (outmode, SUBREG_WORD (out)), - VOIDmode, VOIDmode, 0, 0, + &SUBREG_REG (out), ALL_REGS, VOIDmode, VOIDmode, 0, 0, opnum, RELOAD_OTHER); } @@ -5558,7 +5517,7 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) /* Reject VALUE if it was loaded from GOAL and is also a register that appears in the address of GOAL. */ - if (goal_mem && value == SET_DEST (single_set (where)) + if (goal_mem && value == SET_DEST (PATTERN (where)) && refers_to_regno_for_reload_p (valueno, (valueno + HARD_REGNO_NREGS (valueno, mode)), @@ -5940,7 +5899,7 @@ debug_reload() fprintf (stderr, ", inc by %d\n", reload_inc[r]); if (reload_nocombine[r]) - fprintf (stderr, ", can't combine %d", reload_nocombine[r]); + fprintf (stderr, ", can combine", reload_nocombine[r]); if (reload_secondary_p[r]) fprintf (stderr, ", secondary_reload_p"); diff --git a/gnu/usr.bin/gcc/rtl.h b/gnu/usr.bin/gcc/rtl.h index 079664cfb9a..b757aec2750 100644 --- a/gnu/usr.bin/gcc/rtl.h +++ b/gnu/usr.bin/gcc/rtl.h @@ -348,7 +348,7 @@ enum reg_note { REG_DEAD = 1, REG_INC = 2, REG_EQUIV = 3, REG_WAS_0 = 4, REG_EQUAL = 5, REG_RETVAL = 6, REG_LIBCALL = 7, REG_NONNEG = 8, REG_NO_CONFLICT = 9, REG_UNUSED = 10, REG_CC_SETTER = 11, REG_CC_USER = 12, REG_LABEL = 13, - REG_DEP_ANTI = 14, REG_DEP_OUTPUT = 15, REG_NOALIAS = 16 }; + REG_DEP_ANTI = 14, REG_DEP_OUTPUT = 15 }; /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */ #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK)) @@ -431,6 +431,7 @@ extern char *reg_note_name[]; their homes, etc. */ #define NOTE_INSN_FUNCTION_BEG -13 + #if 0 /* These are not used, and I don't know what they were for. --rms. */ #define NOTE_DECL_NAME(INSN) ((INSN)->fld[3].rtstr) #define NOTE_DECL_CODE(INSN) ((INSN)->fld[4].rtint) @@ -574,7 +575,6 @@ extern char *note_insn_name[]; /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */ #define TRAP_CONDITION(RTX) ((RTX)->fld[0].rtx) -#define TRAP_CODE(RTX) ((RTX)->fld[1].rtint) /* 1 in a SYMBOL_REF if it addresses this function's constants pool. */ #define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging) @@ -816,16 +816,6 @@ extern rtx gen_ble PROTO((rtx)); extern rtx eliminate_constant_term PROTO((rtx, rtx *)); extern rtx expand_complex_abs PROTO((enum machine_mode, rtx, rtx, int)); extern enum machine_mode choose_hard_reg_mode PROTO((int, int)); -extern int rtx_varies_p PROTO((rtx)); -extern int may_trap_p PROTO((rtx)); -extern int side_effects_p PROTO((rtx)); -extern int volatile_refs_p PROTO((rtx)); -extern int volatile_insn_p PROTO((rtx)); -extern void remove_note PROTO((rtx, rtx)); -extern void note_stores PROTO((rtx, void (*)())); -extern int refers_to_regno_p PROTO((int, int, rtx, rtx *)); -extern int reg_overlap_mentioned_p PROTO((rtx, rtx)); - /* Maximum number of parallel sets and clobbers in any insn in this fn. Always at least 3, since the combiner could put that many togetherm @@ -976,10 +966,3 @@ extern rtx *regno_reg_rtx; know what `enum tree_code' means. */ extern int rtx_to_tree_code PROTO((enum rtx_code)); - -extern int true_dependence PROTO((rtx, enum machine_mode, rtx, int (*)())); -extern int read_dependence PROTO((rtx, rtx)); -extern int anti_dependence PROTO((rtx, rtx)); -extern int output_dependence PROTO((rtx, rtx)); -extern void init_alias_analysis PROTO((void)); -extern void end_alias_analysis PROTO((void)); diff --git a/gnu/usr.bin/gcc/sched.c b/gnu/usr.bin/gcc/sched.c index 8533de1e035..81d77bfd1bd 100644 --- a/gnu/usr.bin/gcc/sched.c +++ b/gnu/usr.bin/gcc/sched.c @@ -125,9 +125,6 @@ Boston, MA 02111-1307, USA. */ #include "insn-config.h" #include "insn-attr.h" -extern char *reg_known_equiv_p; -extern rtx *reg_known_value; - #ifdef INSN_SCHEDULING /* Arrays set up by scheduling for the same respective purposes as similar-named arrays set up by flow analysis. We work with these @@ -145,7 +142,6 @@ static int *sched_reg_live_length; such insn. Needed for new registers which may be introduced by splitting insns. */ static rtx *reg_last_uses; -static int reg_last_uses_size; static rtx *reg_last_sets; static regset reg_pending_sets; static int reg_pending_sets_all; @@ -297,6 +293,11 @@ struct sometimes }; /* Forward declarations. */ +static rtx canon_rtx PROTO((rtx)); +static int rtx_equal_for_memref_p PROTO((rtx, rtx)); +static rtx find_symbolic_term PROTO((rtx)); +static int memrefs_conflict_p PROTO((int, rtx, int, rtx, + HOST_WIDE_INT)); static void add_dependence PROTO((rtx, rtx, enum reg_note)); static void remove_dependence PROTO((rtx, rtx)); static rtx find_insn_list PROTO((rtx, rtx)); @@ -344,6 +345,542 @@ void schedule_insns PROTO((FILE *)); #endif /* INSN_SCHEDULING */ +#define SIZE_FOR_MODE(X) (GET_MODE_SIZE (GET_MODE (X))) + +/* Vector indexed by N giving the initial (unchanging) value known + for pseudo-register N. */ +static rtx *reg_known_value; + +/* Vector recording for each reg_known_value whether it is due to a + REG_EQUIV note. Future passes (viz., reload) may replace the + pseudo with the equivalent expression and so we account for the + dependences that would be introduced if that happens. */ +/* ??? This is a problem only on the Convex. The REG_EQUIV notes created in + assign_parms mention the arg pointer, and there are explicit insns in the + RTL that modify the arg pointer. Thus we must ensure that such insns don't + get scheduled across each other because that would invalidate the REG_EQUIV + notes. One could argue that the REG_EQUIV notes are wrong, but solving + the problem in the scheduler will likely give better code, so we do it + here. */ +static char *reg_known_equiv_p; + +/* Indicates number of valid entries in reg_known_value. */ +static int reg_known_value_size; + +static rtx +canon_rtx (x) + rtx x; +{ + if (GET_CODE (x) == REG && REGNO (x) >= FIRST_PSEUDO_REGISTER + && REGNO (x) <= reg_known_value_size) + return reg_known_value[REGNO (x)]; + else if (GET_CODE (x) == PLUS) + { + rtx x0 = canon_rtx (XEXP (x, 0)); + rtx x1 = canon_rtx (XEXP (x, 1)); + + if (x0 != XEXP (x, 0) || x1 != XEXP (x, 1)) + { + /* We can tolerate LO_SUMs being offset here; these + rtl are used for nothing other than comparisons. */ + if (GET_CODE (x0) == CONST_INT) + return plus_constant_for_output (x1, INTVAL (x0)); + else if (GET_CODE (x1) == CONST_INT) + return plus_constant_for_output (x0, INTVAL (x1)); + return gen_rtx (PLUS, GET_MODE (x), x0, x1); + } + } + return x; +} + +/* Set up all info needed to perform alias analysis on memory references. */ + +void +init_alias_analysis () +{ + int maxreg = max_reg_num (); + rtx insn; + rtx note; + rtx set; + + reg_known_value_size = maxreg; + + reg_known_value + = (rtx *) oballoc ((maxreg-FIRST_PSEUDO_REGISTER) * sizeof (rtx)) + - FIRST_PSEUDO_REGISTER; + bzero ((char *) (reg_known_value + FIRST_PSEUDO_REGISTER), + (maxreg-FIRST_PSEUDO_REGISTER) * sizeof (rtx)); + + reg_known_equiv_p + = (char *) oballoc ((maxreg -FIRST_PSEUDO_REGISTER) * sizeof (char)) + - FIRST_PSEUDO_REGISTER; + bzero (reg_known_equiv_p + FIRST_PSEUDO_REGISTER, + (maxreg - FIRST_PSEUDO_REGISTER) * sizeof (char)); + + /* Fill in the entries with known constant values. */ + for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) + if ((set = single_set (insn)) != 0 + && GET_CODE (SET_DEST (set)) == REG + && REGNO (SET_DEST (set)) >= FIRST_PSEUDO_REGISTER + && (((note = find_reg_note (insn, REG_EQUAL, 0)) != 0 + && reg_n_sets[REGNO (SET_DEST (set))] == 1) + || (note = find_reg_note (insn, REG_EQUIV, NULL_RTX)) != 0) + && GET_CODE (XEXP (note, 0)) != EXPR_LIST) + { + int regno = REGNO (SET_DEST (set)); + reg_known_value[regno] = XEXP (note, 0); + reg_known_equiv_p[regno] = REG_NOTE_KIND (note) == REG_EQUIV; + } + + /* Fill in the remaining entries. */ + while (--maxreg >= FIRST_PSEUDO_REGISTER) + if (reg_known_value[maxreg] == 0) + reg_known_value[maxreg] = regno_reg_rtx[maxreg]; +} + +/* Return 1 if X and Y are identical-looking rtx's. + + We use the data in reg_known_value above to see if two registers with + different numbers are, in fact, equivalent. */ + +static int +rtx_equal_for_memref_p (x, y) + rtx x, y; +{ + register int i; + register int j; + register enum rtx_code code; + register char *fmt; + + if (x == 0 && y == 0) + return 1; + if (x == 0 || y == 0) + return 0; + x = canon_rtx (x); + y = canon_rtx (y); + + if (x == y) + return 1; + + code = GET_CODE (x); + /* Rtx's of different codes cannot be equal. */ + if (code != GET_CODE (y)) + return 0; + + /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent. + (REG:SI x) and (REG:HI x) are NOT equivalent. */ + + if (GET_MODE (x) != GET_MODE (y)) + return 0; + + /* REG, LABEL_REF, and SYMBOL_REF can be compared nonrecursively. */ + + if (code == REG) + return REGNO (x) == REGNO (y); + if (code == LABEL_REF) + return XEXP (x, 0) == XEXP (y, 0); + if (code == SYMBOL_REF) + return XSTR (x, 0) == XSTR (y, 0); + + /* For commutative operations, the RTX match if the operand match in any + order. Also handle the simple binary and unary cases without a loop. */ + if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c') + return ((rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)) + && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1))) + || (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 1)) + && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 0)))); + else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == '2') + return (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)) + && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1))); + else if (GET_RTX_CLASS (code) == '1') + return rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)); + + /* Compare the elements. If any pair of corresponding elements + fail to match, return 0 for the whole things. */ + + fmt = GET_RTX_FORMAT (code); + for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + { + switch (fmt[i]) + { + case 'w': + if (XWINT (x, i) != XWINT (y, i)) + return 0; + break; + + case 'n': + case 'i': + if (XINT (x, i) != XINT (y, i)) + return 0; + break; + + case 'V': + case 'E': + /* Two vectors must have the same length. */ + if (XVECLEN (x, i) != XVECLEN (y, i)) + return 0; + + /* And the corresponding elements must match. */ + for (j = 0; j < XVECLEN (x, i); j++) + if (rtx_equal_for_memref_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0) + return 0; + break; + + case 'e': + if (rtx_equal_for_memref_p (XEXP (x, i), XEXP (y, i)) == 0) + return 0; + break; + + case 'S': + case 's': + if (strcmp (XSTR (x, i), XSTR (y, i))) + return 0; + break; + + case 'u': + /* These are just backpointers, so they don't matter. */ + break; + + case '0': + break; + + /* It is believed that rtx's at this level will never + contain anything but integers and other rtx's, + except for within LABEL_REFs and SYMBOL_REFs. */ + default: + abort (); + } + } + return 1; +} + +/* Given an rtx X, find a SYMBOL_REF or LABEL_REF within + X and return it, or return 0 if none found. */ + +static rtx +find_symbolic_term (x) + rtx x; +{ + register int i; + register enum rtx_code code; + register char *fmt; + + code = GET_CODE (x); + if (code == SYMBOL_REF || code == LABEL_REF) + return x; + if (GET_RTX_CLASS (code) == 'o') + return 0; + + fmt = GET_RTX_FORMAT (code); + for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + { + rtx t; + + if (fmt[i] == 'e') + { + t = find_symbolic_term (XEXP (x, i)); + if (t != 0) + return t; + } + else if (fmt[i] == 'E') + break; + } + return 0; +} + +/* Return nonzero if X and Y (memory addresses) could reference the + same location in memory. C is an offset accumulator. When + C is nonzero, we are testing aliases between X and Y + C. + XSIZE is the size in bytes of the X reference, + similarly YSIZE is the size in bytes for Y. + + If XSIZE or YSIZE is zero, we do not know the amount of memory being + referenced (the reference was BLKmode), so make the most pessimistic + assumptions. + + We recognize the following cases of non-conflicting memory: + + (1) addresses involving the frame pointer cannot conflict + with addresses involving static variables. + (2) static variables with different addresses cannot conflict. + + Nice to notice that varying addresses cannot conflict with fp if no + local variables had their addresses taken, but that's too hard now. */ + +/* ??? In Fortran, references to a array parameter can never conflict with + another array parameter. */ + +static int +memrefs_conflict_p (xsize, x, ysize, y, c) + rtx x, y; + int xsize, ysize; + HOST_WIDE_INT c; +{ + if (GET_CODE (x) == HIGH) + x = XEXP (x, 0); + else if (GET_CODE (x) == LO_SUM) + x = XEXP (x, 1); + else + x = canon_rtx (x); + if (GET_CODE (y) == HIGH) + y = XEXP (y, 0); + else if (GET_CODE (y) == LO_SUM) + y = XEXP (y, 1); + else + y = canon_rtx (y); + + if (rtx_equal_for_memref_p (x, y)) + return (xsize == 0 || ysize == 0 || + (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0)); + + if (y == frame_pointer_rtx || y == hard_frame_pointer_rtx + || y == stack_pointer_rtx) + { + rtx t = y; + int tsize = ysize; + y = x; ysize = xsize; + x = t; xsize = tsize; + } + + if (x == frame_pointer_rtx || x == hard_frame_pointer_rtx + || x == stack_pointer_rtx) + { + rtx y1; + + if (CONSTANT_P (y)) + return 0; + + if (GET_CODE (y) == PLUS + && canon_rtx (XEXP (y, 0)) == x + && (y1 = canon_rtx (XEXP (y, 1))) + && GET_CODE (y1) == CONST_INT) + { + c += INTVAL (y1); + return (xsize == 0 || ysize == 0 + || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0)); + } + + if (GET_CODE (y) == PLUS + && (y1 = canon_rtx (XEXP (y, 0))) + && CONSTANT_P (y1)) + return 0; + + return 1; + } + + if (GET_CODE (x) == PLUS) + { + /* The fact that X is canonicalized means that this + PLUS rtx is canonicalized. */ + rtx x0 = XEXP (x, 0); + rtx x1 = XEXP (x, 1); + + if (GET_CODE (y) == PLUS) + { + /* The fact that Y is canonicalized means that this + PLUS rtx is canonicalized. */ + rtx y0 = XEXP (y, 0); + rtx y1 = XEXP (y, 1); + + if (rtx_equal_for_memref_p (x1, y1)) + return memrefs_conflict_p (xsize, x0, ysize, y0, c); + if (rtx_equal_for_memref_p (x0, y0)) + return memrefs_conflict_p (xsize, x1, ysize, y1, c); + if (GET_CODE (x1) == CONST_INT) + if (GET_CODE (y1) == CONST_INT) + return memrefs_conflict_p (xsize, x0, ysize, y0, + c - INTVAL (x1) + INTVAL (y1)); + else + return memrefs_conflict_p (xsize, x0, ysize, y, c - INTVAL (x1)); + else if (GET_CODE (y1) == CONST_INT) + return memrefs_conflict_p (xsize, x, ysize, y0, c + INTVAL (y1)); + + /* Handle case where we cannot understand iteration operators, + but we notice that the base addresses are distinct objects. */ + x = find_symbolic_term (x); + if (x == 0) + return 1; + y = find_symbolic_term (y); + if (y == 0) + return 1; + return rtx_equal_for_memref_p (x, y); + } + else if (GET_CODE (x1) == CONST_INT) + return memrefs_conflict_p (xsize, x0, ysize, y, c - INTVAL (x1)); + } + else if (GET_CODE (y) == PLUS) + { + /* The fact that Y is canonicalized means that this + PLUS rtx is canonicalized. */ + rtx y0 = XEXP (y, 0); + rtx y1 = XEXP (y, 1); + + if (GET_CODE (y1) == CONST_INT) + return memrefs_conflict_p (xsize, x, ysize, y0, c + INTVAL (y1)); + else + return 1; + } + + if (GET_CODE (x) == GET_CODE (y)) + switch (GET_CODE (x)) + { + case MULT: + { + /* Handle cases where we expect the second operands to be the + same, and check only whether the first operand would conflict + or not. */ + rtx x0, y0; + rtx x1 = canon_rtx (XEXP (x, 1)); + rtx y1 = canon_rtx (XEXP (y, 1)); + if (! rtx_equal_for_memref_p (x1, y1)) + return 1; + x0 = canon_rtx (XEXP (x, 0)); + y0 = canon_rtx (XEXP (y, 0)); + if (rtx_equal_for_memref_p (x0, y0)) + return (xsize == 0 || ysize == 0 + || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0)); + + /* Can't properly adjust our sizes. */ + if (GET_CODE (x1) != CONST_INT) + return 1; + xsize /= INTVAL (x1); + ysize /= INTVAL (x1); + c /= INTVAL (x1); + return memrefs_conflict_p (xsize, x0, ysize, y0, c); + } + } + + if (CONSTANT_P (x)) + { + if (GET_CODE (x) == CONST_INT && GET_CODE (y) == CONST_INT) + { + c += (INTVAL (y) - INTVAL (x)); + return (xsize == 0 || ysize == 0 + || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0)); + } + + if (GET_CODE (x) == CONST) + { + if (GET_CODE (y) == CONST) + return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)), + ysize, canon_rtx (XEXP (y, 0)), c); + else + return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)), + ysize, y, c); + } + if (GET_CODE (y) == CONST) + return memrefs_conflict_p (xsize, x, ysize, + canon_rtx (XEXP (y, 0)), c); + + if (CONSTANT_P (y)) + return (rtx_equal_for_memref_p (x, y) + && (xsize == 0 || ysize == 0 + || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0))); + + return 1; + } + return 1; +} + +/* Functions to compute memory dependencies. + + Since we process the insns in execution order, we can build tables + to keep track of what registers are fixed (and not aliased), what registers + are varying in known ways, and what registers are varying in unknown + ways. + + If both memory references are volatile, then there must always be a + dependence between the two references, since their order can not be + changed. A volatile and non-volatile reference can be interchanged + though. + + A MEM_IN_STRUCT reference at a non-QImode varying address can never + conflict with a non-MEM_IN_STRUCT reference at a fixed address. We must + allow QImode aliasing because the ANSI C standard allows character + pointers to alias anything. We are assuming that characters are + always QImode here. */ + +/* Read dependence: X is read after read in MEM takes place. There can + only be a dependence here if both reads are volatile. */ + +int +read_dependence (mem, x) + rtx mem; + rtx x; +{ + return MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem); +} + +/* True dependence: X is read after store in MEM takes place. */ + +int +true_dependence (mem, x) + rtx mem; + rtx x; +{ + /* If X is an unchanging read, then it can't possibly conflict with any + non-unchanging store. It may conflict with an unchanging write though, + because there may be a single store to this address to initialize it. + Just fall through to the code below to resolve the case where we have + both an unchanging read and an unchanging write. This won't handle all + cases optimally, but the possible performance loss should be + negligible. */ + if (RTX_UNCHANGING_P (x) && ! RTX_UNCHANGING_P (mem)) + return 0; + + return ((MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem)) + || (memrefs_conflict_p (SIZE_FOR_MODE (mem), XEXP (mem, 0), + SIZE_FOR_MODE (x), XEXP (x, 0), 0) + && ! (MEM_IN_STRUCT_P (mem) && rtx_addr_varies_p (mem) + && GET_MODE (mem) != QImode + && ! MEM_IN_STRUCT_P (x) && ! rtx_addr_varies_p (x)) + && ! (MEM_IN_STRUCT_P (x) && rtx_addr_varies_p (x) + && GET_MODE (x) != QImode + && ! MEM_IN_STRUCT_P (mem) && ! rtx_addr_varies_p (mem)))); +} + +/* Anti dependence: X is written after read in MEM takes place. */ + +int +anti_dependence (mem, x) + rtx mem; + rtx x; +{ + /* If MEM is an unchanging read, then it can't possibly conflict with + the store to X, because there is at most one store to MEM, and it must + have occurred somewhere before MEM. */ + if (RTX_UNCHANGING_P (mem)) + return 0; + + return ((MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem)) + || (memrefs_conflict_p (SIZE_FOR_MODE (mem), XEXP (mem, 0), + SIZE_FOR_MODE (x), XEXP (x, 0), 0) + && ! (MEM_IN_STRUCT_P (mem) && rtx_addr_varies_p (mem) + && GET_MODE (mem) != QImode + && ! MEM_IN_STRUCT_P (x) && ! rtx_addr_varies_p (x)) + && ! (MEM_IN_STRUCT_P (x) && rtx_addr_varies_p (x) + && GET_MODE (x) != QImode + && ! MEM_IN_STRUCT_P (mem) && ! rtx_addr_varies_p (mem)))); +} + +/* Output dependence: X is written after store in MEM takes place. */ + +int +output_dependence (mem, x) + rtx mem; + rtx x; +{ + return ((MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem)) + || (memrefs_conflict_p (SIZE_FOR_MODE (mem), XEXP (mem, 0), + SIZE_FOR_MODE (x), XEXP (x, 0), 0) + && ! (MEM_IN_STRUCT_P (mem) && rtx_addr_varies_p (mem) + && GET_MODE (mem) != QImode + && ! MEM_IN_STRUCT_P (x) && ! rtx_addr_varies_p (x)) + && ! (MEM_IN_STRUCT_P (x) && rtx_addr_varies_p (x) + && GET_MODE (x) != QImode + && ! MEM_IN_STRUCT_P (mem) && ! rtx_addr_varies_p (mem)))); +} + /* Helper functions for instruction scheduling. */ /* Add ELEM wrapped in an INSN_LIST with reg note kind DEP_TYPE to the @@ -1384,8 +1921,7 @@ sched_analyze_2 (x, insn) { /* If a dependency already exists, don't create a new one. */ if (! find_insn_list (XEXP (pending, 0), LOG_LINKS (insn))) - if (true_dependence (XEXP (pending_mem, 0), VOIDmode, - x, rtx_varies_p)) + if (true_dependence (XEXP (pending_mem, 0), x)) add_dependence (insn, XEXP (pending, 0), 0); pending = XEXP (pending, 1); @@ -1484,7 +2020,7 @@ sched_analyze_insn (x, insn, loop_notes) { register RTX_CODE code = GET_CODE (x); rtx link; - int maxreg = reg_last_uses_size; + int maxreg = max_reg_num (); int i; if (code == SET || code == CLOBBER) @@ -1521,7 +2057,7 @@ sched_analyze_insn (x, insn, loop_notes) if (loop_notes) { - int max_reg = reg_last_uses_size; + int max_reg = max_reg_num (); rtx link; for (i = 0; i < max_reg; i++) @@ -1665,7 +2201,8 @@ sched_analyze (head, tail) if (NEXT_INSN (insn) && GET_CODE (NEXT_INSN (insn)) == NOTE && NOTE_LINE_NUMBER (NEXT_INSN (insn)) == NOTE_INSN_SETJMP) { - for (i = 0; i < reg_last_uses_size; i++) + int max_reg = max_reg_num (); + for (i = 0; i < max_reg; i++) { for (u = reg_last_uses[i]; u; u = XEXP (u, 1)) add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI); @@ -1834,10 +2371,11 @@ sched_note_set (b, x, death) dealing with queueing and dequeueing of instructions. */ #define SCHED_SORT(READY, NEW_READY, OLD_READY) \ - if ((NEW_READY) - (OLD_READY) == 1) \ - swap_sort (READY, NEW_READY); \ - else if ((NEW_READY) - (OLD_READY) > 1) \ - qsort (READY, NEW_READY, sizeof (rtx), rank_for_schedule); else \ + do { if ((NEW_READY) - (OLD_READY) == 1) \ + swap_sort (READY, NEW_READY); \ + else if ((NEW_READY) - (OLD_READY) > 1) \ + qsort (READY, NEW_READY, sizeof (rtx), rank_for_schedule); } \ + while (0) /* Returns a positive value if y is preferred; returns a negative value if x is preferred. Should never return 0, since that will make the sort @@ -2635,7 +3173,7 @@ schedule_block (b, file) fprintf (file, ";;\t -- basic block number %d from %d to %d --\n", b, INSN_UID (basic_block_head[b]), INSN_UID (basic_block_end[b])); - reg_last_uses_size = i = max_reg_num (); + i = max_reg_num (); reg_last_uses = (rtx *) alloca (i * sizeof (rtx)); bzero ((char *) reg_last_uses, i * sizeof (rtx)); reg_last_sets = (rtx *) alloca (i * sizeof (rtx)); @@ -4179,21 +4717,6 @@ schedule_insns (dump_file) bcopy ((char *) reg_n_deaths, (char *) sched_reg_n_deaths, max_regno * sizeof (short)); init_alias_analysis (); -#if 0 - if (dump_file) - { - extern rtx *reg_base_value; - extern int reg_base_value_size; - int i; - for (i = 0; i < reg_base_value_size; i++) - if (reg_base_value[i]) - { - fprintf (dump_file, ";; reg_base_value[%d] = ", i); - print_rtl (dump_file, reg_base_value[i]); - fputc ('\n', dump_file); - } - } -#endif } else { @@ -4202,7 +4725,8 @@ schedule_insns (dump_file) sched_reg_live_length = 0; bb_dead_regs = 0; bb_live_regs = 0; - init_alias_analysis (); + if (! flag_schedule_insns) + init_alias_analysis (); } if (write_symbols != NO_DEBUG) diff --git a/gnu/usr.bin/gcc/toplev.c b/gnu/usr.bin/gcc/toplev.c index 01b71e1bb18..4d33910170d 100644 --- a/gnu/usr.bin/gcc/toplev.c +++ b/gnu/usr.bin/gcc/toplev.c @@ -535,17 +535,6 @@ int flag_gnu_linker = 1; /* Tag all structures with __attribute__(packed) */ int flag_pack_struct = 0; -/* 1 if alias checking is on (by default, when -O). */ -int flag_alias_check = 0; - -/* 0 if pointer arguments may alias each other. True in C. - 1 if pointer arguments may not alias each other but may alias - global variables. - 2 if pointer arguments may not alias each other and may not - alias global variables. True in Fortran. - This defaults to 0 for C. */ -int flag_argument_noalias = 0; - /* Table of language-independent -f options. STRING is the option name. VARIABLE is the address of the variable. ON_VALUE is the value to store in VARIABLE @@ -595,11 +584,7 @@ struct { char *string; int *variable; int on_value;} f_options[] = {"verbose-asm", &flag_verbose_asm, 1}, {"gnu-linker", &flag_gnu_linker, 1}, {"pack-struct", &flag_pack_struct, 1}, - {"bytecode", &output_bytecode, 1}, - {"alias-check", &flag_alias_check, 1}, - {"argument-alias", &flag_argument_noalias, 0}, - {"argument-noalias", &flag_argument_noalias, 1}, - {"argument-noalias-global", &flag_argument_noalias, 2} + {"bytecode", &output_bytecode, 1} }; /* Table of language-specific options. */ @@ -3416,7 +3401,6 @@ main (argc, argv, envp) #ifdef CAN_DEBUG_WITHOUT_FP flag_omit_frame_pointer = 1; #endif - flag_alias_check = 1; } if (optimize >= 2) diff --git a/gnu/usr.bin/gcc/tree.c b/gnu/usr.bin/gcc/tree.c index 8281e9c457b..e92863b35ee 100644 --- a/gnu/usr.bin/gcc/tree.c +++ b/gnu/usr.bin/gcc/tree.c @@ -1964,6 +1964,30 @@ saveable_tree_cons (purpose, value, chain) return node; } +/* Try to find out whether the type for which the size is to be determined + is an ARRAY(of ARRAY(of ARRAY ... of something with a constant size + which is an integral multiple of BITS_PER_UNIT)). + In that case, the size in bytes can be determined using an EXACT_DIV_EXPR. +*/ +enum tree_code +which_div_expr(type) + tree type; +{ + tree t; + + if (TREE_CODE (type) != POINTER_TYPE && TREE_CODE (type) != ARRAY_TYPE) + return CEIL_DIV_EXPR; + + for (t = TREE_TYPE (type); TREE_CODE (t) == ARRAY_TYPE; t = TREE_TYPE (t)) + ; + + if (TYPE_SIZE (t) != 0 && TREE_CODE (TYPE_SIZE (t)) == INTEGER_CST && + TREE_INT_CST_LOW (TYPE_SIZE (t)) % BITS_PER_UNIT == 0) + return EXACT_DIV_EXPR; + else + return CEIL_DIV_EXPR; +} + /* Return the size nominally occupied by an object of type TYPE when it resides in memory. The value is measured in units of bytes, and its data type is that normally used for type sizes @@ -1984,7 +2008,7 @@ size_in_bytes (type) incomplete_type_error (NULL_TREE, type); return integer_zero_node; } - t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), + t = size_binop (which_div_expr (type), TYPE_SIZE (type), size_int (BITS_PER_UNIT)); if (TREE_CODE (t) == INTEGER_CST) force_fit_type (t, 0); @@ -2008,7 +2032,7 @@ int_size_in_bytes (type) return -1; if (TREE_INT_CST_HIGH (TYPE_SIZE (type)) != 0) { - tree t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), + tree t = size_binop (which_div_expr (type), TYPE_SIZE (type), size_int (BITS_PER_UNIT)); return TREE_INT_CST_LOW (t); } diff --git a/gnu/usr.bin/gcc/unroll.c b/gnu/usr.bin/gcc/unroll.c index 459257ef899..c5985780a82 100644 --- a/gnu/usr.bin/gcc/unroll.c +++ b/gnu/usr.bin/gcc/unroll.c @@ -994,11 +994,8 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, for (j = FIRST_PSEUDO_REGISTER; j < max_reg_before_loop; j++) if (local_regno[j]) - { - map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j])); - record_base_value (REGNO (map->reg_map[j]), - regno_reg_rtx[j]); - } + map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j])); + /* The last copy needs the compare/branch insns at the end, so reset copy_end here if the loop ends with a conditional branch. */ @@ -1138,11 +1135,7 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, for (j = FIRST_PSEUDO_REGISTER; j < max_reg_before_loop; j++) if (local_regno[j]) - { - map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j])); - record_base_value (REGNO (map->reg_map[j]), - regno_reg_rtx[j]); - } + map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j])); /* If loop starts with a branch to the test, then fix it so that it points to the test of the first unrolled copy of the loop. */ @@ -1637,7 +1630,7 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration, /* Check for shared address givs, and avoid incrementing the shared pseudo reg more than once. */ - if (! tv->same_insn && ! tv->shared) + if (! tv->same_insn) { /* tv->dest_reg may actually be a (PLUS (REG) (CONST)) here, so we must call plus_constant @@ -1763,7 +1756,6 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration, tem = gen_reg_rtx (GET_MODE (giv_src_reg)); giv_dest_reg = tem; map->reg_map[regno] = tem; - record_base_value (REGNO (tem), giv_src_reg); } else map->reg_map[regno] = giv_src_reg; @@ -2450,8 +2442,7 @@ find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before, || ! invariant_p (bl->initial_value))) { rtx tem = gen_reg_rtx (bl->biv->mode); - - record_base_value (REGNO (tem), bl->biv->add_val); + emit_insn_before (gen_move_insn (tem, bl->biv->src_reg), loop_start); @@ -2508,8 +2499,6 @@ find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before, this insn will always be executed, no matter how the loop exits. */ rtx tem = gen_reg_rtx (bl->biv->mode); - record_base_value (REGNO (tem), bl->biv->add_val); - emit_insn_before (gen_move_insn (tem, bl->biv->src_reg), loop_start); emit_insn_before (gen_move_insn (bl->biv->src_reg, @@ -2685,7 +2674,6 @@ find_splittable_givs (bl, unroll_type, loop_start, loop_end, increment, { rtx tem = gen_reg_rtx (bl->biv->mode); - record_base_value (REGNO (tem), bl->biv->add_val); emit_insn_before (gen_move_insn (tem, bl->biv->src_reg), loop_start); biv_initial_value = tem; @@ -2727,7 +2715,6 @@ find_splittable_givs (bl, unroll_type, loop_start, loop_end, increment, || GET_CODE (XEXP (value, 1)) != CONST_INT)) { rtx tem = gen_reg_rtx (v->mode); - record_base_value (REGNO (tem), v->add_val); emit_iv_add_mult (bl->initial_value, v->mult_val, v->add_val, tem, loop_start); value = tem; @@ -2746,9 +2733,16 @@ find_splittable_givs (bl, unroll_type, loop_start, loop_end, increment, what we want for split addr regs. We always create a new register for the split addr giv, just to be safe. */ - /* If we have multiple identical address givs within a - single instruction, then use a single pseudo reg for - both. This is necessary in case one is a match_dup + /* ??? If there are multiple address givs which have been + combined with the same dest_reg giv, then we may only need + one new register for them. Pulling out constants below will + catch some of the common cases of this. Currently, I leave + the work of simplifying multiple address givs to the + following cse pass. */ + + /* As a special case, if we have multiple identical address givs + within a single instruction, then we do use a single pseudo + reg for both. This is necessary in case one is a match_dup of the other. */ v->const_adjust = 0; @@ -2761,26 +2755,12 @@ find_splittable_givs (bl, unroll_type, loop_start, loop_end, increment, "Sharing address givs in insn %d\n", INSN_UID (v->insn)); } - /* If multiple address GIVs have been combined with the - same dest_reg GIV, do not create a new register for - each. */ - else if (unroll_type != UNROLL_COMPLETELY - && v->giv_type == DEST_ADDR - && v->same && v->same->giv_type == DEST_ADDR - && v->same->unrolled) - { - v->dest_reg = v->same->dest_reg; - v->shared = 1; - } else if (unroll_type != UNROLL_COMPLETELY) { /* If not completely unrolling the loop, then create a new register to hold the split value of the DEST_ADDR giv. Emit insn to initialize its value before loop start. */ - - rtx tem = gen_reg_rtx (v->mode); - record_base_value (REGNO (tem), v->add_val); - v->unrolled = 1; + tem = gen_reg_rtx (v->mode); /* If the address giv has a constant in its new_reg value, then this constant can be pulled out and put in value, @@ -2791,7 +2771,7 @@ find_splittable_givs (bl, unroll_type, loop_start, loop_end, increment, { v->dest_reg = plus_constant (tem, INTVAL (XEXP (v->new_reg,1))); - + /* Only succeed if this will give valid addresses. Try to validate both the first and the last address resulting from loop unrolling, if @@ -3080,7 +3060,6 @@ final_biv_value (bl, loop_start, loop_end) case it is needed later. */ tem = gen_reg_rtx (bl->biv->mode); - record_base_value (REGNO (tem), bl->biv->add_val); /* Make sure loop_end is not the last insn. */ if (NEXT_INSN (loop_end) == 0) emit_note_after (NOTE_INSN_DELETED, loop_end); @@ -3174,7 +3153,6 @@ final_giv_value (v, loop_start, loop_end) /* Put the final biv value in tem. */ tem = gen_reg_rtx (bl->biv->mode); - record_base_value (REGNO (tem), bl->biv->add_val); emit_iv_add_mult (increment, GEN_INT (loop_n_iterations), bl->initial_value, tem, insert_before); -- 2.20.1