aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-01-14 16:56:44 +0100
committerMartin Liska <mliska@suse.cz>2022-01-17 22:12:04 +0100
commit5c69acb32329d49e58c26fa41ae74229a52b9106 (patch)
treeddb05f9d73afb6f998457d2ac4b720e3b3b60483 /gcc/fortran/interface.c
parent490e23032baaece71f2ec09fa1805064b150fbc2 (diff)
downloadgcc-5c69acb32329d49e58c26fa41ae74229a52b9106.zip
gcc-5c69acb32329d49e58c26fa41ae74229a52b9106.tar.gz
gcc-5c69acb32329d49e58c26fa41ae74229a52b9106.tar.bz2
Rename .c files to .cc files.
gcc/ada/ChangeLog: * adadecode.c: Moved to... * adadecode.cc: ...here. * affinity.c: Moved to... * affinity.cc: ...here. * argv-lynxos178-raven-cert.c: Moved to... * argv-lynxos178-raven-cert.cc: ...here. * argv.c: Moved to... * argv.cc: ...here. * aux-io.c: Moved to... * aux-io.cc: ...here. * cio.c: Moved to... * cio.cc: ...here. * cstreams.c: Moved to... * cstreams.cc: ...here. * env.c: Moved to... * env.cc: ...here. * exit.c: Moved to... * exit.cc: ...here. * expect.c: Moved to... * expect.cc: ...here. * final.c: Moved to... * final.cc: ...here. * gcc-interface/cuintp.c: Moved to... * gcc-interface/cuintp.cc: ...here. * gcc-interface/decl.c: Moved to... * gcc-interface/decl.cc: ...here. * gcc-interface/misc.c: Moved to... * gcc-interface/misc.cc: ...here. * gcc-interface/targtyps.c: Moved to... * gcc-interface/targtyps.cc: ...here. * gcc-interface/trans.c: Moved to... * gcc-interface/trans.cc: ...here. * gcc-interface/utils.c: Moved to... * gcc-interface/utils.cc: ...here. * gcc-interface/utils2.c: Moved to... * gcc-interface/utils2.cc: ...here. * init.c: Moved to... * init.cc: ...here. * initialize.c: Moved to... * initialize.cc: ...here. * libgnarl/thread.c: Moved to... * libgnarl/thread.cc: ...here. * link.c: Moved to... * link.cc: ...here. * locales.c: Moved to... * locales.cc: ...here. * mkdir.c: Moved to... * mkdir.cc: ...here. * raise.c: Moved to... * raise.cc: ...here. * rtfinal.c: Moved to... * rtfinal.cc: ...here. * rtinit.c: Moved to... * rtinit.cc: ...here. * seh_init.c: Moved to... * seh_init.cc: ...here. * sigtramp-armdroid.c: Moved to... * sigtramp-armdroid.cc: ...here. * sigtramp-ios.c: Moved to... * sigtramp-ios.cc: ...here. * sigtramp-qnx.c: Moved to... * sigtramp-qnx.cc: ...here. * sigtramp-vxworks.c: Moved to... * sigtramp-vxworks.cc: ...here. * socket.c: Moved to... * socket.cc: ...here. * tracebak.c: Moved to... * tracebak.cc: ...here. * version.c: Moved to... * version.cc: ...here. * vx_stack_info.c: Moved to... * vx_stack_info.cc: ...here. gcc/ChangeLog: * adjust-alignment.c: Moved to... * adjust-alignment.cc: ...here. * alias.c: Moved to... * alias.cc: ...here. * alloc-pool.c: Moved to... * alloc-pool.cc: ...here. * asan.c: Moved to... * asan.cc: ...here. * attribs.c: Moved to... * attribs.cc: ...here. * auto-inc-dec.c: Moved to... * auto-inc-dec.cc: ...here. * auto-profile.c: Moved to... * auto-profile.cc: ...here. * bb-reorder.c: Moved to... * bb-reorder.cc: ...here. * bitmap.c: Moved to... * bitmap.cc: ...here. * btfout.c: Moved to... * btfout.cc: ...here. * builtins.c: Moved to... * builtins.cc: ...here. * caller-save.c: Moved to... * caller-save.cc: ...here. * calls.c: Moved to... * calls.cc: ...here. * ccmp.c: Moved to... * ccmp.cc: ...here. * cfg.c: Moved to... * cfg.cc: ...here. * cfganal.c: Moved to... * cfganal.cc: ...here. * cfgbuild.c: Moved to... * cfgbuild.cc: ...here. * cfgcleanup.c: Moved to... * cfgcleanup.cc: ...here. * cfgexpand.c: Moved to... * cfgexpand.cc: ...here. * cfghooks.c: Moved to... * cfghooks.cc: ...here. * cfgloop.c: Moved to... * cfgloop.cc: ...here. * cfgloopanal.c: Moved to... * cfgloopanal.cc: ...here. * cfgloopmanip.c: Moved to... * cfgloopmanip.cc: ...here. * cfgrtl.c: Moved to... * cfgrtl.cc: ...here. * cgraph.c: Moved to... * cgraph.cc: ...here. * cgraphbuild.c: Moved to... * cgraphbuild.cc: ...here. * cgraphclones.c: Moved to... * cgraphclones.cc: ...here. * cgraphunit.c: Moved to... * cgraphunit.cc: ...here. * collect-utils.c: Moved to... * collect-utils.cc: ...here. * collect2-aix.c: Moved to... * collect2-aix.cc: ...here. * collect2.c: Moved to... * collect2.cc: ...here. * combine-stack-adj.c: Moved to... * combine-stack-adj.cc: ...here. * combine.c: Moved to... * combine.cc: ...here. * common/common-targhooks.c: Moved to... * common/common-targhooks.cc: ...here. * common/config/aarch64/aarch64-common.c: Moved to... * common/config/aarch64/aarch64-common.cc: ...here. * common/config/alpha/alpha-common.c: Moved to... * common/config/alpha/alpha-common.cc: ...here. * common/config/arc/arc-common.c: Moved to... * common/config/arc/arc-common.cc: ...here. * common/config/arm/arm-common.c: Moved to... * common/config/arm/arm-common.cc: ...here. * common/config/avr/avr-common.c: Moved to... * common/config/avr/avr-common.cc: ...here. * common/config/bfin/bfin-common.c: Moved to... * common/config/bfin/bfin-common.cc: ...here. * common/config/bpf/bpf-common.c: Moved to... * common/config/bpf/bpf-common.cc: ...here. * common/config/c6x/c6x-common.c: Moved to... * common/config/c6x/c6x-common.cc: ...here. * common/config/cr16/cr16-common.c: Moved to... * common/config/cr16/cr16-common.cc: ...here. * common/config/cris/cris-common.c: Moved to... * common/config/cris/cris-common.cc: ...here. * common/config/csky/csky-common.c: Moved to... * common/config/csky/csky-common.cc: ...here. * common/config/default-common.c: Moved to... * common/config/default-common.cc: ...here. * common/config/epiphany/epiphany-common.c: Moved to... * common/config/epiphany/epiphany-common.cc: ...here. * common/config/fr30/fr30-common.c: Moved to... * common/config/fr30/fr30-common.cc: ...here. * common/config/frv/frv-common.c: Moved to... * common/config/frv/frv-common.cc: ...here. * common/config/gcn/gcn-common.c: Moved to... * common/config/gcn/gcn-common.cc: ...here. * common/config/h8300/h8300-common.c: Moved to... * common/config/h8300/h8300-common.cc: ...here. * common/config/i386/i386-common.c: Moved to... * common/config/i386/i386-common.cc: ...here. * common/config/ia64/ia64-common.c: Moved to... * common/config/ia64/ia64-common.cc: ...here. * common/config/iq2000/iq2000-common.c: Moved to... * common/config/iq2000/iq2000-common.cc: ...here. * common/config/lm32/lm32-common.c: Moved to... * common/config/lm32/lm32-common.cc: ...here. * common/config/m32r/m32r-common.c: Moved to... * common/config/m32r/m32r-common.cc: ...here. * common/config/m68k/m68k-common.c: Moved to... * common/config/m68k/m68k-common.cc: ...here. * common/config/mcore/mcore-common.c: Moved to... * common/config/mcore/mcore-common.cc: ...here. * common/config/microblaze/microblaze-common.c: Moved to... * common/config/microblaze/microblaze-common.cc: ...here. * common/config/mips/mips-common.c: Moved to... * common/config/mips/mips-common.cc: ...here. * common/config/mmix/mmix-common.c: Moved to... * common/config/mmix/mmix-common.cc: ...here. * common/config/mn10300/mn10300-common.c: Moved to... * common/config/mn10300/mn10300-common.cc: ...here. * common/config/msp430/msp430-common.c: Moved to... * common/config/msp430/msp430-common.cc: ...here. * common/config/nds32/nds32-common.c: Moved to... * common/config/nds32/nds32-common.cc: ...here. * common/config/nios2/nios2-common.c: Moved to... * common/config/nios2/nios2-common.cc: ...here. * common/config/nvptx/nvptx-common.c: Moved to... * common/config/nvptx/nvptx-common.cc: ...here. * common/config/or1k/or1k-common.c: Moved to... * common/config/or1k/or1k-common.cc: ...here. * common/config/pa/pa-common.c: Moved to... * common/config/pa/pa-common.cc: ...here. * common/config/pdp11/pdp11-common.c: Moved to... * common/config/pdp11/pdp11-common.cc: ...here. * common/config/pru/pru-common.c: Moved to... * common/config/pru/pru-common.cc: ...here. * common/config/riscv/riscv-common.c: Moved to... * common/config/riscv/riscv-common.cc: ...here. * common/config/rs6000/rs6000-common.c: Moved to... * common/config/rs6000/rs6000-common.cc: ...here. * common/config/rx/rx-common.c: Moved to... * common/config/rx/rx-common.cc: ...here. * common/config/s390/s390-common.c: Moved to... * common/config/s390/s390-common.cc: ...here. * common/config/sh/sh-common.c: Moved to... * common/config/sh/sh-common.cc: ...here. * common/config/sparc/sparc-common.c: Moved to... * common/config/sparc/sparc-common.cc: ...here. * common/config/tilegx/tilegx-common.c: Moved to... * common/config/tilegx/tilegx-common.cc: ...here. * common/config/tilepro/tilepro-common.c: Moved to... * common/config/tilepro/tilepro-common.cc: ...here. * common/config/v850/v850-common.c: Moved to... * common/config/v850/v850-common.cc: ...here. * common/config/vax/vax-common.c: Moved to... * common/config/vax/vax-common.cc: ...here. * common/config/visium/visium-common.c: Moved to... * common/config/visium/visium-common.cc: ...here. * common/config/xstormy16/xstormy16-common.c: Moved to... * common/config/xstormy16/xstormy16-common.cc: ...here. * common/config/xtensa/xtensa-common.c: Moved to... * common/config/xtensa/xtensa-common.cc: ...here. * compare-elim.c: Moved to... * compare-elim.cc: ...here. * config/aarch64/aarch64-bti-insert.c: Moved to... * config/aarch64/aarch64-bti-insert.cc: ...here. * config/aarch64/aarch64-builtins.c: Moved to... * config/aarch64/aarch64-builtins.cc: ...here. * config/aarch64/aarch64-c.c: Moved to... * config/aarch64/aarch64-c.cc: ...here. * config/aarch64/aarch64-d.c: Moved to... * config/aarch64/aarch64-d.cc: ...here. * config/aarch64/aarch64.c: Moved to... * config/aarch64/aarch64.cc: ...here. * config/aarch64/cortex-a57-fma-steering.c: Moved to... * config/aarch64/cortex-a57-fma-steering.cc: ...here. * config/aarch64/driver-aarch64.c: Moved to... * config/aarch64/driver-aarch64.cc: ...here. * config/aarch64/falkor-tag-collision-avoidance.c: Moved to... * config/aarch64/falkor-tag-collision-avoidance.cc: ...here. * config/aarch64/host-aarch64-darwin.c: Moved to... * config/aarch64/host-aarch64-darwin.cc: ...here. * config/alpha/alpha.c: Moved to... * config/alpha/alpha.cc: ...here. * config/alpha/driver-alpha.c: Moved to... * config/alpha/driver-alpha.cc: ...here. * config/arc/arc-c.c: Moved to... * config/arc/arc-c.cc: ...here. * config/arc/arc.c: Moved to... * config/arc/arc.cc: ...here. * config/arc/driver-arc.c: Moved to... * config/arc/driver-arc.cc: ...here. * config/arm/aarch-common.c: Moved to... * config/arm/aarch-common.cc: ...here. * config/arm/arm-builtins.c: Moved to... * config/arm/arm-builtins.cc: ...here. * config/arm/arm-c.c: Moved to... * config/arm/arm-c.cc: ...here. * config/arm/arm-d.c: Moved to... * config/arm/arm-d.cc: ...here. * config/arm/arm.c: Moved to... * config/arm/arm.cc: ...here. * config/arm/driver-arm.c: Moved to... * config/arm/driver-arm.cc: ...here. * config/avr/avr-c.c: Moved to... * config/avr/avr-c.cc: ...here. * config/avr/avr-devices.c: Moved to... * config/avr/avr-devices.cc: ...here. * config/avr/avr-log.c: Moved to... * config/avr/avr-log.cc: ...here. * config/avr/avr.c: Moved to... * config/avr/avr.cc: ...here. * config/avr/driver-avr.c: Moved to... * config/avr/driver-avr.cc: ...here. * config/avr/gen-avr-mmcu-specs.c: Moved to... * config/avr/gen-avr-mmcu-specs.cc: ...here. * config/avr/gen-avr-mmcu-texi.c: Moved to... * config/avr/gen-avr-mmcu-texi.cc: ...here. * config/bfin/bfin.c: Moved to... * config/bfin/bfin.cc: ...here. * config/bpf/bpf.c: Moved to... * config/bpf/bpf.cc: ...here. * config/bpf/coreout.c: Moved to... * config/bpf/coreout.cc: ...here. * config/c6x/c6x.c: Moved to... * config/c6x/c6x.cc: ...here. * config/cr16/cr16.c: Moved to... * config/cr16/cr16.cc: ...here. * config/cris/cris.c: Moved to... * config/cris/cris.cc: ...here. * config/csky/csky.c: Moved to... * config/csky/csky.cc: ...here. * config/darwin-c.c: Moved to... * config/darwin-c.cc: ...here. * config/darwin-d.c: Moved to... * config/darwin-d.cc: ...here. * config/darwin-driver.c: Moved to... * config/darwin-driver.cc: ...here. * config/darwin-f.c: Moved to... * config/darwin-f.cc: ...here. * config/darwin.c: Moved to... * config/darwin.cc: ...here. * config/default-c.c: Moved to... * config/default-c.cc: ...here. * config/default-d.c: Moved to... * config/default-d.cc: ...here. * config/dragonfly-d.c: Moved to... * config/dragonfly-d.cc: ...here. * config/epiphany/epiphany.c: Moved to... * config/epiphany/epiphany.cc: ...here. * config/epiphany/mode-switch-use.c: Moved to... * config/epiphany/mode-switch-use.cc: ...here. * config/epiphany/resolve-sw-modes.c: Moved to... * config/epiphany/resolve-sw-modes.cc: ...here. * config/fr30/fr30.c: Moved to... * config/fr30/fr30.cc: ...here. * config/freebsd-d.c: Moved to... * config/freebsd-d.cc: ...here. * config/frv/frv.c: Moved to... * config/frv/frv.cc: ...here. * config/ft32/ft32.c: Moved to... * config/ft32/ft32.cc: ...here. * config/gcn/driver-gcn.c: Moved to... * config/gcn/driver-gcn.cc: ...here. * config/gcn/gcn-run.c: Moved to... * config/gcn/gcn-run.cc: ...here. * config/gcn/gcn-tree.c: Moved to... * config/gcn/gcn-tree.cc: ...here. * config/gcn/gcn.c: Moved to... * config/gcn/gcn.cc: ...here. * config/gcn/mkoffload.c: Moved to... * config/gcn/mkoffload.cc: ...here. * config/glibc-c.c: Moved to... * config/glibc-c.cc: ...here. * config/glibc-d.c: Moved to... * config/glibc-d.cc: ...here. * config/h8300/h8300.c: Moved to... * config/h8300/h8300.cc: ...here. * config/host-darwin.c: Moved to... * config/host-darwin.cc: ...here. * config/host-hpux.c: Moved to... * config/host-hpux.cc: ...here. * config/host-linux.c: Moved to... * config/host-linux.cc: ...here. * config/host-netbsd.c: Moved to... * config/host-netbsd.cc: ...here. * config/host-openbsd.c: Moved to... * config/host-openbsd.cc: ...here. * config/host-solaris.c: Moved to... * config/host-solaris.cc: ...here. * config/i386/djgpp.c: Moved to... * config/i386/djgpp.cc: ...here. * config/i386/driver-i386.c: Moved to... * config/i386/driver-i386.cc: ...here. * config/i386/driver-mingw32.c: Moved to... * config/i386/driver-mingw32.cc: ...here. * config/i386/gnu-property.c: Moved to... * config/i386/gnu-property.cc: ...here. * config/i386/host-cygwin.c: Moved to... * config/i386/host-cygwin.cc: ...here. * config/i386/host-i386-darwin.c: Moved to... * config/i386/host-i386-darwin.cc: ...here. * config/i386/host-mingw32.c: Moved to... * config/i386/host-mingw32.cc: ...here. * config/i386/i386-builtins.c: Moved to... * config/i386/i386-builtins.cc: ...here. * config/i386/i386-c.c: Moved to... * config/i386/i386-c.cc: ...here. * config/i386/i386-d.c: Moved to... * config/i386/i386-d.cc: ...here. * config/i386/i386-expand.c: Moved to... * config/i386/i386-expand.cc: ...here. * config/i386/i386-features.c: Moved to... * config/i386/i386-features.cc: ...here. * config/i386/i386-options.c: Moved to... * config/i386/i386-options.cc: ...here. * config/i386/i386.c: Moved to... * config/i386/i386.cc: ...here. * config/i386/intelmic-mkoffload.c: Moved to... * config/i386/intelmic-mkoffload.cc: ...here. * config/i386/msformat-c.c: Moved to... * config/i386/msformat-c.cc: ...here. * config/i386/winnt-cxx.c: Moved to... * config/i386/winnt-cxx.cc: ...here. * config/i386/winnt-d.c: Moved to... * config/i386/winnt-d.cc: ...here. * config/i386/winnt-stubs.c: Moved to... * config/i386/winnt-stubs.cc: ...here. * config/i386/winnt.c: Moved to... * config/i386/winnt.cc: ...here. * config/i386/x86-tune-sched-atom.c: Moved to... * config/i386/x86-tune-sched-atom.cc: ...here. * config/i386/x86-tune-sched-bd.c: Moved to... * config/i386/x86-tune-sched-bd.cc: ...here. * config/i386/x86-tune-sched-core.c: Moved to... * config/i386/x86-tune-sched-core.cc: ...here. * config/i386/x86-tune-sched.c: Moved to... * config/i386/x86-tune-sched.cc: ...here. * config/ia64/ia64-c.c: Moved to... * config/ia64/ia64-c.cc: ...here. * config/ia64/ia64.c: Moved to... * config/ia64/ia64.cc: ...here. * config/iq2000/iq2000.c: Moved to... * config/iq2000/iq2000.cc: ...here. * config/linux.c: Moved to... * config/linux.cc: ...here. * config/lm32/lm32.c: Moved to... * config/lm32/lm32.cc: ...here. * config/m32c/m32c-pragma.c: Moved to... * config/m32c/m32c-pragma.cc: ...here. * config/m32c/m32c.c: Moved to... * config/m32c/m32c.cc: ...here. * config/m32r/m32r.c: Moved to... * config/m32r/m32r.cc: ...here. * config/m68k/m68k.c: Moved to... * config/m68k/m68k.cc: ...here. * config/mcore/mcore.c: Moved to... * config/mcore/mcore.cc: ...here. * config/microblaze/microblaze-c.c: Moved to... * config/microblaze/microblaze-c.cc: ...here. * config/microblaze/microblaze.c: Moved to... * config/microblaze/microblaze.cc: ...here. * config/mips/driver-native.c: Moved to... * config/mips/driver-native.cc: ...here. * config/mips/frame-header-opt.c: Moved to... * config/mips/frame-header-opt.cc: ...here. * config/mips/mips-d.c: Moved to... * config/mips/mips-d.cc: ...here. * config/mips/mips.c: Moved to... * config/mips/mips.cc: ...here. * config/mmix/mmix.c: Moved to... * config/mmix/mmix.cc: ...here. * config/mn10300/mn10300.c: Moved to... * config/mn10300/mn10300.cc: ...here. * config/moxie/moxie.c: Moved to... * config/moxie/moxie.cc: ...here. * config/msp430/driver-msp430.c: Moved to... * config/msp430/driver-msp430.cc: ...here. * config/msp430/msp430-c.c: Moved to... * config/msp430/msp430-c.cc: ...here. * config/msp430/msp430-devices.c: Moved to... * config/msp430/msp430-devices.cc: ...here. * config/msp430/msp430.c: Moved to... * config/msp430/msp430.cc: ...here. * config/nds32/nds32-cost.c: Moved to... * config/nds32/nds32-cost.cc: ...here. * config/nds32/nds32-fp-as-gp.c: Moved to... * config/nds32/nds32-fp-as-gp.cc: ...here. * config/nds32/nds32-intrinsic.c: Moved to... * config/nds32/nds32-intrinsic.cc: ...here. * config/nds32/nds32-isr.c: Moved to... * config/nds32/nds32-isr.cc: ...here. * config/nds32/nds32-md-auxiliary.c: Moved to... * config/nds32/nds32-md-auxiliary.cc: ...here. * config/nds32/nds32-memory-manipulation.c: Moved to... * config/nds32/nds32-memory-manipulation.cc: ...here. * config/nds32/nds32-pipelines-auxiliary.c: Moved to... * config/nds32/nds32-pipelines-auxiliary.cc: ...here. * config/nds32/nds32-predicates.c: Moved to... * config/nds32/nds32-predicates.cc: ...here. * config/nds32/nds32-relax-opt.c: Moved to... * config/nds32/nds32-relax-opt.cc: ...here. * config/nds32/nds32-utils.c: Moved to... * config/nds32/nds32-utils.cc: ...here. * config/nds32/nds32.c: Moved to... * config/nds32/nds32.cc: ...here. * config/netbsd-d.c: Moved to... * config/netbsd-d.cc: ...here. * config/netbsd.c: Moved to... * config/netbsd.cc: ...here. * config/nios2/nios2.c: Moved to... * config/nios2/nios2.cc: ...here. * config/nvptx/mkoffload.c: Moved to... * config/nvptx/mkoffload.cc: ...here. * config/nvptx/nvptx-c.c: Moved to... * config/nvptx/nvptx-c.cc: ...here. * config/nvptx/nvptx.c: Moved to... * config/nvptx/nvptx.cc: ...here. * config/openbsd-d.c: Moved to... * config/openbsd-d.cc: ...here. * config/or1k/or1k.c: Moved to... * config/or1k/or1k.cc: ...here. * config/pa/pa-d.c: Moved to... * config/pa/pa-d.cc: ...here. * config/pa/pa.c: Moved to... * config/pa/pa.cc: ...here. * config/pdp11/pdp11.c: Moved to... * config/pdp11/pdp11.cc: ...here. * config/pru/pru-passes.c: Moved to... * config/pru/pru-passes.cc: ...here. * config/pru/pru-pragma.c: Moved to... * config/pru/pru-pragma.cc: ...here. * config/pru/pru.c: Moved to... * config/pru/pru.cc: ...here. * config/riscv/riscv-builtins.c: Moved to... * config/riscv/riscv-builtins.cc: ...here. * config/riscv/riscv-c.c: Moved to... * config/riscv/riscv-c.cc: ...here. * config/riscv/riscv-d.c: Moved to... * config/riscv/riscv-d.cc: ...here. * config/riscv/riscv-shorten-memrefs.c: Moved to... * config/riscv/riscv-shorten-memrefs.cc: ...here. * config/riscv/riscv-sr.c: Moved to... * config/riscv/riscv-sr.cc: ...here. * config/riscv/riscv.c: Moved to... * config/riscv/riscv.cc: ...here. * config/rl78/rl78-c.c: Moved to... * config/rl78/rl78-c.cc: ...here. * config/rl78/rl78.c: Moved to... * config/rl78/rl78.cc: ...here. * config/rs6000/driver-rs6000.c: Moved to... * config/rs6000/driver-rs6000.cc: ...here. * config/rs6000/host-darwin.c: Moved to... * config/rs6000/host-darwin.cc: ...here. * config/rs6000/host-ppc64-darwin.c: Moved to... * config/rs6000/host-ppc64-darwin.cc: ...here. * config/rs6000/rbtree.c: Moved to... * config/rs6000/rbtree.cc: ...here. * config/rs6000/rs6000-c.c: Moved to... * config/rs6000/rs6000-c.cc: ...here. * config/rs6000/rs6000-call.c: Moved to... * config/rs6000/rs6000-call.cc: ...here. * config/rs6000/rs6000-d.c: Moved to... * config/rs6000/rs6000-d.cc: ...here. * config/rs6000/rs6000-gen-builtins.c: Moved to... * config/rs6000/rs6000-gen-builtins.cc: ...here. * config/rs6000/rs6000-linux.c: Moved to... * config/rs6000/rs6000-linux.cc: ...here. * config/rs6000/rs6000-logue.c: Moved to... * config/rs6000/rs6000-logue.cc: ...here. * config/rs6000/rs6000-p8swap.c: Moved to... * config/rs6000/rs6000-p8swap.cc: ...here. * config/rs6000/rs6000-pcrel-opt.c: Moved to... * config/rs6000/rs6000-pcrel-opt.cc: ...here. * config/rs6000/rs6000-string.c: Moved to... * config/rs6000/rs6000-string.cc: ...here. * config/rs6000/rs6000.c: Moved to... * config/rs6000/rs6000.cc: ...here. * config/rx/rx.c: Moved to... * config/rx/rx.cc: ...here. * config/s390/driver-native.c: Moved to... * config/s390/driver-native.cc: ...here. * config/s390/s390-c.c: Moved to... * config/s390/s390-c.cc: ...here. * config/s390/s390-d.c: Moved to... * config/s390/s390-d.cc: ...here. * config/s390/s390.c: Moved to... * config/s390/s390.cc: ...here. * config/sh/divtab-sh4-300.c: Moved to... * config/sh/divtab-sh4-300.cc: ...here. * config/sh/divtab-sh4.c: Moved to... * config/sh/divtab-sh4.cc: ...here. * config/sh/divtab.c: Moved to... * config/sh/divtab.cc: ...here. * config/sh/sh-c.c: Moved to... * config/sh/sh-c.cc: ...here. * config/sh/sh.c: Moved to... * config/sh/sh.cc: ...here. * config/sol2-c.c: Moved to... * config/sol2-c.cc: ...here. * config/sol2-cxx.c: Moved to... * config/sol2-cxx.cc: ...here. * config/sol2-d.c: Moved to... * config/sol2-d.cc: ...here. * config/sol2-stubs.c: Moved to... * config/sol2-stubs.cc: ...here. * config/sol2.c: Moved to... * config/sol2.cc: ...here. * config/sparc/driver-sparc.c: Moved to... * config/sparc/driver-sparc.cc: ...here. * config/sparc/sparc-c.c: Moved to... * config/sparc/sparc-c.cc: ...here. * config/sparc/sparc-d.c: Moved to... * config/sparc/sparc-d.cc: ...here. * config/sparc/sparc.c: Moved to... * config/sparc/sparc.cc: ...here. * config/stormy16/stormy16.c: Moved to... * config/stormy16/stormy16.cc: ...here. * config/tilegx/mul-tables.c: Moved to... * config/tilegx/mul-tables.cc: ...here. * config/tilegx/tilegx-c.c: Moved to... * config/tilegx/tilegx-c.cc: ...here. * config/tilegx/tilegx.c: Moved to... * config/tilegx/tilegx.cc: ...here. * config/tilepro/mul-tables.c: Moved to... * config/tilepro/mul-tables.cc: ...here. * config/tilepro/tilepro-c.c: Moved to... * config/tilepro/tilepro-c.cc: ...here. * config/tilepro/tilepro.c: Moved to... * config/tilepro/tilepro.cc: ...here. * config/v850/v850-c.c: Moved to... * config/v850/v850-c.cc: ...here. * config/v850/v850.c: Moved to... * config/v850/v850.cc: ...here. * config/vax/vax.c: Moved to... * config/vax/vax.cc: ...here. * config/visium/visium.c: Moved to... * config/visium/visium.cc: ...here. * config/vms/vms-c.c: Moved to... * config/vms/vms-c.cc: ...here. * config/vms/vms-f.c: Moved to... * config/vms/vms-f.cc: ...here. * config/vms/vms.c: Moved to... * config/vms/vms.cc: ...here. * config/vxworks-c.c: Moved to... * config/vxworks-c.cc: ...here. * config/vxworks.c: Moved to... * config/vxworks.cc: ...here. * config/winnt-c.c: Moved to... * config/winnt-c.cc: ...here. * config/xtensa/xtensa.c: Moved to... * config/xtensa/xtensa.cc: ...here. * context.c: Moved to... * context.cc: ...here. * convert.c: Moved to... * convert.cc: ...here. * coverage.c: Moved to... * coverage.cc: ...here. * cppbuiltin.c: Moved to... * cppbuiltin.cc: ...here. * cppdefault.c: Moved to... * cppdefault.cc: ...here. * cprop.c: Moved to... * cprop.cc: ...here. * cse.c: Moved to... * cse.cc: ...here. * cselib.c: Moved to... * cselib.cc: ...here. * ctfc.c: Moved to... * ctfc.cc: ...here. * ctfout.c: Moved to... * ctfout.cc: ...here. * data-streamer-in.c: Moved to... * data-streamer-in.cc: ...here. * data-streamer-out.c: Moved to... * data-streamer-out.cc: ...here. * data-streamer.c: Moved to... * data-streamer.cc: ...here. * dbgcnt.c: Moved to... * dbgcnt.cc: ...here. * dbxout.c: Moved to... * dbxout.cc: ...here. * dce.c: Moved to... * dce.cc: ...here. * ddg.c: Moved to... * ddg.cc: ...here. * debug.c: Moved to... * debug.cc: ...here. * df-core.c: Moved to... * df-core.cc: ...here. * df-problems.c: Moved to... * df-problems.cc: ...here. * df-scan.c: Moved to... * df-scan.cc: ...here. * dfp.c: Moved to... * dfp.cc: ...here. * diagnostic-color.c: Moved to... * diagnostic-color.cc: ...here. * diagnostic-show-locus.c: Moved to... * diagnostic-show-locus.cc: ...here. * diagnostic-spec.c: Moved to... * diagnostic-spec.cc: ...here. * diagnostic.c: Moved to... * diagnostic.cc: ...here. * dojump.c: Moved to... * dojump.cc: ...here. * dominance.c: Moved to... * dominance.cc: ...here. * domwalk.c: Moved to... * domwalk.cc: ...here. * double-int.c: Moved to... * double-int.cc: ...here. * dse.c: Moved to... * dse.cc: ...here. * dumpfile.c: Moved to... * dumpfile.cc: ...here. * dwarf2asm.c: Moved to... * dwarf2asm.cc: ...here. * dwarf2cfi.c: Moved to... * dwarf2cfi.cc: ...here. * dwarf2ctf.c: Moved to... * dwarf2ctf.cc: ...here. * dwarf2out.c: Moved to... * dwarf2out.cc: ...here. * early-remat.c: Moved to... * early-remat.cc: ...here. * edit-context.c: Moved to... * edit-context.cc: ...here. * emit-rtl.c: Moved to... * emit-rtl.cc: ...here. * errors.c: Moved to... * errors.cc: ...here. * et-forest.c: Moved to... * et-forest.cc: ...here. * except.c: Moved to... * except.cc: ...here. * explow.c: Moved to... * explow.cc: ...here. * expmed.c: Moved to... * expmed.cc: ...here. * expr.c: Moved to... * expr.cc: ...here. * fibonacci_heap.c: Moved to... * fibonacci_heap.cc: ...here. * file-find.c: Moved to... * file-find.cc: ...here. * file-prefix-map.c: Moved to... * file-prefix-map.cc: ...here. * final.c: Moved to... * final.cc: ...here. * fixed-value.c: Moved to... * fixed-value.cc: ...here. * fold-const-call.c: Moved to... * fold-const-call.cc: ...here. * fold-const.c: Moved to... * fold-const.cc: ...here. * fp-test.c: Moved to... * fp-test.cc: ...here. * function-tests.c: Moved to... * function-tests.cc: ...here. * function.c: Moved to... * function.cc: ...here. * fwprop.c: Moved to... * fwprop.cc: ...here. * gcc-ar.c: Moved to... * gcc-ar.cc: ...here. * gcc-main.c: Moved to... * gcc-main.cc: ...here. * gcc-rich-location.c: Moved to... * gcc-rich-location.cc: ...here. * gcc.c: Moved to... * gcc.cc: ...here. * gcov-dump.c: Moved to... * gcov-dump.cc: ...here. * gcov-io.c: Moved to... * gcov-io.cc: ...here. * gcov-tool.c: Moved to... * gcov-tool.cc: ...here. * gcov.c: Moved to... * gcov.cc: ...here. * gcse-common.c: Moved to... * gcse-common.cc: ...here. * gcse.c: Moved to... * gcse.cc: ...here. * genattr-common.c: Moved to... * genattr-common.cc: ...here. * genattr.c: Moved to... * genattr.cc: ...here. * genattrtab.c: Moved to... * genattrtab.cc: ...here. * genautomata.c: Moved to... * genautomata.cc: ...here. * gencfn-macros.c: Moved to... * gencfn-macros.cc: ...here. * gencheck.c: Moved to... * gencheck.cc: ...here. * genchecksum.c: Moved to... * genchecksum.cc: ...here. * gencodes.c: Moved to... * gencodes.cc: ...here. * genconditions.c: Moved to... * genconditions.cc: ...here. * genconfig.c: Moved to... * genconfig.cc: ...here. * genconstants.c: Moved to... * genconstants.cc: ...here. * genemit.c: Moved to... * genemit.cc: ...here. * genenums.c: Moved to... * genenums.cc: ...here. * generic-match-head.c: Moved to... * generic-match-head.cc: ...here. * genextract.c: Moved to... * genextract.cc: ...here. * genflags.c: Moved to... * genflags.cc: ...here. * gengenrtl.c: Moved to... * gengenrtl.cc: ...here. * gengtype-parse.c: Moved to... * gengtype-parse.cc: ...here. * gengtype-state.c: Moved to... * gengtype-state.cc: ...here. * gengtype.c: Moved to... * gengtype.cc: ...here. * genhooks.c: Moved to... * genhooks.cc: ...here. * genmatch.c: Moved to... * genmatch.cc: ...here. * genmddeps.c: Moved to... * genmddeps.cc: ...here. * genmddump.c: Moved to... * genmddump.cc: ...here. * genmodes.c: Moved to... * genmodes.cc: ...here. * genopinit.c: Moved to... * genopinit.cc: ...here. * genoutput.c: Moved to... * genoutput.cc: ...here. * genpeep.c: Moved to... * genpeep.cc: ...here. * genpreds.c: Moved to... * genpreds.cc: ...here. * genrecog.c: Moved to... * genrecog.cc: ...here. * gensupport.c: Moved to... * gensupport.cc: ...here. * gentarget-def.c: Moved to... * gentarget-def.cc: ...here. * genversion.c: Moved to... * genversion.cc: ...here. * ggc-common.c: Moved to... * ggc-common.cc: ...here. * ggc-none.c: Moved to... * ggc-none.cc: ...here. * ggc-page.c: Moved to... * ggc-page.cc: ...here. * ggc-tests.c: Moved to... * ggc-tests.cc: ...here. * gimple-builder.c: Moved to... * gimple-builder.cc: ...here. * gimple-expr.c: Moved to... * gimple-expr.cc: ...here. * gimple-fold.c: Moved to... * gimple-fold.cc: ...here. * gimple-iterator.c: Moved to... * gimple-iterator.cc: ...here. * gimple-laddress.c: Moved to... * gimple-laddress.cc: ...here. * gimple-loop-jam.c: Moved to... * gimple-loop-jam.cc: ...here. * gimple-low.c: Moved to... * gimple-low.cc: ...here. * gimple-match-head.c: Moved to... * gimple-match-head.cc: ...here. * gimple-pretty-print.c: Moved to... * gimple-pretty-print.cc: ...here. * gimple-ssa-backprop.c: Moved to... * gimple-ssa-backprop.cc: ...here. * gimple-ssa-evrp-analyze.c: Moved to... * gimple-ssa-evrp-analyze.cc: ...here. * gimple-ssa-evrp.c: Moved to... * gimple-ssa-evrp.cc: ...here. * gimple-ssa-isolate-paths.c: Moved to... * gimple-ssa-isolate-paths.cc: ...here. * gimple-ssa-nonnull-compare.c: Moved to... * gimple-ssa-nonnull-compare.cc: ...here. * gimple-ssa-split-paths.c: Moved to... * gimple-ssa-split-paths.cc: ...here. * gimple-ssa-sprintf.c: Moved to... * gimple-ssa-sprintf.cc: ...here. * gimple-ssa-store-merging.c: Moved to... * gimple-ssa-store-merging.cc: ...here. * gimple-ssa-strength-reduction.c: Moved to... * gimple-ssa-strength-reduction.cc: ...here. * gimple-ssa-warn-alloca.c: Moved to... * gimple-ssa-warn-alloca.cc: ...here. * gimple-ssa-warn-restrict.c: Moved to... * gimple-ssa-warn-restrict.cc: ...here. * gimple-streamer-in.c: Moved to... * gimple-streamer-in.cc: ...here. * gimple-streamer-out.c: Moved to... * gimple-streamer-out.cc: ...here. * gimple-walk.c: Moved to... * gimple-walk.cc: ...here. * gimple-warn-recursion.c: Moved to... * gimple-warn-recursion.cc: ...here. * gimple.c: Moved to... * gimple.cc: ...here. * gimplify-me.c: Moved to... * gimplify-me.cc: ...here. * gimplify.c: Moved to... * gimplify.cc: ...here. * godump.c: Moved to... * godump.cc: ...here. * graph.c: Moved to... * graph.cc: ...here. * graphds.c: Moved to... * graphds.cc: ...here. * graphite-dependences.c: Moved to... * graphite-dependences.cc: ...here. * graphite-isl-ast-to-gimple.c: Moved to... * graphite-isl-ast-to-gimple.cc: ...here. * graphite-optimize-isl.c: Moved to... * graphite-optimize-isl.cc: ...here. * graphite-poly.c: Moved to... * graphite-poly.cc: ...here. * graphite-scop-detection.c: Moved to... * graphite-scop-detection.cc: ...here. * graphite-sese-to-poly.c: Moved to... * graphite-sese-to-poly.cc: ...here. * graphite.c: Moved to... * graphite.cc: ...here. * haifa-sched.c: Moved to... * haifa-sched.cc: ...here. * hash-map-tests.c: Moved to... * hash-map-tests.cc: ...here. * hash-set-tests.c: Moved to... * hash-set-tests.cc: ...here. * hash-table.c: Moved to... * hash-table.cc: ...here. * hooks.c: Moved to... * hooks.cc: ...here. * host-default.c: Moved to... * host-default.cc: ...here. * hw-doloop.c: Moved to... * hw-doloop.cc: ...here. * hwint.c: Moved to... * hwint.cc: ...here. * ifcvt.c: Moved to... * ifcvt.cc: ...here. * inchash.c: Moved to... * inchash.cc: ...here. * incpath.c: Moved to... * incpath.cc: ...here. * init-regs.c: Moved to... * init-regs.cc: ...here. * input.c: Moved to... * input.cc: ...here. * internal-fn.c: Moved to... * internal-fn.cc: ...here. * intl.c: Moved to... * intl.cc: ...here. * ipa-comdats.c: Moved to... * ipa-comdats.cc: ...here. * ipa-cp.c: Moved to... * ipa-cp.cc: ...here. * ipa-devirt.c: Moved to... * ipa-devirt.cc: ...here. * ipa-fnsummary.c: Moved to... * ipa-fnsummary.cc: ...here. * ipa-icf-gimple.c: Moved to... * ipa-icf-gimple.cc: ...here. * ipa-icf.c: Moved to... * ipa-icf.cc: ...here. * ipa-inline-analysis.c: Moved to... * ipa-inline-analysis.cc: ...here. * ipa-inline-transform.c: Moved to... * ipa-inline-transform.cc: ...here. * ipa-inline.c: Moved to... * ipa-inline.cc: ...here. * ipa-modref-tree.c: Moved to... * ipa-modref-tree.cc: ...here. * ipa-modref.c: Moved to... * ipa-modref.cc: ...here. * ipa-param-manipulation.c: Moved to... * ipa-param-manipulation.cc: ...here. * ipa-polymorphic-call.c: Moved to... * ipa-polymorphic-call.cc: ...here. * ipa-predicate.c: Moved to... * ipa-predicate.cc: ...here. * ipa-profile.c: Moved to... * ipa-profile.cc: ...here. * ipa-prop.c: Moved to... * ipa-prop.cc: ...here. * ipa-pure-const.c: Moved to... * ipa-pure-const.cc: ...here. * ipa-ref.c: Moved to... * ipa-ref.cc: ...here. * ipa-reference.c: Moved to... * ipa-reference.cc: ...here. * ipa-split.c: Moved to... * ipa-split.cc: ...here. * ipa-sra.c: Moved to... * ipa-sra.cc: ...here. * ipa-utils.c: Moved to... * ipa-utils.cc: ...here. * ipa-visibility.c: Moved to... * ipa-visibility.cc: ...here. * ipa.c: Moved to... * ipa.cc: ...here. * ira-build.c: Moved to... * ira-build.cc: ...here. * ira-color.c: Moved to... * ira-color.cc: ...here. * ira-conflicts.c: Moved to... * ira-conflicts.cc: ...here. * ira-costs.c: Moved to... * ira-costs.cc: ...here. * ira-emit.c: Moved to... * ira-emit.cc: ...here. * ira-lives.c: Moved to... * ira-lives.cc: ...here. * ira.c: Moved to... * ira.cc: ...here. * jump.c: Moved to... * jump.cc: ...here. * langhooks.c: Moved to... * langhooks.cc: ...here. * lcm.c: Moved to... * lcm.cc: ...here. * lists.c: Moved to... * lists.cc: ...here. * loop-doloop.c: Moved to... * loop-doloop.cc: ...here. * loop-init.c: Moved to... * loop-init.cc: ...here. * loop-invariant.c: Moved to... * loop-invariant.cc: ...here. * loop-iv.c: Moved to... * loop-iv.cc: ...here. * loop-unroll.c: Moved to... * loop-unroll.cc: ...here. * lower-subreg.c: Moved to... * lower-subreg.cc: ...here. * lra-assigns.c: Moved to... * lra-assigns.cc: ...here. * lra-coalesce.c: Moved to... * lra-coalesce.cc: ...here. * lra-constraints.c: Moved to... * lra-constraints.cc: ...here. * lra-eliminations.c: Moved to... * lra-eliminations.cc: ...here. * lra-lives.c: Moved to... * lra-lives.cc: ...here. * lra-remat.c: Moved to... * lra-remat.cc: ...here. * lra-spills.c: Moved to... * lra-spills.cc: ...here. * lra.c: Moved to... * lra.cc: ...here. * lto-cgraph.c: Moved to... * lto-cgraph.cc: ...here. * lto-compress.c: Moved to... * lto-compress.cc: ...here. * lto-opts.c: Moved to... * lto-opts.cc: ...here. * lto-section-in.c: Moved to... * lto-section-in.cc: ...here. * lto-section-out.c: Moved to... * lto-section-out.cc: ...here. * lto-streamer-in.c: Moved to... * lto-streamer-in.cc: ...here. * lto-streamer-out.c: Moved to... * lto-streamer-out.cc: ...here. * lto-streamer.c: Moved to... * lto-streamer.cc: ...here. * lto-wrapper.c: Moved to... * lto-wrapper.cc: ...here. * main.c: Moved to... * main.cc: ...here. * mcf.c: Moved to... * mcf.cc: ...here. * mode-switching.c: Moved to... * mode-switching.cc: ...here. * modulo-sched.c: Moved to... * modulo-sched.cc: ...here. * multiple_target.c: Moved to... * multiple_target.cc: ...here. * omp-expand.c: Moved to... * omp-expand.cc: ...here. * omp-general.c: Moved to... * omp-general.cc: ...here. * omp-low.c: Moved to... * omp-low.cc: ...here. * omp-offload.c: Moved to... * omp-offload.cc: ...here. * omp-simd-clone.c: Moved to... * omp-simd-clone.cc: ...here. * opt-suggestions.c: Moved to... * opt-suggestions.cc: ...here. * optabs-libfuncs.c: Moved to... * optabs-libfuncs.cc: ...here. * optabs-query.c: Moved to... * optabs-query.cc: ...here. * optabs-tree.c: Moved to... * optabs-tree.cc: ...here. * optabs.c: Moved to... * optabs.cc: ...here. * opts-common.c: Moved to... * opts-common.cc: ...here. * opts-global.c: Moved to... * opts-global.cc: ...here. * opts.c: Moved to... * opts.cc: ...here. * passes.c: Moved to... * passes.cc: ...here. * plugin.c: Moved to... * plugin.cc: ...here. * postreload-gcse.c: Moved to... * postreload-gcse.cc: ...here. * postreload.c: Moved to... * postreload.cc: ...here. * predict.c: Moved to... * predict.cc: ...here. * prefix.c: Moved to... * prefix.cc: ...here. * pretty-print.c: Moved to... * pretty-print.cc: ...here. * print-rtl-function.c: Moved to... * print-rtl-function.cc: ...here. * print-rtl.c: Moved to... * print-rtl.cc: ...here. * print-tree.c: Moved to... * print-tree.cc: ...here. * profile-count.c: Moved to... * profile-count.cc: ...here. * profile.c: Moved to... * profile.cc: ...here. * read-md.c: Moved to... * read-md.cc: ...here. * read-rtl-function.c: Moved to... * read-rtl-function.cc: ...here. * read-rtl.c: Moved to... * read-rtl.cc: ...here. * real.c: Moved to... * real.cc: ...here. * realmpfr.c: Moved to... * realmpfr.cc: ...here. * recog.c: Moved to... * recog.cc: ...here. * ree.c: Moved to... * ree.cc: ...here. * reg-stack.c: Moved to... * reg-stack.cc: ...here. * regcprop.c: Moved to... * regcprop.cc: ...here. * reginfo.c: Moved to... * reginfo.cc: ...here. * regrename.c: Moved to... * regrename.cc: ...here. * regstat.c: Moved to... * regstat.cc: ...here. * reload.c: Moved to... * reload.cc: ...here. * reload1.c: Moved to... * reload1.cc: ...here. * reorg.c: Moved to... * reorg.cc: ...here. * resource.c: Moved to... * resource.cc: ...here. * rtl-error.c: Moved to... * rtl-error.cc: ...here. * rtl-tests.c: Moved to... * rtl-tests.cc: ...here. * rtl.c: Moved to... * rtl.cc: ...here. * rtlanal.c: Moved to... * rtlanal.cc: ...here. * rtlhash.c: Moved to... * rtlhash.cc: ...here. * rtlhooks.c: Moved to... * rtlhooks.cc: ...here. * rtx-vector-builder.c: Moved to... * rtx-vector-builder.cc: ...here. * run-rtl-passes.c: Moved to... * run-rtl-passes.cc: ...here. * sancov.c: Moved to... * sancov.cc: ...here. * sanopt.c: Moved to... * sanopt.cc: ...here. * sbitmap.c: Moved to... * sbitmap.cc: ...here. * sched-deps.c: Moved to... * sched-deps.cc: ...here. * sched-ebb.c: Moved to... * sched-ebb.cc: ...here. * sched-rgn.c: Moved to... * sched-rgn.cc: ...here. * sel-sched-dump.c: Moved to... * sel-sched-dump.cc: ...here. * sel-sched-ir.c: Moved to... * sel-sched-ir.cc: ...here. * sel-sched.c: Moved to... * sel-sched.cc: ...here. * selftest-diagnostic.c: Moved to... * selftest-diagnostic.cc: ...here. * selftest-rtl.c: Moved to... * selftest-rtl.cc: ...here. * selftest-run-tests.c: Moved to... * selftest-run-tests.cc: ...here. * selftest.c: Moved to... * selftest.cc: ...here. * sese.c: Moved to... * sese.cc: ...here. * shrink-wrap.c: Moved to... * shrink-wrap.cc: ...here. * simplify-rtx.c: Moved to... * simplify-rtx.cc: ...here. * sparseset.c: Moved to... * sparseset.cc: ...here. * spellcheck-tree.c: Moved to... * spellcheck-tree.cc: ...here. * spellcheck.c: Moved to... * spellcheck.cc: ...here. * sreal.c: Moved to... * sreal.cc: ...here. * stack-ptr-mod.c: Moved to... * stack-ptr-mod.cc: ...here. * statistics.c: Moved to... * statistics.cc: ...here. * stmt.c: Moved to... * stmt.cc: ...here. * stor-layout.c: Moved to... * stor-layout.cc: ...here. * store-motion.c: Moved to... * store-motion.cc: ...here. * streamer-hooks.c: Moved to... * streamer-hooks.cc: ...here. * stringpool.c: Moved to... * stringpool.cc: ...here. * substring-locations.c: Moved to... * substring-locations.cc: ...here. * symtab.c: Moved to... * symtab.cc: ...here. * target-globals.c: Moved to... * target-globals.cc: ...here. * targhooks.c: Moved to... * targhooks.cc: ...here. * timevar.c: Moved to... * timevar.cc: ...here. * toplev.c: Moved to... * toplev.cc: ...here. * tracer.c: Moved to... * tracer.cc: ...here. * trans-mem.c: Moved to... * trans-mem.cc: ...here. * tree-affine.c: Moved to... * tree-affine.cc: ...here. * tree-call-cdce.c: Moved to... * tree-call-cdce.cc: ...here. * tree-cfg.c: Moved to... * tree-cfg.cc: ...here. * tree-cfgcleanup.c: Moved to... * tree-cfgcleanup.cc: ...here. * tree-chrec.c: Moved to... * tree-chrec.cc: ...here. * tree-complex.c: Moved to... * tree-complex.cc: ...here. * tree-data-ref.c: Moved to... * tree-data-ref.cc: ...here. * tree-dfa.c: Moved to... * tree-dfa.cc: ...here. * tree-diagnostic.c: Moved to... * tree-diagnostic.cc: ...here. * tree-dump.c: Moved to... * tree-dump.cc: ...here. * tree-eh.c: Moved to... * tree-eh.cc: ...here. * tree-emutls.c: Moved to... * tree-emutls.cc: ...here. * tree-if-conv.c: Moved to... * tree-if-conv.cc: ...here. * tree-inline.c: Moved to... * tree-inline.cc: ...here. * tree-into-ssa.c: Moved to... * tree-into-ssa.cc: ...here. * tree-iterator.c: Moved to... * tree-iterator.cc: ...here. * tree-loop-distribution.c: Moved to... * tree-loop-distribution.cc: ...here. * tree-nested.c: Moved to... * tree-nested.cc: ...here. * tree-nrv.c: Moved to... * tree-nrv.cc: ...here. * tree-object-size.c: Moved to... * tree-object-size.cc: ...here. * tree-outof-ssa.c: Moved to... * tree-outof-ssa.cc: ...here. * tree-parloops.c: Moved to... * tree-parloops.cc: ...here. * tree-phinodes.c: Moved to... * tree-phinodes.cc: ...here. * tree-predcom.c: Moved to... * tree-predcom.cc: ...here. * tree-pretty-print.c: Moved to... * tree-pretty-print.cc: ...here. * tree-profile.c: Moved to... * tree-profile.cc: ...here. * tree-scalar-evolution.c: Moved to... * tree-scalar-evolution.cc: ...here. * tree-sra.c: Moved to... * tree-sra.cc: ...here. * tree-ssa-address.c: Moved to... * tree-ssa-address.cc: ...here. * tree-ssa-alias.c: Moved to... * tree-ssa-alias.cc: ...here. * tree-ssa-ccp.c: Moved to... * tree-ssa-ccp.cc: ...here. * tree-ssa-coalesce.c: Moved to... * tree-ssa-coalesce.cc: ...here. * tree-ssa-copy.c: Moved to... * tree-ssa-copy.cc: ...here. * tree-ssa-dce.c: Moved to... * tree-ssa-dce.cc: ...here. * tree-ssa-dom.c: Moved to... * tree-ssa-dom.cc: ...here. * tree-ssa-dse.c: Moved to... * tree-ssa-dse.cc: ...here. * tree-ssa-forwprop.c: Moved to... * tree-ssa-forwprop.cc: ...here. * tree-ssa-ifcombine.c: Moved to... * tree-ssa-ifcombine.cc: ...here. * tree-ssa-live.c: Moved to... * tree-ssa-live.cc: ...here. * tree-ssa-loop-ch.c: Moved to... * tree-ssa-loop-ch.cc: ...here. * tree-ssa-loop-im.c: Moved to... * tree-ssa-loop-im.cc: ...here. * tree-ssa-loop-ivcanon.c: Moved to... * tree-ssa-loop-ivcanon.cc: ...here. * tree-ssa-loop-ivopts.c: Moved to... * tree-ssa-loop-ivopts.cc: ...here. * tree-ssa-loop-manip.c: Moved to... * tree-ssa-loop-manip.cc: ...here. * tree-ssa-loop-niter.c: Moved to... * tree-ssa-loop-niter.cc: ...here. * tree-ssa-loop-prefetch.c: Moved to... * tree-ssa-loop-prefetch.cc: ...here. * tree-ssa-loop-split.c: Moved to... * tree-ssa-loop-split.cc: ...here. * tree-ssa-loop-unswitch.c: Moved to... * tree-ssa-loop-unswitch.cc: ...here. * tree-ssa-loop.c: Moved to... * tree-ssa-loop.cc: ...here. * tree-ssa-math-opts.c: Moved to... * tree-ssa-math-opts.cc: ...here. * tree-ssa-operands.c: Moved to... * tree-ssa-operands.cc: ...here. * tree-ssa-phiopt.c: Moved to... * tree-ssa-phiopt.cc: ...here. * tree-ssa-phiprop.c: Moved to... * tree-ssa-phiprop.cc: ...here. * tree-ssa-pre.c: Moved to... * tree-ssa-pre.cc: ...here. * tree-ssa-propagate.c: Moved to... * tree-ssa-propagate.cc: ...here. * tree-ssa-reassoc.c: Moved to... * tree-ssa-reassoc.cc: ...here. * tree-ssa-sccvn.c: Moved to... * tree-ssa-sccvn.cc: ...here. * tree-ssa-scopedtables.c: Moved to... * tree-ssa-scopedtables.cc: ...here. * tree-ssa-sink.c: Moved to... * tree-ssa-sink.cc: ...here. * tree-ssa-strlen.c: Moved to... * tree-ssa-strlen.cc: ...here. * tree-ssa-structalias.c: Moved to... * tree-ssa-structalias.cc: ...here. * tree-ssa-tail-merge.c: Moved to... * tree-ssa-tail-merge.cc: ...here. * tree-ssa-ter.c: Moved to... * tree-ssa-ter.cc: ...here. * tree-ssa-threadbackward.c: Moved to... * tree-ssa-threadbackward.cc: ...here. * tree-ssa-threadedge.c: Moved to... * tree-ssa-threadedge.cc: ...here. * tree-ssa-threadupdate.c: Moved to... * tree-ssa-threadupdate.cc: ...here. * tree-ssa-uncprop.c: Moved to... * tree-ssa-uncprop.cc: ...here. * tree-ssa-uninit.c: Moved to... * tree-ssa-uninit.cc: ...here. * tree-ssa.c: Moved to... * tree-ssa.cc: ...here. * tree-ssanames.c: Moved to... * tree-ssanames.cc: ...here. * tree-stdarg.c: Moved to... * tree-stdarg.cc: ...here. * tree-streamer-in.c: Moved to... * tree-streamer-in.cc: ...here. * tree-streamer-out.c: Moved to... * tree-streamer-out.cc: ...here. * tree-streamer.c: Moved to... * tree-streamer.cc: ...here. * tree-switch-conversion.c: Moved to... * tree-switch-conversion.cc: ...here. * tree-tailcall.c: Moved to... * tree-tailcall.cc: ...here. * tree-vect-data-refs.c: Moved to... * tree-vect-data-refs.cc: ...here. * tree-vect-generic.c: Moved to... * tree-vect-generic.cc: ...here. * tree-vect-loop-manip.c: Moved to... * tree-vect-loop-manip.cc: ...here. * tree-vect-loop.c: Moved to... * tree-vect-loop.cc: ...here. * tree-vect-patterns.c: Moved to... * tree-vect-patterns.cc: ...here. * tree-vect-slp-patterns.c: Moved to... * tree-vect-slp-patterns.cc: ...here. * tree-vect-slp.c: Moved to... * tree-vect-slp.cc: ...here. * tree-vect-stmts.c: Moved to... * tree-vect-stmts.cc: ...here. * tree-vector-builder.c: Moved to... * tree-vector-builder.cc: ...here. * tree-vectorizer.c: Moved to... * tree-vectorizer.cc: ...here. * tree-vrp.c: Moved to... * tree-vrp.cc: ...here. * tree.c: Moved to... * tree.cc: ...here. * tsan.c: Moved to... * tsan.cc: ...here. * typed-splay-tree.c: Moved to... * typed-splay-tree.cc: ...here. * ubsan.c: Moved to... * ubsan.cc: ...here. * valtrack.c: Moved to... * valtrack.cc: ...here. * value-prof.c: Moved to... * value-prof.cc: ...here. * var-tracking.c: Moved to... * var-tracking.cc: ...here. * varasm.c: Moved to... * varasm.cc: ...here. * varpool.c: Moved to... * varpool.cc: ...here. * vec-perm-indices.c: Moved to... * vec-perm-indices.cc: ...here. * vec.c: Moved to... * vec.cc: ...here. * vmsdbgout.c: Moved to... * vmsdbgout.cc: ...here. * vr-values.c: Moved to... * vr-values.cc: ...here. * vtable-verify.c: Moved to... * vtable-verify.cc: ...here. * web.c: Moved to... * web.cc: ...here. * xcoffout.c: Moved to... * xcoffout.cc: ...here. gcc/c-family/ChangeLog: * c-ada-spec.c: Moved to... * c-ada-spec.cc: ...here. * c-attribs.c: Moved to... * c-attribs.cc: ...here. * c-common.c: Moved to... * c-common.cc: ...here. * c-cppbuiltin.c: Moved to... * c-cppbuiltin.cc: ...here. * c-dump.c: Moved to... * c-dump.cc: ...here. * c-format.c: Moved to... * c-format.cc: ...here. * c-gimplify.c: Moved to... * c-gimplify.cc: ...here. * c-indentation.c: Moved to... * c-indentation.cc: ...here. * c-lex.c: Moved to... * c-lex.cc: ...here. * c-omp.c: Moved to... * c-omp.cc: ...here. * c-opts.c: Moved to... * c-opts.cc: ...here. * c-pch.c: Moved to... * c-pch.cc: ...here. * c-ppoutput.c: Moved to... * c-ppoutput.cc: ...here. * c-pragma.c: Moved to... * c-pragma.cc: ...here. * c-pretty-print.c: Moved to... * c-pretty-print.cc: ...here. * c-semantics.c: Moved to... * c-semantics.cc: ...here. * c-ubsan.c: Moved to... * c-ubsan.cc: ...here. * c-warn.c: Moved to... * c-warn.cc: ...here. * cppspec.c: Moved to... * cppspec.cc: ...here. * stub-objc.c: Moved to... * stub-objc.cc: ...here. gcc/c/ChangeLog: * c-aux-info.c: Moved to... * c-aux-info.cc: ...here. * c-convert.c: Moved to... * c-convert.cc: ...here. * c-decl.c: Moved to... * c-decl.cc: ...here. * c-errors.c: Moved to... * c-errors.cc: ...here. * c-fold.c: Moved to... * c-fold.cc: ...here. * c-lang.c: Moved to... * c-lang.cc: ...here. * c-objc-common.c: Moved to... * c-objc-common.cc: ...here. * c-parser.c: Moved to... * c-parser.cc: ...here. * c-typeck.c: Moved to... * c-typeck.cc: ...here. * gccspec.c: Moved to... * gccspec.cc: ...here. * gimple-parser.c: Moved to... * gimple-parser.cc: ...here. gcc/cp/ChangeLog: * call.c: Moved to... * call.cc: ...here. * class.c: Moved to... * class.cc: ...here. * constexpr.c: Moved to... * constexpr.cc: ...here. * cp-gimplify.c: Moved to... * cp-gimplify.cc: ...here. * cp-lang.c: Moved to... * cp-lang.cc: ...here. * cp-objcp-common.c: Moved to... * cp-objcp-common.cc: ...here. * cp-ubsan.c: Moved to... * cp-ubsan.cc: ...here. * cvt.c: Moved to... * cvt.cc: ...here. * cxx-pretty-print.c: Moved to... * cxx-pretty-print.cc: ...here. * decl.c: Moved to... * decl.cc: ...here. * decl2.c: Moved to... * decl2.cc: ...here. * dump.c: Moved to... * dump.cc: ...here. * error.c: Moved to... * error.cc: ...here. * except.c: Moved to... * except.cc: ...here. * expr.c: Moved to... * expr.cc: ...here. * friend.c: Moved to... * friend.cc: ...here. * g++spec.c: Moved to... * g++spec.cc: ...here. * init.c: Moved to... * init.cc: ...here. * lambda.c: Moved to... * lambda.cc: ...here. * lex.c: Moved to... * lex.cc: ...here. * mangle.c: Moved to... * mangle.cc: ...here. * method.c: Moved to... * method.cc: ...here. * name-lookup.c: Moved to... * name-lookup.cc: ...here. * optimize.c: Moved to... * optimize.cc: ...here. * parser.c: Moved to... * parser.cc: ...here. * pt.c: Moved to... * pt.cc: ...here. * ptree.c: Moved to... * ptree.cc: ...here. * rtti.c: Moved to... * rtti.cc: ...here. * search.c: Moved to... * search.cc: ...here. * semantics.c: Moved to... * semantics.cc: ...here. * tree.c: Moved to... * tree.cc: ...here. * typeck.c: Moved to... * typeck.cc: ...here. * typeck2.c: Moved to... * typeck2.cc: ...here. * vtable-class-hierarchy.c: Moved to... * vtable-class-hierarchy.cc: ...here. gcc/fortran/ChangeLog: * arith.c: Moved to... * arith.cc: ...here. * array.c: Moved to... * array.cc: ...here. * bbt.c: Moved to... * bbt.cc: ...here. * check.c: Moved to... * check.cc: ...here. * class.c: Moved to... * class.cc: ...here. * constructor.c: Moved to... * constructor.cc: ...here. * convert.c: Moved to... * convert.cc: ...here. * cpp.c: Moved to... * cpp.cc: ...here. * data.c: Moved to... * data.cc: ...here. * decl.c: Moved to... * decl.cc: ...here. * dependency.c: Moved to... * dependency.cc: ...here. * dump-parse-tree.c: Moved to... * dump-parse-tree.cc: ...here. * error.c: Moved to... * error.cc: ...here. * expr.c: Moved to... * expr.cc: ...here. * f95-lang.c: Moved to... * f95-lang.cc: ...here. * frontend-passes.c: Moved to... * frontend-passes.cc: ...here. * gfortranspec.c: Moved to... * gfortranspec.cc: ...here. * interface.c: Moved to... * interface.cc: ...here. * intrinsic.c: Moved to... * intrinsic.cc: ...here. * io.c: Moved to... * io.cc: ...here. * iresolve.c: Moved to... * iresolve.cc: ...here. * match.c: Moved to... * match.cc: ...here. * matchexp.c: Moved to... * matchexp.cc: ...here. * misc.c: Moved to... * misc.cc: ...here. * module.c: Moved to... * module.cc: ...here. * openmp.c: Moved to... * openmp.cc: ...here. * options.c: Moved to... * options.cc: ...here. * parse.c: Moved to... * parse.cc: ...here. * primary.c: Moved to... * primary.cc: ...here. * resolve.c: Moved to... * resolve.cc: ...here. * scanner.c: Moved to... * scanner.cc: ...here. * simplify.c: Moved to... * simplify.cc: ...here. * st.c: Moved to... * st.cc: ...here. * symbol.c: Moved to... * symbol.cc: ...here. * target-memory.c: Moved to... * target-memory.cc: ...here. * trans-array.c: Moved to... * trans-array.cc: ...here. * trans-common.c: Moved to... * trans-common.cc: ...here. * trans-const.c: Moved to... * trans-const.cc: ...here. * trans-decl.c: Moved to... * trans-decl.cc: ...here. * trans-expr.c: Moved to... * trans-expr.cc: ...here. * trans-intrinsic.c: Moved to... * trans-intrinsic.cc: ...here. * trans-io.c: Moved to... * trans-io.cc: ...here. * trans-openmp.c: Moved to... * trans-openmp.cc: ...here. * trans-stmt.c: Moved to... * trans-stmt.cc: ...here. * trans-types.c: Moved to... * trans-types.cc: ...here. * trans.c: Moved to... * trans.cc: ...here. gcc/go/ChangeLog: * go-backend.c: Moved to... * go-backend.cc: ...here. * go-lang.c: Moved to... * go-lang.cc: ...here. * gospec.c: Moved to... * gospec.cc: ...here. gcc/jit/ChangeLog: * dummy-frontend.c: Moved to... * dummy-frontend.cc: ...here. * jit-builtins.c: Moved to... * jit-builtins.cc: ...here. * jit-logging.c: Moved to... * jit-logging.cc: ...here. * jit-playback.c: Moved to... * jit-playback.cc: ...here. * jit-recording.c: Moved to... * jit-recording.cc: ...here. * jit-result.c: Moved to... * jit-result.cc: ...here. * jit-spec.c: Moved to... * jit-spec.cc: ...here. * jit-tempdir.c: Moved to... * jit-tempdir.cc: ...here. * jit-w32.c: Moved to... * jit-w32.cc: ...here. * libgccjit.c: Moved to... * libgccjit.cc: ...here. gcc/lto/ChangeLog: * common.c: Moved to... * common.cc: ...here. * lto-common.c: Moved to... * lto-common.cc: ...here. * lto-dump.c: Moved to... * lto-dump.cc: ...here. * lto-lang.c: Moved to... * lto-lang.cc: ...here. * lto-object.c: Moved to... * lto-object.cc: ...here. * lto-partition.c: Moved to... * lto-partition.cc: ...here. * lto-symtab.c: Moved to... * lto-symtab.cc: ...here. * lto.c: Moved to... * lto.cc: ...here. gcc/objc/ChangeLog: * objc-act.c: Moved to... * objc-act.cc: ...here. * objc-encoding.c: Moved to... * objc-encoding.cc: ...here. * objc-gnu-runtime-abi-01.c: Moved to... * objc-gnu-runtime-abi-01.cc: ...here. * objc-lang.c: Moved to... * objc-lang.cc: ...here. * objc-map.c: Moved to... * objc-map.cc: ...here. * objc-next-runtime-abi-01.c: Moved to... * objc-next-runtime-abi-01.cc: ...here. * objc-next-runtime-abi-02.c: Moved to... * objc-next-runtime-abi-02.cc: ...here. * objc-runtime-shared-support.c: Moved to... * objc-runtime-shared-support.cc: ...here. gcc/objcp/ChangeLog: * objcp-decl.c: Moved to... * objcp-decl.cc: ...here. * objcp-lang.c: Moved to... * objcp-lang.cc: ...here. libcpp/ChangeLog: * charset.c: Moved to... * charset.cc: ...here. * directives.c: Moved to... * directives.cc: ...here. * errors.c: Moved to... * errors.cc: ...here. * expr.c: Moved to... * expr.cc: ...here. * files.c: Moved to... * files.cc: ...here. * identifiers.c: Moved to... * identifiers.cc: ...here. * init.c: Moved to... * init.cc: ...here. * lex.c: Moved to... * lex.cc: ...here. * line-map.c: Moved to... * line-map.cc: ...here. * macro.c: Moved to... * macro.cc: ...here. * makeucnid.c: Moved to... * makeucnid.cc: ...here. * mkdeps.c: Moved to... * mkdeps.cc: ...here. * pch.c: Moved to... * pch.cc: ...here. * symtab.c: Moved to... * symtab.cc: ...here. * traditional.c: Moved to... * traditional.cc: ...here.
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c5589
1 files changed, 0 insertions, 5589 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
deleted file mode 100644
index 0fd881d..0000000
--- a/gcc/fortran/interface.c
+++ /dev/null
@@ -1,5589 +0,0 @@
-/* Deal with interfaces.
- Copyright (C) 2000-2022 Free Software Foundation, Inc.
- Contributed by Andy Vaught
-
-This file is part of GCC.
-
-GCC 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 3, or (at your option) any later
-version.
-
-GCC 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 GCC; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-
-/* Deal with interfaces. An explicit interface is represented as a
- singly linked list of formal argument structures attached to the
- relevant symbols. For an implicit interface, the arguments don't
- point to symbols. Explicit interfaces point to namespaces that
- contain the symbols within that interface.
-
- Implicit interfaces are linked together in a singly linked list
- along the next_if member of symbol nodes. Since a particular
- symbol can only have a single explicit interface, the symbol cannot
- be part of multiple lists and a single next-member suffices.
-
- This is not the case for general classes, though. An operator
- definition is independent of just about all other uses and has it's
- own head pointer.
-
- Nameless interfaces:
- Nameless interfaces create symbols with explicit interfaces within
- the current namespace. They are otherwise unlinked.
-
- Generic interfaces:
- The generic name points to a linked list of symbols. Each symbol
- has an explicit interface. Each explicit interface has its own
- namespace containing the arguments. Module procedures are symbols in
- which the interface is added later when the module procedure is parsed.
-
- User operators:
- User-defined operators are stored in a their own set of symtrees
- separate from regular symbols. The symtrees point to gfc_user_op
- structures which in turn head up a list of relevant interfaces.
-
- Extended intrinsics and assignment:
- The head of these interface lists are stored in the containing namespace.
-
- Implicit interfaces:
- An implicit interface is represented as a singly linked list of
- formal argument list structures that don't point to any symbol
- nodes -- they just contain types.
-
-
- When a subprogram is defined, the program unit's name points to an
- interface as usual, but the link to the namespace is NULL and the
- formal argument list points to symbols within the same namespace as
- the program unit name. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "options.h"
-#include "gfortran.h"
-#include "match.h"
-#include "arith.h"
-
-/* The current_interface structure holds information about the
- interface currently being parsed. This structure is saved and
- restored during recursive interfaces. */
-
-gfc_interface_info current_interface;
-
-
-/* Free a singly linked list of gfc_interface structures. */
-
-void
-gfc_free_interface (gfc_interface *intr)
-{
- gfc_interface *next;
-
- for (; intr; intr = next)
- {
- next = intr->next;
- free (intr);
- }
-}
-
-
-/* Change the operators unary plus and minus into binary plus and
- minus respectively, leaving the rest unchanged. */
-
-static gfc_intrinsic_op
-fold_unary_intrinsic (gfc_intrinsic_op op)
-{
- switch (op)
- {
- case INTRINSIC_UPLUS:
- op = INTRINSIC_PLUS;
- break;
- case INTRINSIC_UMINUS:
- op = INTRINSIC_MINUS;
- break;
- default:
- break;
- }
-
- return op;
-}
-
-
-/* Return the operator depending on the DTIO moded string. Note that
- these are not operators in the normal sense and so have been placed
- beyond GFC_INTRINSIC_END in gfortran.h:enum gfc_intrinsic_op. */
-
-static gfc_intrinsic_op
-dtio_op (char* mode)
-{
- if (strcmp (mode, "formatted") == 0)
- return INTRINSIC_FORMATTED;
- if (strcmp (mode, "unformatted") == 0)
- return INTRINSIC_UNFORMATTED;
- return INTRINSIC_NONE;
-}
-
-
-/* Match a generic specification. Depending on which type of
- interface is found, the 'name' or 'op' pointers may be set.
- This subroutine doesn't return MATCH_NO. */
-
-match
-gfc_match_generic_spec (interface_type *type,
- char *name,
- gfc_intrinsic_op *op)
-{
- char buffer[GFC_MAX_SYMBOL_LEN + 1];
- match m;
- gfc_intrinsic_op i;
-
- if (gfc_match (" assignment ( = )") == MATCH_YES)
- {
- *type = INTERFACE_INTRINSIC_OP;
- *op = INTRINSIC_ASSIGN;
- return MATCH_YES;
- }
-
- if (gfc_match (" operator ( %o )", &i) == MATCH_YES)
- { /* Operator i/f */
- *type = INTERFACE_INTRINSIC_OP;
- *op = fold_unary_intrinsic (i);
- return MATCH_YES;
- }
-
- *op = INTRINSIC_NONE;
- if (gfc_match (" operator ( ") == MATCH_YES)
- {
- m = gfc_match_defined_op_name (buffer, 1);
- if (m == MATCH_NO)
- goto syntax;
- if (m != MATCH_YES)
- return MATCH_ERROR;
-
- m = gfc_match_char (')');
- if (m == MATCH_NO)
- goto syntax;
- if (m != MATCH_YES)
- return MATCH_ERROR;
-
- strcpy (name, buffer);
- *type = INTERFACE_USER_OP;
- return MATCH_YES;
- }
-
- if (gfc_match (" read ( %n )", buffer) == MATCH_YES)
- {
- *op = dtio_op (buffer);
- if (*op == INTRINSIC_FORMATTED)
- {
- strcpy (name, gfc_code2string (dtio_procs, DTIO_RF));
- *type = INTERFACE_DTIO;
- }
- if (*op == INTRINSIC_UNFORMATTED)
- {
- strcpy (name, gfc_code2string (dtio_procs, DTIO_RUF));
- *type = INTERFACE_DTIO;
- }
- if (*op != INTRINSIC_NONE)
- return MATCH_YES;
- }
-
- if (gfc_match (" write ( %n )", buffer) == MATCH_YES)
- {
- *op = dtio_op (buffer);
- if (*op == INTRINSIC_FORMATTED)
- {
- strcpy (name, gfc_code2string (dtio_procs, DTIO_WF));
- *type = INTERFACE_DTIO;
- }
- if (*op == INTRINSIC_UNFORMATTED)
- {
- strcpy (name, gfc_code2string (dtio_procs, DTIO_WUF));
- *type = INTERFACE_DTIO;
- }
- if (*op != INTRINSIC_NONE)
- return MATCH_YES;
- }
-
- if (gfc_match_name (buffer) == MATCH_YES)
- {
- strcpy (name, buffer);
- *type = INTERFACE_GENERIC;
- return MATCH_YES;
- }
-
- *type = INTERFACE_NAMELESS;
- return MATCH_YES;
-
-syntax:
- gfc_error ("Syntax error in generic specification at %C");
- return MATCH_ERROR;
-}
-
-
-/* Match one of the five F95 forms of an interface statement. The
- matcher for the abstract interface follows. */
-
-match
-gfc_match_interface (void)
-{
- char name[GFC_MAX_SYMBOL_LEN + 1];
- interface_type type;
- gfc_symbol *sym;
- gfc_intrinsic_op op;
- match m;
-
- m = gfc_match_space ();
-
- if (gfc_match_generic_spec (&type, name, &op) == MATCH_ERROR)
- return MATCH_ERROR;
-
- /* If we're not looking at the end of the statement now, or if this
- is not a nameless interface but we did not see a space, punt. */
- if (gfc_match_eos () != MATCH_YES
- || (type != INTERFACE_NAMELESS && m != MATCH_YES))
- {
- gfc_error ("Syntax error: Trailing garbage in INTERFACE statement "
- "at %C");
- return MATCH_ERROR;
- }
-
- current_interface.type = type;
-
- switch (type)
- {
- case INTERFACE_DTIO:
- case INTERFACE_GENERIC:
- if (gfc_get_symbol (name, NULL, &sym))
- return MATCH_ERROR;
-
- if (!sym->attr.generic
- && !gfc_add_generic (&sym->attr, sym->name, NULL))
- return MATCH_ERROR;
-
- if (sym->attr.dummy)
- {
- gfc_error ("Dummy procedure %qs at %C cannot have a "
- "generic interface", sym->name);
- return MATCH_ERROR;
- }
-
- current_interface.sym = gfc_new_block = sym;
- break;
-
- case INTERFACE_USER_OP:
- current_interface.uop = gfc_get_uop (name);
- break;
-
- case INTERFACE_INTRINSIC_OP:
- current_interface.op = op;
- break;
-
- case INTERFACE_NAMELESS:
- case INTERFACE_ABSTRACT:
- break;
- }
-
- return MATCH_YES;
-}
-
-
-
-/* Match a F2003 abstract interface. */
-
-match
-gfc_match_abstract_interface (void)
-{
- match m;
-
- if (!gfc_notify_std (GFC_STD_F2003, "ABSTRACT INTERFACE at %C"))
- return MATCH_ERROR;
-
- m = gfc_match_eos ();
-
- if (m != MATCH_YES)
- {
- gfc_error ("Syntax error in ABSTRACT INTERFACE statement at %C");
- return MATCH_ERROR;
- }
-
- current_interface.type = INTERFACE_ABSTRACT;
-
- return m;
-}
-
-
-/* Match the different sort of generic-specs that can be present after
- the END INTERFACE itself. */
-
-match
-gfc_match_end_interface (void)
-{
- char name[GFC_MAX_SYMBOL_LEN + 1];
- interface_type type;
- gfc_intrinsic_op op;
- match m;
-
- m = gfc_match_space ();
-
- if (gfc_match_generic_spec (&type, name, &op) == MATCH_ERROR)
- return MATCH_ERROR;
-
- /* If we're not looking at the end of the statement now, or if this
- is not a nameless interface but we did not see a space, punt. */
- if (gfc_match_eos () != MATCH_YES
- || (type != INTERFACE_NAMELESS && m != MATCH_YES))
- {
- gfc_error ("Syntax error: Trailing garbage in END INTERFACE "
- "statement at %C");
- return MATCH_ERROR;
- }
-
- m = MATCH_YES;
-
- switch (current_interface.type)
- {
- case INTERFACE_NAMELESS:
- case INTERFACE_ABSTRACT:
- if (type != INTERFACE_NAMELESS)
- {
- gfc_error ("Expected a nameless interface at %C");
- m = MATCH_ERROR;
- }
-
- break;
-
- case INTERFACE_INTRINSIC_OP:
- if (type != current_interface.type || op != current_interface.op)
- {
-
- if (current_interface.op == INTRINSIC_ASSIGN)
- {
- m = MATCH_ERROR;
- gfc_error ("Expected %<END INTERFACE ASSIGNMENT (=)%> at %C");
- }
- else
- {
- const char *s1, *s2;
- s1 = gfc_op2string (current_interface.op);
- s2 = gfc_op2string (op);
-
- /* The following if-statements are used to enforce C1202
- from F2003. */
- if ((strcmp(s1, "==") == 0 && strcmp (s2, ".eq.") == 0)
- || (strcmp(s1, ".eq.") == 0 && strcmp (s2, "==") == 0))
- break;
- if ((strcmp(s1, "/=") == 0 && strcmp (s2, ".ne.") == 0)
- || (strcmp(s1, ".ne.") == 0 && strcmp (s2, "/=") == 0))
- break;
- if ((strcmp(s1, "<=") == 0 && strcmp (s2, ".le.") == 0)
- || (strcmp(s1, ".le.") == 0 && strcmp (s2, "<=") == 0))
- break;
- if ((strcmp(s1, "<") == 0 && strcmp (s2, ".lt.") == 0)
- || (strcmp(s1, ".lt.") == 0 && strcmp (s2, "<") == 0))
- break;
- if ((strcmp(s1, ">=") == 0 && strcmp (s2, ".ge.") == 0)
- || (strcmp(s1, ".ge.") == 0 && strcmp (s2, ">=") == 0))
- break;
- if ((strcmp(s1, ">") == 0 && strcmp (s2, ".gt.") == 0)
- || (strcmp(s1, ".gt.") == 0 && strcmp (s2, ">") == 0))
- break;
-
- m = MATCH_ERROR;
- if (strcmp(s2, "none") == 0)
- gfc_error ("Expecting %<END INTERFACE OPERATOR (%s)%> "
- "at %C", s1);
- else
- gfc_error ("Expecting %<END INTERFACE OPERATOR (%s)%> at %C, "
- "but got %qs", s1, s2);
- }
-
- }
-
- break;
-
- case INTERFACE_USER_OP:
- /* Comparing the symbol node names is OK because only use-associated
- symbols can be renamed. */
- if (type != current_interface.type
- || strcmp (current_interface.uop->name, name) != 0)
- {
- gfc_error ("Expecting %<END INTERFACE OPERATOR (.%s.)%> at %C",
- current_interface.uop->name);
- m = MATCH_ERROR;
- }
-
- break;
-
- case INTERFACE_DTIO:
- case INTERFACE_GENERIC:
- if (type != current_interface.type
- || strcmp (current_interface.sym->name, name) != 0)
- {
- gfc_error ("Expecting %<END INTERFACE %s%> at %C",
- current_interface.sym->name);
- m = MATCH_ERROR;
- }
-
- break;
- }
-
- return m;
-}
-
-
-/* Return whether the component was defined anonymously. */
-
-static bool
-is_anonymous_component (gfc_component *cmp)
-{
- /* Only UNION and MAP components are anonymous. In the case of a MAP,
- the derived type symbol is FL_STRUCT and the component name looks like mM*.
- This is the only case in which the second character of a component name is
- uppercase. */
- return cmp->ts.type == BT_UNION
- || (cmp->ts.type == BT_DERIVED
- && cmp->ts.u.derived->attr.flavor == FL_STRUCT
- && cmp->name[0] && cmp->name[1] && ISUPPER (cmp->name[1]));
-}
-
-
-/* Return whether the derived type was defined anonymously. */
-
-static bool
-is_anonymous_dt (gfc_symbol *derived)
-{
- /* UNION and MAP types are always anonymous. Otherwise, only nested STRUCTURE
- types can be anonymous. For anonymous MAP/STRUCTURE, we have FL_STRUCT
- and the type name looks like XX*. This is the only case in which the
- second character of a type name is uppercase. */
- return derived->attr.flavor == FL_UNION
- || (derived->attr.flavor == FL_STRUCT
- && derived->name[0] && derived->name[1] && ISUPPER (derived->name[1]));
-}
-
-
-/* Compare components according to 4.4.2 of the Fortran standard. */
-
-static bool
-compare_components (gfc_component *cmp1, gfc_component *cmp2,
- gfc_symbol *derived1, gfc_symbol *derived2)
-{
- /* Compare names, but not for anonymous components such as UNION or MAP. */
- if (!is_anonymous_component (cmp1) && !is_anonymous_component (cmp2)
- && strcmp (cmp1->name, cmp2->name) != 0)
- return false;
-
- if (cmp1->attr.access != cmp2->attr.access)
- return false;
-
- if (cmp1->attr.pointer != cmp2->attr.pointer)
- return false;
-
- if (cmp1->attr.dimension != cmp2->attr.dimension)
- return false;
-
- if (cmp1->attr.allocatable != cmp2->attr.allocatable)
- return false;
-
- if (cmp1->attr.dimension && gfc_compare_array_spec (cmp1->as, cmp2->as) == 0)
- return false;
-
- if (cmp1->ts.type == BT_CHARACTER && cmp2->ts.type == BT_CHARACTER)
- {
- gfc_charlen *l1 = cmp1->ts.u.cl;
- gfc_charlen *l2 = cmp2->ts.u.cl;
- if (l1 && l2 && l1->length && l2->length
- && l1->length->expr_type == EXPR_CONSTANT
- && l2->length->expr_type == EXPR_CONSTANT
- && gfc_dep_compare_expr (l1->length, l2->length) != 0)
- return false;
- }
-
- /* Make sure that link lists do not put this function into an
- endless recursive loop! */
- if (!(cmp1->ts.type == BT_DERIVED && derived1 == cmp1->ts.u.derived)
- && !(cmp2->ts.type == BT_DERIVED && derived2 == cmp2->ts.u.derived)
- && !gfc_compare_types (&cmp1->ts, &cmp2->ts))
- return false;
-
- else if ( (cmp1->ts.type == BT_DERIVED && derived1 == cmp1->ts.u.derived)
- && !(cmp2->ts.type == BT_DERIVED && derived2 == cmp2->ts.u.derived))
- return false;
-
- else if (!(cmp1->ts.type == BT_DERIVED && derived1 == cmp1->ts.u.derived)
- && (cmp2->ts.type == BT_DERIVED && derived2 == cmp2->ts.u.derived))
- return false;
-
- return true;
-}
-
-
-/* Compare two union types by comparing the components of their maps.
- Because unions and maps are anonymous their types get special internal
- names; therefore the usual derived type comparison will fail on them.
-
- Returns nonzero if equal, as with gfc_compare_derived_types. Also as with
- gfc_compare_derived_types, 'equal' is closer to meaning 'duplicate
- definitions' than 'equivalent structure'. */
-
-static bool
-compare_union_types (gfc_symbol *un1, gfc_symbol *un2)
-{
- gfc_component *map1, *map2, *cmp1, *cmp2;
- gfc_symbol *map1_t, *map2_t;
-
- if (un1->attr.flavor != FL_UNION || un2->attr.flavor != FL_UNION)
- return false;
-
- if (un1->attr.zero_comp != un2->attr.zero_comp)
- return false;
-
- if (un1->attr.zero_comp)
- return true;
-
- map1 = un1->components;
- map2 = un2->components;
-
- /* In terms of 'equality' here we are worried about types which are
- declared the same in two places, not types that represent equivalent
- structures. (This is common because of FORTRAN's weird scoping rules.)
- Though two unions with their maps in different orders could be equivalent,
- we will say they are not equal for the purposes of this test; therefore
- we compare the maps sequentially. */
- for (;;)
- {
- map1_t = map1->ts.u.derived;
- map2_t = map2->ts.u.derived;
-
- cmp1 = map1_t->components;
- cmp2 = map2_t->components;
-
- /* Protect against null components. */
- if (map1_t->attr.zero_comp != map2_t->attr.zero_comp)
- return false;
-
- if (map1_t->attr.zero_comp)
- return true;
-
- for (;;)
- {
- /* No two fields will ever point to the same map type unless they are
- the same component, because one map field is created with its type
- declaration. Therefore don't worry about recursion here. */
- /* TODO: worry about recursion into parent types of the unions? */
- if (!compare_components (cmp1, cmp2, map1_t, map2_t))
- return false;
-
- cmp1 = cmp1->next;
- cmp2 = cmp2->next;
-
- if (cmp1 == NULL && cmp2 == NULL)
- break;
- if (cmp1 == NULL || cmp2 == NULL)
- return false;
- }
-
- map1 = map1->next;
- map2 = map2->next;
-
- if (map1 == NULL && map2 == NULL)
- break;
- if (map1 == NULL || map2 == NULL)
- return false;
- }
-
- return true;
-}
-
-
-
-/* Compare two derived types using the criteria in 4.4.2 of the standard,
- recursing through gfc_compare_types for the components. */
-
-bool
-gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
-{
- gfc_component *cmp1, *cmp2;
-
- if (derived1 == derived2)
- return true;
-
- if (!derived1 || !derived2)
- gfc_internal_error ("gfc_compare_derived_types: invalid derived type");
-
- /* Compare UNION types specially. */
- if (derived1->attr.flavor == FL_UNION || derived2->attr.flavor == FL_UNION)
- return compare_union_types (derived1, derived2);
-
- /* Special case for comparing derived types across namespaces. If the
- true names and module names are the same and the module name is
- nonnull, then they are equal. */
- if (strcmp (derived1->name, derived2->name) == 0
- && derived1->module != NULL && derived2->module != NULL
- && strcmp (derived1->module, derived2->module) == 0)
- return true;
-
- /* Compare type via the rules of the standard. Both types must have
- the SEQUENCE or BIND(C) attribute to be equal. STRUCTUREs are special
- because they can be anonymous; therefore two structures with different
- names may be equal. */
-
- /* Compare names, but not for anonymous types such as UNION or MAP. */
- if (!is_anonymous_dt (derived1) && !is_anonymous_dt (derived2)
- && strcmp (derived1->name, derived2->name) != 0)
- return false;
-
- if (derived1->component_access == ACCESS_PRIVATE
- || derived2->component_access == ACCESS_PRIVATE)
- return false;
-
- if (!(derived1->attr.sequence && derived2->attr.sequence)
- && !(derived1->attr.is_bind_c && derived2->attr.is_bind_c)
- && !(derived1->attr.pdt_type && derived2->attr.pdt_type))
- return false;
-
- /* Protect against null components. */
- if (derived1->attr.zero_comp != derived2->attr.zero_comp)
- return false;
-
- if (derived1->attr.zero_comp)
- return true;
-
- cmp1 = derived1->components;
- cmp2 = derived2->components;
-
- /* Since subtypes of SEQUENCE types must be SEQUENCE types as well, a
- simple test can speed things up. Otherwise, lots of things have to
- match. */
- for (;;)
- {
- if (!compare_components (cmp1, cmp2, derived1, derived2))
- return false;
-
- cmp1 = cmp1->next;
- cmp2 = cmp2->next;
-
- if (cmp1 == NULL && cmp2 == NULL)
- break;
- if (cmp1 == NULL || cmp2 == NULL)
- return false;
- }
-
- return true;
-}
-
-
-/* Compare two typespecs, recursively if necessary. */
-
-bool
-gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2)
-{
- /* See if one of the typespecs is a BT_VOID, which is what is being used
- to allow the funcs like c_f_pointer to accept any pointer type.
- TODO: Possibly should narrow this to just the one typespec coming in
- that is for the formal arg, but oh well. */
- if (ts1->type == BT_VOID || ts2->type == BT_VOID)
- return true;
-
- /* Special case for our C interop types. FIXME: There should be a
- better way of doing this. When ISO C binding is cleared up,
- this can probably be removed. See PR 57048. */
-
- if (((ts1->type == BT_INTEGER && ts2->type == BT_DERIVED)
- || (ts1->type == BT_DERIVED && ts2->type == BT_INTEGER))
- && ts1->u.derived && ts2->u.derived
- && ts1->u.derived == ts2->u.derived)
- return true;
-
- /* The _data component is not always present, therefore check for its
- presence before assuming, that its derived->attr is available.
- When the _data component is not present, then nevertheless the
- unlimited_polymorphic flag may be set in the derived type's attr. */
- if (ts1->type == BT_CLASS && ts1->u.derived->components
- && ((ts1->u.derived->attr.is_class
- && ts1->u.derived->components->ts.u.derived->attr
- .unlimited_polymorphic)
- || ts1->u.derived->attr.unlimited_polymorphic))
- return true;
-
- /* F2003: C717 */
- if (ts2->type == BT_CLASS && ts1->type == BT_DERIVED
- && ts2->u.derived->components
- && ((ts2->u.derived->attr.is_class
- && ts2->u.derived->components->ts.u.derived->attr
- .unlimited_polymorphic)
- || ts2->u.derived->attr.unlimited_polymorphic)
- && (ts1->u.derived->attr.sequence || ts1->u.derived->attr.is_bind_c))
- return true;
-
- if (ts1->type != ts2->type
- && ((ts1->type != BT_DERIVED && ts1->type != BT_CLASS)
- || (ts2->type != BT_DERIVED && ts2->type != BT_CLASS)))
- return false;
-
- if (ts1->type == BT_UNION)
- return compare_union_types (ts1->u.derived, ts2->u.derived);
-
- if (ts1->type != BT_DERIVED && ts1->type != BT_CLASS)
- return (ts1->kind == ts2->kind);
-
- /* Compare derived types. */
- return gfc_type_compatible (ts1, ts2);
-}
-
-
-static bool
-compare_type (gfc_symbol *s1, gfc_symbol *s2)
-{
- if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
- return true;
-
- return gfc_compare_types (&s1->ts, &s2->ts) || s2->ts.type == BT_ASSUMED;
-}
-
-
-static bool
-compare_type_characteristics (gfc_symbol *s1, gfc_symbol *s2)
-{
- /* TYPE and CLASS of the same declared type are type compatible,
- but have different characteristics. */
- if ((s1->ts.type == BT_CLASS && s2->ts.type == BT_DERIVED)
- || (s1->ts.type == BT_DERIVED && s2->ts.type == BT_CLASS))
- return false;
-
- return compare_type (s1, s2);
-}
-
-
-static bool
-compare_rank (gfc_symbol *s1, gfc_symbol *s2)
-{
- gfc_array_spec *as1, *as2;
- int r1, r2;
-
- if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
- return true;
-
- as1 = (s1->ts.type == BT_CLASS
- && !s1->ts.u.derived->attr.unlimited_polymorphic)
- ? CLASS_DATA (s1)->as : s1->as;
- as2 = (s2->ts.type == BT_CLASS
- && !s2->ts.u.derived->attr.unlimited_polymorphic)
- ? CLASS_DATA (s2)->as : s2->as;
-
- r1 = as1 ? as1->rank : 0;
- r2 = as2 ? as2->rank : 0;
-
- if (r1 != r2 && (!as2 || as2->type != AS_ASSUMED_RANK))
- return false; /* Ranks differ. */
-
- return true;
-}
-
-
-/* Given two symbols that are formal arguments, compare their ranks
- and types. Returns true if they have the same rank and type,
- false otherwise. */
-
-static bool
-compare_type_rank (gfc_symbol *s1, gfc_symbol *s2)
-{
- return compare_type (s1, s2) && compare_rank (s1, s2);
-}
-
-
-/* Given two symbols that are formal arguments, compare their types
- and rank and their formal interfaces if they are both dummy
- procedures. Returns true if the same, false if different. */
-
-static bool
-compare_type_rank_if (gfc_symbol *s1, gfc_symbol *s2)
-{
- if (s1 == NULL || s2 == NULL)
- return (s1 == s2);
-
- if (s1 == s2)
- return true;
-
- if (s1->attr.flavor != FL_PROCEDURE && s2->attr.flavor != FL_PROCEDURE)
- return compare_type_rank (s1, s2);
-
- if (s1->attr.flavor != FL_PROCEDURE || s2->attr.flavor != FL_PROCEDURE)
- return false;
-
- /* At this point, both symbols are procedures. It can happen that
- external procedures are compared, where one is identified by usage
- to be a function or subroutine but the other is not. Check TKR
- nonetheless for these cases. */
- if (s1->attr.function == 0 && s1->attr.subroutine == 0)
- return s1->attr.external ? compare_type_rank (s1, s2) : false;
-
- if (s2->attr.function == 0 && s2->attr.subroutine == 0)
- return s2->attr.external ? compare_type_rank (s1, s2) : false;
-
- /* Now the type of procedure has been identified. */
- if (s1->attr.function != s2->attr.function
- || s1->attr.subroutine != s2->attr.subroutine)
- return false;
-
- if (s1->attr.function && !compare_type_rank (s1, s2))
- return false;
-
- /* Originally, gfortran recursed here to check the interfaces of passed
- procedures. This is explicitly not required by the standard. */
- return true;
-}
-
-
-/* Given a formal argument list and a keyword name, search the list
- for that keyword. Returns the correct symbol node if found, NULL
- if not found. */
-
-static gfc_symbol *
-find_keyword_arg (const char *name, gfc_formal_arglist *f)
-{
- for (; f; f = f->next)
- if (strcmp (f->sym->name, name) == 0)
- return f->sym;
-
- return NULL;
-}
-
-
-/******** Interface checking subroutines **********/
-
-
-/* Given an operator interface and the operator, make sure that all
- interfaces for that operator are legal. */
-
-bool
-gfc_check_operator_interface (gfc_symbol *sym, gfc_intrinsic_op op,
- locus opwhere)
-{
- gfc_formal_arglist *formal;
- sym_intent i1, i2;
- bt t1, t2;
- int args, r1, r2, k1, k2;
-
- gcc_assert (sym);
-
- args = 0;
- t1 = t2 = BT_UNKNOWN;
- i1 = i2 = INTENT_UNKNOWN;
- r1 = r2 = -1;
- k1 = k2 = -1;
-
- for (formal = gfc_sym_get_dummy_args (sym); formal; formal = formal->next)
- {
- gfc_symbol *fsym = formal->sym;
- if (fsym == NULL)
- {
- gfc_error ("Alternate return cannot appear in operator "
- "interface at %L", &sym->declared_at);
- return false;
- }
- if (args == 0)
- {
- t1 = fsym->ts.type;
- i1 = fsym->attr.intent;
- r1 = (fsym->as != NULL) ? fsym->as->rank : 0;
- k1 = fsym->ts.kind;
- }
- if (args == 1)
- {
- t2 = fsym->ts.type;
- i2 = fsym->attr.intent;
- r2 = (fsym->as != NULL) ? fsym->as->rank : 0;
- k2 = fsym->ts.kind;
- }
- args++;
- }
-
- /* Only +, - and .not. can be unary operators.
- .not. cannot be a binary operator. */
- if (args == 0 || args > 2 || (args == 1 && op != INTRINSIC_PLUS
- && op != INTRINSIC_MINUS
- && op != INTRINSIC_NOT)
- || (args == 2 && op == INTRINSIC_NOT))
- {
- if (op == INTRINSIC_ASSIGN)
- gfc_error ("Assignment operator interface at %L must have "
- "two arguments", &sym->declared_at);
- else
- gfc_error ("Operator interface at %L has the wrong number of arguments",
- &sym->declared_at);
- return false;
- }
-
- /* Check that intrinsics are mapped to functions, except
- INTRINSIC_ASSIGN which should map to a subroutine. */
- if (op == INTRINSIC_ASSIGN)
- {
- gfc_formal_arglist *dummy_args;
-
- if (!sym->attr.subroutine)
- {
- gfc_error ("Assignment operator interface at %L must be "
- "a SUBROUTINE", &sym->declared_at);
- return false;
- }
-
- /* Allowed are (per F2003, 12.3.2.1.2 Defined assignments):
- - First argument an array with different rank than second,
- - First argument is a scalar and second an array,
- - Types and kinds do not conform, or
- - First argument is of derived type. */
- dummy_args = gfc_sym_get_dummy_args (sym);
- if (dummy_args->sym->ts.type != BT_DERIVED
- && dummy_args->sym->ts.type != BT_CLASS
- && (r2 == 0 || r1 == r2)
- && (dummy_args->sym->ts.type == dummy_args->next->sym->ts.type
- || (gfc_numeric_ts (&dummy_args->sym->ts)
- && gfc_numeric_ts (&dummy_args->next->sym->ts))))
- {
- gfc_error ("Assignment operator interface at %L must not redefine "
- "an INTRINSIC type assignment", &sym->declared_at);
- return false;
- }
- }
- else
- {
- if (!sym->attr.function)
- {
- gfc_error ("Intrinsic operator interface at %L must be a FUNCTION",
- &sym->declared_at);
- return false;
- }
- }
-
- /* Check intents on operator interfaces. */
- if (op == INTRINSIC_ASSIGN)
- {
- if (i1 != INTENT_OUT && i1 != INTENT_INOUT)
- {
- gfc_error ("First argument of defined assignment at %L must be "
- "INTENT(OUT) or INTENT(INOUT)", &sym->declared_at);
- return false;
- }
-
- if (i2 != INTENT_IN)
- {
- gfc_error ("Second argument of defined assignment at %L must be "
- "INTENT(IN)", &sym->declared_at);
- return false;
- }
- }
- else
- {
- if (i1 != INTENT_IN)
- {
- gfc_error ("First argument of operator interface at %L must be "
- "INTENT(IN)", &sym->declared_at);
- return false;
- }
-
- if (args == 2 && i2 != INTENT_IN)
- {
- gfc_error ("Second argument of operator interface at %L must be "
- "INTENT(IN)", &sym->declared_at);
- return false;
- }
- }
-
- /* From now on, all we have to do is check that the operator definition
- doesn't conflict with an intrinsic operator. The rules for this
- game are defined in 7.1.2 and 7.1.3 of both F95 and F2003 standards,
- as well as 12.3.2.1.1 of Fortran 2003:
-
- "If the operator is an intrinsic-operator (R310), the number of
- function arguments shall be consistent with the intrinsic uses of
- that operator, and the types, kind type parameters, or ranks of the
- dummy arguments shall differ from those required for the intrinsic
- operation (7.1.2)." */
-
-#define IS_NUMERIC_TYPE(t) \
- ((t) == BT_INTEGER || (t) == BT_REAL || (t) == BT_COMPLEX)
-
- /* Unary ops are easy, do them first. */
- if (op == INTRINSIC_NOT)
- {
- if (t1 == BT_LOGICAL)
- goto bad_repl;
- else
- return true;
- }
-
- if (args == 1 && (op == INTRINSIC_PLUS || op == INTRINSIC_MINUS))
- {
- if (IS_NUMERIC_TYPE (t1))
- goto bad_repl;
- else
- return true;
- }
-
- /* Character intrinsic operators have same character kind, thus
- operator definitions with operands of different character kinds
- are always safe. */
- if (t1 == BT_CHARACTER && t2 == BT_CHARACTER && k1 != k2)
- return true;
-
- /* Intrinsic operators always perform on arguments of same rank,
- so different ranks is also always safe. (rank == 0) is an exception
- to that, because all intrinsic operators are elemental. */
- if (r1 != r2 && r1 != 0 && r2 != 0)
- return true;
-
- switch (op)
- {
- case INTRINSIC_EQ:
- case INTRINSIC_EQ_OS:
- case INTRINSIC_NE:
- case INTRINSIC_NE_OS:
- if (t1 == BT_CHARACTER && t2 == BT_CHARACTER)
- goto bad_repl;
- /* Fall through. */
-
- case INTRINSIC_PLUS:
- case INTRINSIC_MINUS:
- case INTRINSIC_TIMES:
- case INTRINSIC_DIVIDE:
- case INTRINSIC_POWER:
- if (IS_NUMERIC_TYPE (t1) && IS_NUMERIC_TYPE (t2))
- goto bad_repl;
- break;
-
- case INTRINSIC_GT:
- case INTRINSIC_GT_OS:
- case INTRINSIC_GE:
- case INTRINSIC_GE_OS:
- case INTRINSIC_LT:
- case INTRINSIC_LT_OS:
- case INTRINSIC_LE:
- case INTRINSIC_LE_OS:
- if (t1 == BT_CHARACTER && t2 == BT_CHARACTER)
- goto bad_repl;
- if ((t1 == BT_INTEGER || t1 == BT_REAL)
- && (t2 == BT_INTEGER || t2 == BT_REAL))
- goto bad_repl;
- break;
-
- case INTRINSIC_CONCAT:
- if (t1 == BT_CHARACTER && t2 == BT_CHARACTER)
- goto bad_repl;
- break;
-
- case INTRINSIC_AND:
- case INTRINSIC_OR:
- case INTRINSIC_EQV:
- case INTRINSIC_NEQV:
- if (t1 == BT_LOGICAL && t2 == BT_LOGICAL)
- goto bad_repl;
- break;
-
- default:
- break;
- }
-
- return true;
-
-#undef IS_NUMERIC_TYPE
-
-bad_repl:
- gfc_error ("Operator interface at %L conflicts with intrinsic interface",
- &opwhere);
- return false;
-}
-
-
-/* Given a pair of formal argument lists, we see if the two lists can
- be distinguished by counting the number of nonoptional arguments of
- a given type/rank in f1 and seeing if there are less then that
- number of those arguments in f2 (including optional arguments).
- Since this test is asymmetric, it has to be called twice to make it
- symmetric. Returns nonzero if the argument lists are incompatible
- by this test. This subroutine implements rule 1 of section F03:16.2.3.
- 'p1' and 'p2' are the PASS arguments of both procedures (if applicable). */
-
-static bool
-count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
- const char *p1, const char *p2)
-{
- int ac1, ac2, i, j, k, n1;
- gfc_formal_arglist *f;
-
- typedef struct
- {
- int flag;
- gfc_symbol *sym;
- }
- arginfo;
-
- arginfo *arg;
-
- n1 = 0;
-
- for (f = f1; f; f = f->next)
- n1++;
-
- /* Build an array of integers that gives the same integer to
- arguments of the same type/rank. */
- arg = XCNEWVEC (arginfo, n1);
-
- f = f1;
- for (i = 0; i < n1; i++, f = f->next)
- {
- arg[i].flag = -1;
- arg[i].sym = f->sym;
- }
-
- k = 0;
-
- for (i = 0; i < n1; i++)
- {
- if (arg[i].flag != -1)
- continue;
-
- if (arg[i].sym && (arg[i].sym->attr.optional
- || (p1 && strcmp (arg[i].sym->name, p1) == 0)))
- continue; /* Skip OPTIONAL and PASS arguments. */
-
- arg[i].flag = k;
-
- /* Find other non-optional, non-pass arguments of the same type/rank. */
- for (j = i + 1; j < n1; j++)
- if ((arg[j].sym == NULL
- || !(arg[j].sym->attr.optional
- || (p1 && strcmp (arg[j].sym->name, p1) == 0)))
- && (compare_type_rank_if (arg[i].sym, arg[j].sym)
- || compare_type_rank_if (arg[j].sym, arg[i].sym)))
- arg[j].flag = k;
-
- k++;
- }
-
- /* Now loop over each distinct type found in f1. */
- k = 0;
- bool rc = false;
-
- for (i = 0; i < n1; i++)
- {
- if (arg[i].flag != k)
- continue;
-
- ac1 = 1;
- for (j = i + 1; j < n1; j++)
- if (arg[j].flag == k)
- ac1++;
-
- /* Count the number of non-pass arguments in f2 with that type,
- including those that are optional. */
- ac2 = 0;
-
- for (f = f2; f; f = f->next)
- if ((!p2 || strcmp (f->sym->name, p2) != 0)
- && (compare_type_rank_if (arg[i].sym, f->sym)
- || compare_type_rank_if (f->sym, arg[i].sym)))
- ac2++;
-
- if (ac1 > ac2)
- {
- rc = true;
- break;
- }
-
- k++;
- }
-
- free (arg);
-
- return rc;
-}
-
-
-/* Returns true if two dummy arguments are distinguishable due to their POINTER
- and ALLOCATABLE attributes according to F2018 section 15.4.3.4.5 (3).
- The function is asymmetric wrt to the arguments s1 and s2 and should always
- be called twice (with flipped arguments in the second call). */
-
-static bool
-compare_ptr_alloc(gfc_symbol *s1, gfc_symbol *s2)
-{
- /* Is s1 allocatable? */
- const bool a1 = s1->ts.type == BT_CLASS ?
- CLASS_DATA(s1)->attr.allocatable : s1->attr.allocatable;
- /* Is s2 a pointer? */
- const bool p2 = s2->ts.type == BT_CLASS ?
- CLASS_DATA(s2)->attr.class_pointer : s2->attr.pointer;
- return a1 && p2 && (s2->attr.intent != INTENT_IN);
-}
-
-
-/* Perform the correspondence test in rule (3) of F08:C1215.
- Returns zero if no argument is found that satisfies this rule,
- nonzero otherwise. 'p1' and 'p2' are the PASS arguments of both procedures
- (if applicable).
-
- This test is also not symmetric in f1 and f2 and must be called
- twice. This test finds problems caused by sorting the actual
- argument list with keywords. For example:
-
- INTERFACE FOO
- SUBROUTINE F1(A, B)
- INTEGER :: A ; REAL :: B
- END SUBROUTINE F1
-
- SUBROUTINE F2(B, A)
- INTEGER :: A ; REAL :: B
- END SUBROUTINE F1
- END INTERFACE FOO
-
- At this point, 'CALL FOO(A=1, B=1.0)' is ambiguous. */
-
-static bool
-generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
- const char *p1, const char *p2)
-{
- gfc_formal_arglist *f2_save, *g;
- gfc_symbol *sym;
-
- f2_save = f2;
-
- while (f1)
- {
- if (!f1->sym || f1->sym->attr.optional)
- goto next;
-
- if (p1 && strcmp (f1->sym->name, p1) == 0)
- f1 = f1->next;
- if (f2 && p2 && strcmp (f2->sym->name, p2) == 0)
- f2 = f2->next;
-
- if (f2 != NULL && (compare_type_rank (f1->sym, f2->sym)
- || compare_type_rank (f2->sym, f1->sym))
- && !((gfc_option.allow_std & GFC_STD_F2008)
- && (compare_ptr_alloc(f1->sym, f2->sym)
- || compare_ptr_alloc(f2->sym, f1->sym))))
- goto next;
-
- /* Now search for a disambiguating keyword argument starting at
- the current non-match. */
- for (g = f1; g; g = g->next)
- {
- if (g->sym->attr.optional || (p1 && strcmp (g->sym->name, p1) == 0))
- continue;
-
- sym = find_keyword_arg (g->sym->name, f2_save);
- if (sym == NULL || !compare_type_rank (g->sym, sym)
- || ((gfc_option.allow_std & GFC_STD_F2008)
- && (compare_ptr_alloc(sym, g->sym)
- || compare_ptr_alloc(g->sym, sym))))
- return true;
- }
-
- next:
- if (f1 != NULL)
- f1 = f1->next;
- if (f2 != NULL)
- f2 = f2->next;
- }
-
- return false;
-}
-
-
-static int
-symbol_rank (gfc_symbol *sym)
-{
- gfc_array_spec *as = NULL;
-
- if (sym->ts.type == BT_CLASS && CLASS_DATA (sym))
- as = CLASS_DATA (sym)->as;
- else
- as = sym->as;
-
- return as ? as->rank : 0;
-}
-
-
-/* Check if the characteristics of two dummy arguments match,
- cf. F08:12.3.2. */
-
-bool
-gfc_check_dummy_characteristics (gfc_symbol *s1, gfc_symbol *s2,
- bool type_must_agree, char *errmsg,
- int err_len)
-{
- if (s1 == NULL || s2 == NULL)
- return s1 == s2 ? true : false;
-
- /* Check type and rank. */
- if (type_must_agree)
- {
- if (!compare_type_characteristics (s1, s2)
- || !compare_type_characteristics (s2, s1))
- {
- snprintf (errmsg, err_len, "Type mismatch in argument '%s' (%s/%s)",
- s1->name, gfc_dummy_typename (&s1->ts),
- gfc_dummy_typename (&s2->ts));
- return false;
- }
- if (!compare_rank (s1, s2))
- {
- snprintf (errmsg, err_len, "Rank mismatch in argument '%s' (%i/%i)",
- s1->name, symbol_rank (s1), symbol_rank (s2));
- return false;
- }
- }
-
- /* Check INTENT. */
- if (s1->attr.intent != s2->attr.intent && !s1->attr.artificial
- && !s2->attr.artificial)
- {
- snprintf (errmsg, err_len, "INTENT mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- /* Check OPTIONAL attribute. */
- if (s1->attr.optional != s2->attr.optional)
- {
- snprintf (errmsg, err_len, "OPTIONAL mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- /* Check ALLOCATABLE attribute. */
- if (s1->attr.allocatable != s2->attr.allocatable)
- {
- snprintf (errmsg, err_len, "ALLOCATABLE mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- /* Check POINTER attribute. */
- if (s1->attr.pointer != s2->attr.pointer)
- {
- snprintf (errmsg, err_len, "POINTER mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- /* Check TARGET attribute. */
- if (s1->attr.target != s2->attr.target)
- {
- snprintf (errmsg, err_len, "TARGET mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- /* Check ASYNCHRONOUS attribute. */
- if (s1->attr.asynchronous != s2->attr.asynchronous)
- {
- snprintf (errmsg, err_len, "ASYNCHRONOUS mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- /* Check CONTIGUOUS attribute. */
- if (s1->attr.contiguous != s2->attr.contiguous)
- {
- snprintf (errmsg, err_len, "CONTIGUOUS mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- /* Check VALUE attribute. */
- if (s1->attr.value != s2->attr.value)
- {
- snprintf (errmsg, err_len, "VALUE mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- /* Check VOLATILE attribute. */
- if (s1->attr.volatile_ != s2->attr.volatile_)
- {
- snprintf (errmsg, err_len, "VOLATILE mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- /* Check interface of dummy procedures. */
- if (s1->attr.flavor == FL_PROCEDURE)
- {
- char err[200];
- if (!gfc_compare_interfaces (s1, s2, s2->name, 0, 1, err, sizeof(err),
- NULL, NULL))
- {
- snprintf (errmsg, err_len, "Interface mismatch in dummy procedure "
- "'%s': %s", s1->name, err);
- return false;
- }
- }
-
- /* Check string length. */
- if (s1->ts.type == BT_CHARACTER
- && s1->ts.u.cl && s1->ts.u.cl->length
- && s2->ts.u.cl && s2->ts.u.cl->length)
- {
- int compval = gfc_dep_compare_expr (s1->ts.u.cl->length,
- s2->ts.u.cl->length);
- switch (compval)
- {
- case -1:
- case 1:
- case -3:
- snprintf (errmsg, err_len, "Character length mismatch "
- "in argument '%s'", s1->name);
- return false;
-
- case -2:
- /* FIXME: Implement a warning for this case.
- gfc_warning (0, "Possible character length mismatch in argument %qs",
- s1->name);*/
- break;
-
- case 0:
- break;
-
- default:
- gfc_internal_error ("check_dummy_characteristics: Unexpected result "
- "%i of gfc_dep_compare_expr", compval);
- break;
- }
- }
-
- /* Check array shape. */
- if (s1->as && s2->as)
- {
- int i, compval;
- gfc_expr *shape1, *shape2;
-
- /* Sometimes the ambiguity between deferred shape and assumed shape
- does not get resolved in module procedures, where the only explicit
- declaration of the dummy is in the interface. */
- if (s1->ns->proc_name && s1->ns->proc_name->attr.module_procedure
- && s1->as->type == AS_ASSUMED_SHAPE
- && s2->as->type == AS_DEFERRED)
- {
- s2->as->type = AS_ASSUMED_SHAPE;
- for (i = 0; i < s2->as->rank; i++)
- if (s1->as->lower[i] != NULL)
- s2->as->lower[i] = gfc_copy_expr (s1->as->lower[i]);
- }
-
- if (s1->as->type != s2->as->type)
- {
- snprintf (errmsg, err_len, "Shape mismatch in argument '%s'",
- s1->name);
- return false;
- }
-
- if (s1->as->corank != s2->as->corank)
- {
- snprintf (errmsg, err_len, "Corank mismatch in argument '%s' (%i/%i)",
- s1->name, s1->as->corank, s2->as->corank);
- return false;
- }
-
- if (s1->as->type == AS_EXPLICIT)
- for (i = 0; i < s1->as->rank + MAX (0, s1->as->corank-1); i++)
- {
- shape1 = gfc_subtract (gfc_copy_expr (s1->as->upper[i]),
- gfc_copy_expr (s1->as->lower[i]));
- shape2 = gfc_subtract (gfc_copy_expr (s2->as->upper[i]),
- gfc_copy_expr (s2->as->lower[i]));
- compval = gfc_dep_compare_expr (shape1, shape2);
- gfc_free_expr (shape1);
- gfc_free_expr (shape2);
- switch (compval)
- {
- case -1:
- case 1:
- case -3:
- if (i < s1->as->rank)
- snprintf (errmsg, err_len, "Shape mismatch in dimension %i of"
- " argument '%s'", i + 1, s1->name);
- else
- snprintf (errmsg, err_len, "Shape mismatch in codimension %i "
- "of argument '%s'", i - s1->as->rank + 1, s1->name);
- return false;
-
- case -2:
- /* FIXME: Implement a warning for this case.
- gfc_warning (0, "Possible shape mismatch in argument %qs",
- s1->name);*/
- break;
-
- case 0:
- break;
-
- default:
- gfc_internal_error ("check_dummy_characteristics: Unexpected "
- "result %i of gfc_dep_compare_expr",
- compval);
- break;
- }
- }
- }
-
- return true;
-}
-
-
-/* Check if the characteristics of two function results match,
- cf. F08:12.3.3. */
-
-bool
-gfc_check_result_characteristics (gfc_symbol *s1, gfc_symbol *s2,
- char *errmsg, int err_len)
-{
- gfc_symbol *r1, *r2;
-
- if (s1->ts.interface && s1->ts.interface->result)
- r1 = s1->ts.interface->result;
- else
- r1 = s1->result ? s1->result : s1;
-
- if (s2->ts.interface && s2->ts.interface->result)
- r2 = s2->ts.interface->result;
- else
- r2 = s2->result ? s2->result : s2;
-
- if (r1->ts.type == BT_UNKNOWN)
- return true;
-
- /* Check type and rank. */
- if (!compare_type_characteristics (r1, r2))
- {
- snprintf (errmsg, err_len, "Type mismatch in function result (%s/%s)",
- gfc_typename (&r1->ts), gfc_typename (&r2->ts));
- return false;
- }
- if (!compare_rank (r1, r2))
- {
- snprintf (errmsg, err_len, "Rank mismatch in function result (%i/%i)",
- symbol_rank (r1), symbol_rank (r2));
- return false;
- }
-
- /* Check ALLOCATABLE attribute. */
- if (r1->attr.allocatable != r2->attr.allocatable)
- {
- snprintf (errmsg, err_len, "ALLOCATABLE attribute mismatch in "
- "function result");
- return false;
- }
-
- /* Check POINTER attribute. */
- if (r1->attr.pointer != r2->attr.pointer)
- {
- snprintf (errmsg, err_len, "POINTER attribute mismatch in "
- "function result");
- return false;
- }
-
- /* Check CONTIGUOUS attribute. */
- if (r1->attr.contiguous != r2->attr.contiguous)
- {
- snprintf (errmsg, err_len, "CONTIGUOUS attribute mismatch in "
- "function result");
- return false;
- }
-
- /* Check PROCEDURE POINTER attribute. */
- if (r1 != s1 && r1->attr.proc_pointer != r2->attr.proc_pointer)
- {
- snprintf (errmsg, err_len, "PROCEDURE POINTER mismatch in "
- "function result");
- return false;
- }
-
- /* Check string length. */
- if (r1->ts.type == BT_CHARACTER && r1->ts.u.cl && r2->ts.u.cl)
- {
- if (r1->ts.deferred != r2->ts.deferred)
- {
- snprintf (errmsg, err_len, "Character length mismatch "
- "in function result");
- return false;
- }
-
- if (r1->ts.u.cl->length && r2->ts.u.cl->length)
- {
- int compval = gfc_dep_compare_expr (r1->ts.u.cl->length,
- r2->ts.u.cl->length);
- switch (compval)
- {
- case -1:
- case 1:
- case -3:
- snprintf (errmsg, err_len, "Character length mismatch "
- "in function result");
- return false;
-
- case -2:
- /* FIXME: Implement a warning for this case.
- snprintf (errmsg, err_len, "Possible character length mismatch "
- "in function result");*/
- break;
-
- case 0:
- break;
-
- default:
- gfc_internal_error ("check_result_characteristics (1): Unexpected "
- "result %i of gfc_dep_compare_expr", compval);
- break;
- }
- }
- }
-
- /* Check array shape. */
- if (!r1->attr.allocatable && !r1->attr.pointer && r1->as && r2->as)
- {
- int i, compval;
- gfc_expr *shape1, *shape2;
-
- if (r1->as->type != r2->as->type)
- {
- snprintf (errmsg, err_len, "Shape mismatch in function result");
- return false;
- }
-
- if (r1->as->type == AS_EXPLICIT)
- for (i = 0; i < r1->as->rank + r1->as->corank; i++)
- {
- shape1 = gfc_subtract (gfc_copy_expr (r1->as->upper[i]),
- gfc_copy_expr (r1->as->lower[i]));
- shape2 = gfc_subtract (gfc_copy_expr (r2->as->upper[i]),
- gfc_copy_expr (r2->as->lower[i]));
- compval = gfc_dep_compare_expr (shape1, shape2);
- gfc_free_expr (shape1);
- gfc_free_expr (shape2);
- switch (compval)
- {
- case -1:
- case 1:
- case -3:
- snprintf (errmsg, err_len, "Shape mismatch in dimension %i of "
- "function result", i + 1);
- return false;
-
- case -2:
- /* FIXME: Implement a warning for this case.
- gfc_warning (0, "Possible shape mismatch in return value");*/
- break;
-
- case 0:
- break;
-
- default:
- gfc_internal_error ("check_result_characteristics (2): "
- "Unexpected result %i of "
- "gfc_dep_compare_expr", compval);
- break;
- }
- }
- }
-
- return true;
-}
-
-
-/* 'Compare' two formal interfaces associated with a pair of symbols.
- We return true if there exists an actual argument list that
- would be ambiguous between the two interfaces, zero otherwise.
- 'strict_flag' specifies whether all the characteristics are
- required to match, which is not the case for ambiguity checks.
- 'p1' and 'p2' are the PASS arguments of both procedures (if applicable). */
-
-bool
-gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
- int generic_flag, int strict_flag,
- char *errmsg, int err_len,
- const char *p1, const char *p2,
- bool *bad_result_characteristics)
-{
- gfc_formal_arglist *f1, *f2;
-
- gcc_assert (name2 != NULL);
-
- if (bad_result_characteristics)
- *bad_result_characteristics = false;
-
- if (s1->attr.function && (s2->attr.subroutine
- || (!s2->attr.function && s2->ts.type == BT_UNKNOWN
- && gfc_get_default_type (name2, s2->ns)->type == BT_UNKNOWN)))
- {
- if (errmsg != NULL)
- snprintf (errmsg, err_len, "'%s' is not a function", name2);
- return false;
- }
-
- if (s1->attr.subroutine && s2->attr.function)
- {
- if (errmsg != NULL)
- snprintf (errmsg, err_len, "'%s' is not a subroutine", name2);
- return false;
- }
-
- /* Do strict checks on all characteristics
- (for dummy procedures and procedure pointer assignments). */
- if (!generic_flag && strict_flag)
- {
- if (s1->attr.function && s2->attr.function)
- {
- /* If both are functions, check result characteristics. */
- if (!gfc_check_result_characteristics (s1, s2, errmsg, err_len)
- || !gfc_check_result_characteristics (s2, s1, errmsg, err_len))
- {
- if (bad_result_characteristics)
- *bad_result_characteristics = true;
- return false;
- }
- }
-
- if (s1->attr.pure && !s2->attr.pure)
- {
- snprintf (errmsg, err_len, "Mismatch in PURE attribute");
- return false;
- }
- if (s1->attr.elemental && !s2->attr.elemental)
- {
- snprintf (errmsg, err_len, "Mismatch in ELEMENTAL attribute");
- return false;
- }
- }
-
- if (s1->attr.if_source == IFSRC_UNKNOWN
- || s2->attr.if_source == IFSRC_UNKNOWN)
- return true;
-
- f1 = gfc_sym_get_dummy_args (s1);
- f2 = gfc_sym_get_dummy_args (s2);
-
- /* Special case: No arguments. */
- if (f1 == NULL && f2 == NULL)
- return true;
-
- if (generic_flag)
- {
- if (count_types_test (f1, f2, p1, p2)
- || count_types_test (f2, f1, p2, p1))
- return false;
-
- /* Special case: alternate returns. If both f1->sym and f2->sym are
- NULL, then the leading formal arguments are alternate returns.
- The previous conditional should catch argument lists with
- different number of argument. */
- if (f1 && f1->sym == NULL && f2 && f2->sym == NULL)
- return true;
-
- if (generic_correspondence (f1, f2, p1, p2)
- || generic_correspondence (f2, f1, p2, p1))
- return false;
- }
- else
- /* Perform the abbreviated correspondence test for operators (the
- arguments cannot be optional and are always ordered correctly).
- This is also done when comparing interfaces for dummy procedures and in
- procedure pointer assignments. */
-
- for (; f1 || f2; f1 = f1->next, f2 = f2->next)
- {
- /* Check existence. */
- if (f1 == NULL || f2 == NULL)
- {
- if (errmsg != NULL)
- snprintf (errmsg, err_len, "'%s' has the wrong number of "
- "arguments", name2);
- return false;
- }
-
- if (strict_flag)
- {
- /* Check all characteristics. */
- if (!gfc_check_dummy_characteristics (f1->sym, f2->sym, true,
- errmsg, err_len))
- return false;
- }
- else
- {
- /* Operators: Only check type and rank of arguments. */
- if (!compare_type (f2->sym, f1->sym))
- {
- if (errmsg != NULL)
- snprintf (errmsg, err_len, "Type mismatch in argument '%s' "
- "(%s/%s)", f1->sym->name,
- gfc_typename (&f1->sym->ts),
- gfc_typename (&f2->sym->ts));
- return false;
- }
- if (!compare_rank (f2->sym, f1->sym))
- {
- if (errmsg != NULL)
- snprintf (errmsg, err_len, "Rank mismatch in argument "
- "'%s' (%i/%i)", f1->sym->name,
- symbol_rank (f1->sym), symbol_rank (f2->sym));
- return false;
- }
- if ((gfc_option.allow_std & GFC_STD_F2008)
- && (compare_ptr_alloc(f1->sym, f2->sym)
- || compare_ptr_alloc(f2->sym, f1->sym)))
- {
- if (errmsg != NULL)
- snprintf (errmsg, err_len, "Mismatching POINTER/ALLOCATABLE "
- "attribute in argument '%s' ", f1->sym->name);
- return false;
- }
- }
- }
-
- return true;
-}
-
-
-/* Given a pointer to an interface pointer, remove duplicate
- interfaces and make sure that all symbols are either functions
- or subroutines, and all of the same kind. Returns true if
- something goes wrong. */
-
-static bool
-check_interface0 (gfc_interface *p, const char *interface_name)
-{
- gfc_interface *psave, *q, *qlast;
-
- psave = p;
- for (; p; p = p->next)
- {
- /* Make sure all symbols in the interface have been defined as
- functions or subroutines. */
- if (((!p->sym->attr.function && !p->sym->attr.subroutine)
- || !p->sym->attr.if_source)
- && !gfc_fl_struct (p->sym->attr.flavor))
- {
- const char *guessed
- = gfc_lookup_function_fuzzy (p->sym->name, p->sym->ns->sym_root);
-
- if (p->sym->attr.external)
- if (guessed)
- gfc_error ("Procedure %qs in %s at %L has no explicit interface"
- "; did you mean %qs?",
- p->sym->name, interface_name, &p->sym->declared_at,
- guessed);
- else
- gfc_error ("Procedure %qs in %s at %L has no explicit interface",
- p->sym->name, interface_name, &p->sym->declared_at);
- else
- if (guessed)
- gfc_error ("Procedure %qs in %s at %L is neither function nor "
- "subroutine; did you mean %qs?", p->sym->name,
- interface_name, &p->sym->declared_at, guessed);
- else
- gfc_error ("Procedure %qs in %s at %L is neither function nor "
- "subroutine", p->sym->name, interface_name,
- &p->sym->declared_at);
- return true;
- }
-
- /* Verify that procedures are either all SUBROUTINEs or all FUNCTIONs. */
- if ((psave->sym->attr.function && !p->sym->attr.function
- && !gfc_fl_struct (p->sym->attr.flavor))
- || (psave->sym->attr.subroutine && !p->sym->attr.subroutine))
- {
- if (!gfc_fl_struct (p->sym->attr.flavor))
- gfc_error ("In %s at %L procedures must be either all SUBROUTINEs"
- " or all FUNCTIONs", interface_name,
- &p->sym->declared_at);
- else if (p->sym->attr.flavor == FL_DERIVED)
- gfc_error ("In %s at %L procedures must be all FUNCTIONs as the "
- "generic name is also the name of a derived type",
- interface_name, &p->sym->declared_at);
- return true;
- }
-
- /* F2003, C1207. F2008, C1207. */
- if (p->sym->attr.proc == PROC_INTERNAL
- && !gfc_notify_std (GFC_STD_F2008, "Internal procedure "
- "%qs in %s at %L", p->sym->name,
- interface_name, &p->sym->declared_at))
- return true;
- }
- p = psave;
-
- /* Remove duplicate interfaces in this interface list. */
- for (; p; p = p->next)
- {
- qlast = p;
-
- for (q = p->next; q;)
- {
- if (p->sym != q->sym)
- {
- qlast = q;
- q = q->next;
- }
- else
- {
- /* Duplicate interface. */
- qlast->next = q->next;
- free (q);
- q = qlast->next;
- }
- }
- }
-
- return false;
-}
-
-
-/* Check lists of interfaces to make sure that no two interfaces are
- ambiguous. Duplicate interfaces (from the same symbol) are OK here. */
-
-static bool
-check_interface1 (gfc_interface *p, gfc_interface *q0,
- int generic_flag, const char *interface_name,
- bool referenced)
-{
- gfc_interface *q;
- for (; p; p = p->next)
- for (q = q0; q; q = q->next)
- {
- if (p->sym == q->sym)
- continue; /* Duplicates OK here. */
-
- if (p->sym->name == q->sym->name && p->sym->module == q->sym->module)
- continue;
-
- if (!gfc_fl_struct (p->sym->attr.flavor)
- && !gfc_fl_struct (q->sym->attr.flavor)
- && gfc_compare_interfaces (p->sym, q->sym, q->sym->name,
- generic_flag, 0, NULL, 0, NULL, NULL))
- {
- if (referenced)
- gfc_error ("Ambiguous interfaces in %s for %qs at %L "
- "and %qs at %L", interface_name,
- q->sym->name, &q->sym->declared_at,
- p->sym->name, &p->sym->declared_at);
- else if (!p->sym->attr.use_assoc && q->sym->attr.use_assoc)
- gfc_warning (0, "Ambiguous interfaces in %s for %qs at %L "
- "and %qs at %L", interface_name,
- q->sym->name, &q->sym->declared_at,
- p->sym->name, &p->sym->declared_at);
- else
- gfc_warning (0, "Although not referenced, %qs has ambiguous "
- "interfaces at %L", interface_name, &p->where);
- return true;
- }
- }
- return false;
-}
-
-
-/* Check the generic and operator interfaces of symbols to make sure
- that none of the interfaces conflict. The check has to be done
- after all of the symbols are actually loaded. */
-
-static void
-check_sym_interfaces (gfc_symbol *sym)
-{
- /* Provide sufficient space to hold "generic interface 'symbol.symbol'". */
- char interface_name[2*GFC_MAX_SYMBOL_LEN+2 + sizeof("generic interface ''")];
- gfc_interface *p;
-
- if (sym->ns != gfc_current_ns)
- return;
-
- if (sym->generic != NULL)
- {
- size_t len = strlen (sym->name) + sizeof("generic interface ''");
- gcc_assert (len < sizeof (interface_name));
- sprintf (interface_name, "generic interface '%s'", sym->name);
- if (check_interface0 (sym->generic, interface_name))
- return;
-
- for (p = sym->generic; p; p = p->next)
- {
- if (p->sym->attr.mod_proc
- && !p->sym->attr.module_procedure
- && (p->sym->attr.if_source != IFSRC_DECL
- || p->sym->attr.procedure))
- {
- gfc_error ("%qs at %L is not a module procedure",
- p->sym->name, &p->where);
- return;
- }
- }
-
- /* Originally, this test was applied to host interfaces too;
- this is incorrect since host associated symbols, from any
- source, cannot be ambiguous with local symbols. */
- check_interface1 (sym->generic, sym->generic, 1, interface_name,
- sym->attr.referenced || !sym->attr.use_assoc);
- }
-}
-
-
-static void
-check_uop_interfaces (gfc_user_op *uop)
-{
- char interface_name[GFC_MAX_SYMBOL_LEN + sizeof("operator interface ''")];
- gfc_user_op *uop2;
- gfc_namespace *ns;
-
- sprintf (interface_name, "operator interface '%s'", uop->name);
- if (check_interface0 (uop->op, interface_name))
- return;
-
- for (ns = gfc_current_ns; ns; ns = ns->parent)
- {
- uop2 = gfc_find_uop (uop->name, ns);
- if (uop2 == NULL)
- continue;
-
- check_interface1 (uop->op, uop2->op, 0,
- interface_name, true);
- }
-}
-
-/* Given an intrinsic op, return an equivalent op if one exists,
- or INTRINSIC_NONE otherwise. */
-
-gfc_intrinsic_op
-gfc_equivalent_op (gfc_intrinsic_op op)
-{
- switch(op)
- {
- case INTRINSIC_EQ:
- return INTRINSIC_EQ_OS;
-
- case INTRINSIC_EQ_OS:
- return INTRINSIC_EQ;
-
- case INTRINSIC_NE:
- return INTRINSIC_NE_OS;
-
- case INTRINSIC_NE_OS:
- return INTRINSIC_NE;
-
- case INTRINSIC_GT:
- return INTRINSIC_GT_OS;
-
- case INTRINSIC_GT_OS:
- return INTRINSIC_GT;
-
- case INTRINSIC_GE:
- return INTRINSIC_GE_OS;
-
- case INTRINSIC_GE_OS:
- return INTRINSIC_GE;
-
- case INTRINSIC_LT:
- return INTRINSIC_LT_OS;
-
- case INTRINSIC_LT_OS:
- return INTRINSIC_LT;
-
- case INTRINSIC_LE:
- return INTRINSIC_LE_OS;
-
- case INTRINSIC_LE_OS:
- return INTRINSIC_LE;
-
- default:
- return INTRINSIC_NONE;
- }
-}
-
-/* For the namespace, check generic, user operator and intrinsic
- operator interfaces for consistency and to remove duplicate
- interfaces. We traverse the whole namespace, counting on the fact
- that most symbols will not have generic or operator interfaces. */
-
-void
-gfc_check_interfaces (gfc_namespace *ns)
-{
- gfc_namespace *old_ns, *ns2;
- char interface_name[GFC_MAX_SYMBOL_LEN + sizeof("intrinsic '' operator")];
- int i;
-
- old_ns = gfc_current_ns;
- gfc_current_ns = ns;
-
- gfc_traverse_ns (ns, check_sym_interfaces);
-
- gfc_traverse_user_op (ns, check_uop_interfaces);
-
- for (i = GFC_INTRINSIC_BEGIN; i != GFC_INTRINSIC_END; i++)
- {
- if (i == INTRINSIC_USER)
- continue;
-
- if (i == INTRINSIC_ASSIGN)
- strcpy (interface_name, "intrinsic assignment operator");
- else
- sprintf (interface_name, "intrinsic '%s' operator",
- gfc_op2string ((gfc_intrinsic_op) i));
-
- if (check_interface0 (ns->op[i], interface_name))
- continue;
-
- if (ns->op[i])
- gfc_check_operator_interface (ns->op[i]->sym, (gfc_intrinsic_op) i,
- ns->op[i]->where);
-
- for (ns2 = ns; ns2; ns2 = ns2->parent)
- {
- gfc_intrinsic_op other_op;
-
- if (check_interface1 (ns->op[i], ns2->op[i], 0,
- interface_name, true))
- goto done;
-
- /* i should be gfc_intrinsic_op, but has to be int with this cast
- here for stupid C++ compatibility rules. */
- other_op = gfc_equivalent_op ((gfc_intrinsic_op) i);
- if (other_op != INTRINSIC_NONE
- && check_interface1 (ns->op[i], ns2->op[other_op],
- 0, interface_name, true))
- goto done;
- }
- }
-
-done:
- gfc_current_ns = old_ns;
-}
-
-
-/* Given a symbol of a formal argument list and an expression, if the
- formal argument is allocatable, check that the actual argument is
- allocatable. Returns true if compatible, zero if not compatible. */
-
-static bool
-compare_allocatable (gfc_symbol *formal, gfc_expr *actual)
-{
- if (formal->attr.allocatable
- || (formal->ts.type == BT_CLASS && CLASS_DATA (formal)->attr.allocatable))
- {
- symbol_attribute attr = gfc_expr_attr (actual);
- if (actual->ts.type == BT_CLASS && !attr.class_ok)
- return true;
- else if (!attr.allocatable)
- return false;
- }
-
- return true;
-}
-
-
-/* Given a symbol of a formal argument list and an expression, if the
- formal argument is a pointer, see if the actual argument is a
- pointer. Returns nonzero if compatible, zero if not compatible. */
-
-static int
-compare_pointer (gfc_symbol *formal, gfc_expr *actual)
-{
- symbol_attribute attr;
-
- if (formal->attr.pointer
- || (formal->ts.type == BT_CLASS && CLASS_DATA (formal)
- && CLASS_DATA (formal)->attr.class_pointer))
- {
- attr = gfc_expr_attr (actual);
-
- /* Fortran 2008 allows non-pointer actual arguments. */
- if (!attr.pointer && attr.target && formal->attr.intent == INTENT_IN)
- return 2;
-
- if (!attr.pointer)
- return 0;
- }
-
- return 1;
-}
-
-
-/* Emit clear error messages for rank mismatch. */
-
-static void
-argument_rank_mismatch (const char *name, locus *where,
- int rank1, int rank2, locus *where_formal)
-{
-
- /* TS 29113, C407b. */
- if (where_formal == NULL)
- {
- if (rank2 == -1)
- gfc_error ("The assumed-rank array at %L requires that the dummy "
- "argument %qs has assumed-rank", where, name);
- else if (rank1 == 0)
- gfc_error_opt (0, "Rank mismatch in argument %qs "
- "at %L (scalar and rank-%d)", name, where, rank2);
- else if (rank2 == 0)
- gfc_error_opt (0, "Rank mismatch in argument %qs "
- "at %L (rank-%d and scalar)", name, where, rank1);
- else
- gfc_error_opt (0, "Rank mismatch in argument %qs "
- "at %L (rank-%d and rank-%d)", name, where, rank1,
- rank2);
- }
- else
- {
- if (rank2 == -1)
- /* This is an assumed rank-actual passed to a function without
- an explicit interface, which is already diagnosed in
- gfc_procedure_use. */
- return;
- if (rank1 == 0)
- gfc_error_opt (0, "Rank mismatch between actual argument at %L "
- "and actual argument at %L (scalar and rank-%d)",
- where, where_formal, rank2);
- else if (rank2 == 0)
- gfc_error_opt (0, "Rank mismatch between actual argument at %L "
- "and actual argument at %L (rank-%d and scalar)",
- where, where_formal, rank1);
- else
- gfc_error_opt (0, "Rank mismatch between actual argument at %L "
- "and actual argument at %L (rank-%d and rank-%d)", where,
- where_formal, rank1, rank2);
- }
-}
-
-
-/* Under certain conditions, a scalar actual argument can be passed
- to an array dummy argument - see F2018, 15.5.2.4, paragraph 14.
- This function returns true for these conditions so that an error
- or warning for this can be suppressed later. Always return false
- for expressions with rank > 0. */
-
-bool
-maybe_dummy_array_arg (gfc_expr *e)
-{
- gfc_symbol *s;
- gfc_ref *ref;
- bool array_pointer = false;
- bool assumed_shape = false;
- bool scalar_ref = true;
-
- if (e->rank > 0)
- return false;
-
- if (e->ts.type == BT_CHARACTER && e->ts.kind == 1)
- return true;
-
- /* If this comes from a constructor, it has been an array element
- originally. */
-
- if (e->expr_type == EXPR_CONSTANT)
- return e->from_constructor;
-
- if (e->expr_type != EXPR_VARIABLE)
- return false;
-
- s = e->symtree->n.sym;
-
- if (s->attr.dimension)
- {
- scalar_ref = false;
- array_pointer = s->attr.pointer;
- }
-
- if (s->as && s->as->type == AS_ASSUMED_SHAPE)
- assumed_shape = true;
-
- for (ref=e->ref; ref; ref=ref->next)
- {
- if (ref->type == REF_COMPONENT)
- {
- symbol_attribute *attr;
- attr = &ref->u.c.component->attr;
- if (attr->dimension)
- {
- array_pointer = attr->pointer;
- assumed_shape = false;
- scalar_ref = false;
- }
- else
- scalar_ref = true;
- }
- }
-
- return !(scalar_ref || array_pointer || assumed_shape);
-}
-
-/* Given a symbol of a formal argument list and an expression, see if
- the two are compatible as arguments. Returns true if
- compatible, false if not compatible. */
-
-static bool
-compare_parameter (gfc_symbol *formal, gfc_expr *actual,
- int ranks_must_agree, int is_elemental, locus *where)
-{
- gfc_ref *ref;
- bool rank_check, is_pointer;
- char err[200];
- gfc_component *ppc;
- bool codimension = false;
-
- /* If the formal arg has type BT_VOID, it's to one of the iso_c_binding
- procs c_f_pointer or c_f_procpointer, and we need to accept most
- pointers the user could give us. This should allow that. */
- if (formal->ts.type == BT_VOID)
- return true;
-
- if (formal->ts.type == BT_DERIVED
- && formal->ts.u.derived && formal->ts.u.derived->ts.is_iso_c
- && actual->ts.type == BT_DERIVED
- && actual->ts.u.derived && actual->ts.u.derived->ts.is_iso_c)
- return true;
-
- if (formal->ts.type == BT_CLASS && actual->ts.type == BT_DERIVED)
- /* Make sure the vtab symbol is present when
- the module variables are generated. */
- gfc_find_derived_vtab (actual->ts.u.derived);
-
- if (actual->ts.type == BT_PROCEDURE)
- {
- gfc_symbol *act_sym = actual->symtree->n.sym;
-
- if (formal->attr.flavor != FL_PROCEDURE)
- {
- if (where)
- gfc_error ("Invalid procedure argument at %L", &actual->where);
- return false;
- }
-
- if (!gfc_compare_interfaces (formal, act_sym, act_sym->name, 0, 1, err,
- sizeof(err), NULL, NULL))
- {
- if (where)
- gfc_error_opt (0, "Interface mismatch in dummy procedure %qs at %L:"
- " %s", formal->name, &actual->where, err);
- return false;
- }
-
- if (formal->attr.function && !act_sym->attr.function)
- {
- gfc_add_function (&act_sym->attr, act_sym->name,
- &act_sym->declared_at);
- if (act_sym->ts.type == BT_UNKNOWN
- && !gfc_set_default_type (act_sym, 1, act_sym->ns))
- return false;
- }
- else if (formal->attr.subroutine && !act_sym->attr.subroutine)
- gfc_add_subroutine (&act_sym->attr, act_sym->name,
- &act_sym->declared_at);
-
- return true;
- }
-
- ppc = gfc_get_proc_ptr_comp (actual);
- if (ppc && ppc->ts.interface)
- {
- if (!gfc_compare_interfaces (formal, ppc->ts.interface, ppc->name, 0, 1,
- err, sizeof(err), NULL, NULL))
- {
- if (where)
- gfc_error_opt (0, "Interface mismatch in dummy procedure %qs at %L:"
- " %s", formal->name, &actual->where, err);
- return false;
- }
- }
-
- /* F2008, C1241. */
- if (formal->attr.pointer && formal->attr.contiguous
- && !gfc_is_simply_contiguous (actual, true, false))
- {
- if (where)
- gfc_error ("Actual argument to contiguous pointer dummy %qs at %L "
- "must be simply contiguous", formal->name, &actual->where);
- return false;
- }
-
- symbol_attribute actual_attr = gfc_expr_attr (actual);
- if (actual->ts.type == BT_CLASS && !actual_attr.class_ok)
- return true;
-
- if ((actual->expr_type != EXPR_NULL || actual->ts.type != BT_UNKNOWN)
- && actual->ts.type != BT_HOLLERITH
- && formal->ts.type != BT_ASSUMED
- && !(formal->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
- && !gfc_compare_types (&formal->ts, &actual->ts)
- && !(formal->ts.type == BT_DERIVED && actual->ts.type == BT_CLASS
- && gfc_compare_derived_types (formal->ts.u.derived,
- CLASS_DATA (actual)->ts.u.derived)))
- {
- if (where)
- {
- if (formal->attr.artificial)
- {
- if (!flag_allow_argument_mismatch || !formal->error)
- gfc_error_opt (0, "Type mismatch between actual argument at %L "
- "and actual argument at %L (%s/%s).",
- &actual->where,
- &formal->declared_at,
- gfc_typename (actual),
- gfc_dummy_typename (&formal->ts));
-
- formal->error = 1;
- }
- else
- gfc_error_opt (0, "Type mismatch in argument %qs at %L; passed %s "
- "to %s", formal->name, where, gfc_typename (actual),
- gfc_dummy_typename (&formal->ts));
- }
- return false;
- }
-
- if (actual->ts.type == BT_ASSUMED && formal->ts.type != BT_ASSUMED)
- {
- if (where)
- gfc_error ("Assumed-type actual argument at %L requires that dummy "
- "argument %qs is of assumed type", &actual->where,
- formal->name);
- return false;
- }
-
- /* TS29113 C407c; F2018 C711. */
- if (actual->ts.type == BT_ASSUMED
- && symbol_rank (formal) == -1
- && actual->rank != -1
- && !(actual->symtree->n.sym->as
- && actual->symtree->n.sym->as->type == AS_ASSUMED_SHAPE))
- {
- if (where)
- gfc_error ("Assumed-type actual argument at %L corresponding to "
- "assumed-rank dummy argument %qs must be "
- "assumed-shape or assumed-rank",
- &actual->where, formal->name);
- return false;
- }
-
- /* F2008, 12.5.2.5; IR F08/0073. */
- if (formal->ts.type == BT_CLASS && formal->attr.class_ok
- && actual->expr_type != EXPR_NULL
- && ((CLASS_DATA (formal)->attr.class_pointer
- && formal->attr.intent != INTENT_IN)
- || CLASS_DATA (formal)->attr.allocatable))
- {
- if (actual->ts.type != BT_CLASS)
- {
- if (where)
- gfc_error ("Actual argument to %qs at %L must be polymorphic",
- formal->name, &actual->where);
- return false;
- }
-
- if ((!UNLIMITED_POLY (formal) || !UNLIMITED_POLY(actual))
- && !gfc_compare_derived_types (CLASS_DATA (actual)->ts.u.derived,
- CLASS_DATA (formal)->ts.u.derived))
- {
- if (where)
- gfc_error ("Actual argument to %qs at %L must have the same "
- "declared type", formal->name, &actual->where);
- return false;
- }
- }
-
- /* F08: 12.5.2.5 Allocatable and pointer dummy variables. However, this
- is necessary also for F03, so retain error for both.
- NOTE: Other type/kind errors pre-empt this error. Since they are F03
- compatible, no attempt has been made to channel to this one. */
- if (UNLIMITED_POLY (formal) && !UNLIMITED_POLY (actual)
- && (CLASS_DATA (formal)->attr.allocatable
- ||CLASS_DATA (formal)->attr.class_pointer))
- {
- if (where)
- gfc_error ("Actual argument to %qs at %L must be unlimited "
- "polymorphic since the formal argument is a "
- "pointer or allocatable unlimited polymorphic "
- "entity [F2008: 12.5.2.5]", formal->name,
- &actual->where);
- return false;
- }
-
- if (formal->ts.type == BT_CLASS && formal->attr.class_ok)
- codimension = CLASS_DATA (formal)->attr.codimension;
- else
- codimension = formal->attr.codimension;
-
- if (codimension && !gfc_is_coarray (actual))
- {
- if (where)
- gfc_error ("Actual argument to %qs at %L must be a coarray",
- formal->name, &actual->where);
- return false;
- }
-
- if (codimension && formal->attr.allocatable)
- {
- gfc_ref *last = NULL;
-
- for (ref = actual->ref; ref; ref = ref->next)
- if (ref->type == REF_COMPONENT)
- last = ref;
-
- /* F2008, 12.5.2.6. */
- if ((last && last->u.c.component->as->corank != formal->as->corank)
- || (!last
- && actual->symtree->n.sym->as->corank != formal->as->corank))
- {
- if (where)
- gfc_error ("Corank mismatch in argument %qs at %L (%d and %d)",
- formal->name, &actual->where, formal->as->corank,
- last ? last->u.c.component->as->corank
- : actual->symtree->n.sym->as->corank);
- return false;
- }
- }
-
- if (codimension)
- {
- /* F2008, 12.5.2.8 + Corrig 2 (IR F08/0048). */
- /* F2018, 12.5.2.8. */
- if (formal->attr.dimension
- && (formal->attr.contiguous || formal->as->type != AS_ASSUMED_SHAPE)
- && actual_attr.dimension
- && !gfc_is_simply_contiguous (actual, true, true))
- {
- if (where)
- gfc_error ("Actual argument to %qs at %L must be simply "
- "contiguous or an element of such an array",
- formal->name, &actual->where);
- return false;
- }
-
- /* F2008, C1303 and C1304. */
- if (formal->attr.intent != INTENT_INOUT
- && (((formal->ts.type == BT_DERIVED || formal->ts.type == BT_CLASS)
- && formal->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
- && formal->ts.u.derived->intmod_sym_id == ISOFORTRAN_LOCK_TYPE)
- || formal->attr.lock_comp))
-
- {
- if (where)
- gfc_error ("Actual argument to non-INTENT(INOUT) dummy %qs at %L, "
- "which is LOCK_TYPE or has a LOCK_TYPE component",
- formal->name, &actual->where);
- return false;
- }
-
- /* TS18508, C702/C703. */
- if (formal->attr.intent != INTENT_INOUT
- && (((formal->ts.type == BT_DERIVED || formal->ts.type == BT_CLASS)
- && formal->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
- && formal->ts.u.derived->intmod_sym_id == ISOFORTRAN_EVENT_TYPE)
- || formal->attr.event_comp))
-
- {
- if (where)
- gfc_error ("Actual argument to non-INTENT(INOUT) dummy %qs at %L, "
- "which is EVENT_TYPE or has a EVENT_TYPE component",
- formal->name, &actual->where);
- return false;
- }
- }
-
- /* F2008, C1239/C1240. */
- if (actual->expr_type == EXPR_VARIABLE
- && (actual->symtree->n.sym->attr.asynchronous
- || actual->symtree->n.sym->attr.volatile_)
- && (formal->attr.asynchronous || formal->attr.volatile_)
- && actual->rank && formal->as
- && !gfc_is_simply_contiguous (actual, true, false)
- && ((formal->as->type != AS_ASSUMED_SHAPE
- && formal->as->type != AS_ASSUMED_RANK && !formal->attr.pointer)
- || formal->attr.contiguous))
- {
- if (where)
- gfc_error ("Dummy argument %qs has to be a pointer, assumed-shape or "
- "assumed-rank array without CONTIGUOUS attribute - as actual"
- " argument at %L is not simply contiguous and both are "
- "ASYNCHRONOUS or VOLATILE", formal->name, &actual->where);
- return false;
- }
-
- if (formal->attr.allocatable && !codimension
- && actual_attr.codimension)
- {
- if (formal->attr.intent == INTENT_OUT)
- {
- if (where)
- gfc_error ("Passing coarray at %L to allocatable, noncoarray, "
- "INTENT(OUT) dummy argument %qs", &actual->where,
- formal->name);
- return false;
- }
- else if (warn_surprising && where && formal->attr.intent != INTENT_IN)
- gfc_warning (OPT_Wsurprising,
- "Passing coarray at %L to allocatable, noncoarray dummy "
- "argument %qs, which is invalid if the allocation status"
- " is modified", &actual->where, formal->name);
- }
-
- /* If the rank is the same or the formal argument has assumed-rank. */
- if (symbol_rank (formal) == actual->rank || symbol_rank (formal) == -1)
- return true;
-
- rank_check = where != NULL && !is_elemental && formal->as
- && (formal->as->type == AS_ASSUMED_SHAPE
- || formal->as->type == AS_DEFERRED)
- && actual->expr_type != EXPR_NULL;
-
- /* Skip rank checks for NO_ARG_CHECK. */
- if (formal->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
- return true;
-
- /* Scalar & coindexed, see: F2008, Section 12.5.2.4. */
- if (rank_check || ranks_must_agree
- || (formal->attr.pointer && actual->expr_type != EXPR_NULL)
- || (actual->rank != 0 && !(is_elemental || formal->attr.dimension))
- || (actual->rank == 0
- && ((formal->ts.type == BT_CLASS
- && CLASS_DATA (formal)->as->type == AS_ASSUMED_SHAPE)
- || (formal->ts.type != BT_CLASS
- && formal->as->type == AS_ASSUMED_SHAPE))
- && actual->expr_type != EXPR_NULL)
- || (actual->rank == 0 && formal->attr.dimension
- && gfc_is_coindexed (actual))
- /* Assumed-rank actual argument; F2018 C838. */
- || actual->rank == -1)
- {
- if (where
- && (!formal->attr.artificial || (!formal->maybe_array
- && !maybe_dummy_array_arg (actual))))
- {
- locus *where_formal;
- if (formal->attr.artificial)
- where_formal = &formal->declared_at;
- else
- where_formal = NULL;
-
- argument_rank_mismatch (formal->name, &actual->where,
- symbol_rank (formal), actual->rank,
- where_formal);
- }
- return false;
- }
- else if (actual->rank != 0 && (is_elemental || formal->attr.dimension))
- return true;
-
- /* At this point, we are considering a scalar passed to an array. This
- is valid (cf. F95 12.4.1.1, F2003 12.4.1.2, and F2008 12.5.2.4),
- - if the actual argument is (a substring of) an element of a
- non-assumed-shape/non-pointer/non-polymorphic array; or
- - (F2003) if the actual argument is of type character of default/c_char
- kind. */
-
- is_pointer = actual->expr_type == EXPR_VARIABLE
- ? actual->symtree->n.sym->attr.pointer : false;
-
- for (ref = actual->ref; ref; ref = ref->next)
- {
- if (ref->type == REF_COMPONENT)
- is_pointer = ref->u.c.component->attr.pointer;
- else if (ref->type == REF_ARRAY && ref->u.ar.type == AR_ELEMENT
- && ref->u.ar.dimen > 0
- && (!ref->next
- || (ref->next->type == REF_SUBSTRING && !ref->next->next)))
- break;
- }
-
- if (actual->ts.type == BT_CLASS && actual->expr_type != EXPR_NULL)
- {
- if (where)
- gfc_error ("Polymorphic scalar passed to array dummy argument %qs "
- "at %L", formal->name, &actual->where);
- return false;
- }
-
- if (actual->expr_type != EXPR_NULL && ref && actual->ts.type != BT_CHARACTER
- && (is_pointer || ref->u.ar.as->type == AS_ASSUMED_SHAPE))
- {
- if (where)
- {
- if (formal->attr.artificial)
- gfc_error ("Element of assumed-shape or pointer array "
- "as actual argument at %L cannot correspond to "
- "actual argument at %L",
- &actual->where, &formal->declared_at);
- else
- gfc_error ("Element of assumed-shape or pointer "
- "array passed to array dummy argument %qs at %L",
- formal->name, &actual->where);
- }
- return false;
- }
-
- if (actual->ts.type == BT_CHARACTER && actual->expr_type != EXPR_NULL
- && (!ref || is_pointer || ref->u.ar.as->type == AS_ASSUMED_SHAPE))
- {
- if (formal->ts.kind != 1 && (gfc_option.allow_std & GFC_STD_GNU) == 0)
- {
- if (where)
- gfc_error ("Extension: Scalar non-default-kind, non-C_CHAR-kind "
- "CHARACTER actual argument with array dummy argument "
- "%qs at %L", formal->name, &actual->where);
- return false;
- }
-
- if (where && (gfc_option.allow_std & GFC_STD_F2003) == 0)
- {
- gfc_error ("Fortran 2003: Scalar CHARACTER actual argument with "
- "array dummy argument %qs at %L",
- formal->name, &actual->where);
- return false;
- }
- else
- return ((gfc_option.allow_std & GFC_STD_F2003) != 0);
- }
-
- if (ref == NULL && actual->expr_type != EXPR_NULL)
- {
- if (where
- && (!formal->attr.artificial || (!formal->maybe_array
- && !maybe_dummy_array_arg (actual))))
- {
- locus *where_formal;
- if (formal->attr.artificial)
- where_formal = &formal->declared_at;
- else
- where_formal = NULL;
-
- argument_rank_mismatch (formal->name, &actual->where,
- symbol_rank (formal), actual->rank,
- where_formal);
- }
- return false;
- }
-
- return true;
-}
-
-
-/* Returns the storage size of a symbol (formal argument) or
- zero if it cannot be determined. */
-
-static unsigned long
-get_sym_storage_size (gfc_symbol *sym)
-{
- int i;
- unsigned long strlen, elements;
-
- if (sym->ts.type == BT_CHARACTER)
- {
- if (sym->ts.u.cl && sym->ts.u.cl->length
- && sym->ts.u.cl->length->expr_type == EXPR_CONSTANT)
- strlen = mpz_get_ui (sym->ts.u.cl->length->value.integer);
- else
- return 0;
- }
- else
- strlen = 1;
-
- if (symbol_rank (sym) == 0)
- return strlen;
-
- elements = 1;
- if (sym->as->type != AS_EXPLICIT)
- return 0;
- for (i = 0; i < sym->as->rank; i++)
- {
- if (sym->as->upper[i]->expr_type != EXPR_CONSTANT
- || sym->as->lower[i]->expr_type != EXPR_CONSTANT)
- return 0;
-
- elements *= mpz_get_si (sym->as->upper[i]->value.integer)
- - mpz_get_si (sym->as->lower[i]->value.integer) + 1L;
- }
-
- return strlen*elements;
-}
-
-
-/* Returns the storage size of an expression (actual argument) or
- zero if it cannot be determined. For an array element, it returns
- the remaining size as the element sequence consists of all storage
- units of the actual argument up to the end of the array. */
-
-static unsigned long
-get_expr_storage_size (gfc_expr *e)
-{
- int i;
- long int strlen, elements;
- long int substrlen = 0;
- bool is_str_storage = false;
- gfc_ref *ref;
-
- if (e == NULL)
- return 0;
-
- if (e->ts.type == BT_CHARACTER)
- {
- if (e->ts.u.cl && e->ts.u.cl->length
- && e->ts.u.cl->length->expr_type == EXPR_CONSTANT)
- strlen = mpz_get_si (e->ts.u.cl->length->value.integer);
- else if (e->expr_type == EXPR_CONSTANT
- && (e->ts.u.cl == NULL || e->ts.u.cl->length == NULL))
- strlen = e->value.character.length;
- else
- return 0;
- }
- else
- strlen = 1; /* Length per element. */
-
- if (e->rank == 0 && !e->ref)
- return strlen;
-
- elements = 1;
- if (!e->ref)
- {
- if (!e->shape)
- return 0;
- for (i = 0; i < e->rank; i++)
- elements *= mpz_get_si (e->shape[i]);
- return elements*strlen;
- }
-
- for (ref = e->ref; ref; ref = ref->next)
- {
- if (ref->type == REF_SUBSTRING && ref->u.ss.start
- && ref->u.ss.start->expr_type == EXPR_CONSTANT)
- {
- if (is_str_storage)
- {
- /* The string length is the substring length.
- Set now to full string length. */
- if (!ref->u.ss.length || !ref->u.ss.length->length
- || ref->u.ss.length->length->expr_type != EXPR_CONSTANT)
- return 0;
-
- strlen = mpz_get_ui (ref->u.ss.length->length->value.integer);
- }
- substrlen = strlen - mpz_get_ui (ref->u.ss.start->value.integer) + 1;
- continue;
- }
-
- if (ref->type == REF_ARRAY && ref->u.ar.type == AR_SECTION)
- for (i = 0; i < ref->u.ar.dimen; i++)
- {
- long int start, end, stride;
- stride = 1;
-
- if (ref->u.ar.stride[i])
- {
- if (ref->u.ar.stride[i]->expr_type == EXPR_CONSTANT)
- stride = mpz_get_si (ref->u.ar.stride[i]->value.integer);
- else
- return 0;
- }
-
- if (ref->u.ar.start[i])
- {
- if (ref->u.ar.start[i]->expr_type == EXPR_CONSTANT)
- start = mpz_get_si (ref->u.ar.start[i]->value.integer);
- else
- return 0;
- }
- else if (ref->u.ar.as->lower[i]
- && ref->u.ar.as->lower[i]->expr_type == EXPR_CONSTANT)
- start = mpz_get_si (ref->u.ar.as->lower[i]->value.integer);
- else
- return 0;
-
- if (ref->u.ar.end[i])
- {
- if (ref->u.ar.end[i]->expr_type == EXPR_CONSTANT)
- end = mpz_get_si (ref->u.ar.end[i]->value.integer);
- else
- return 0;
- }
- else if (ref->u.ar.as->upper[i]
- && ref->u.ar.as->upper[i]->expr_type == EXPR_CONSTANT)
- end = mpz_get_si (ref->u.ar.as->upper[i]->value.integer);
- else
- return 0;
-
- elements *= (end - start)/stride + 1L;
- }
- else if (ref->type == REF_ARRAY && ref->u.ar.type == AR_FULL)
- for (i = 0; i < ref->u.ar.as->rank; i++)
- {
- if (ref->u.ar.as->lower[i] && ref->u.ar.as->upper[i]
- && ref->u.ar.as->lower[i]->expr_type == EXPR_CONSTANT
- && ref->u.ar.as->lower[i]->ts.type == BT_INTEGER
- && ref->u.ar.as->upper[i]->expr_type == EXPR_CONSTANT
- && ref->u.ar.as->upper[i]->ts.type == BT_INTEGER)
- elements *= mpz_get_si (ref->u.ar.as->upper[i]->value.integer)
- - mpz_get_si (ref->u.ar.as->lower[i]->value.integer)
- + 1L;
- else
- return 0;
- }
- else if (ref->type == REF_ARRAY && ref->u.ar.type == AR_ELEMENT
- && e->expr_type == EXPR_VARIABLE)
- {
- if (ref->u.ar.as->type == AS_ASSUMED_SHAPE
- || e->symtree->n.sym->attr.pointer)
- {
- elements = 1;
- continue;
- }
-
- /* Determine the number of remaining elements in the element
- sequence for array element designators. */
- is_str_storage = true;
- for (i = ref->u.ar.dimen - 1; i >= 0; i--)
- {
- if (ref->u.ar.start[i] == NULL
- || ref->u.ar.start[i]->expr_type != EXPR_CONSTANT
- || ref->u.ar.as->upper[i] == NULL
- || ref->u.ar.as->lower[i] == NULL
- || ref->u.ar.as->upper[i]->expr_type != EXPR_CONSTANT
- || ref->u.ar.as->lower[i]->expr_type != EXPR_CONSTANT)
- return 0;
-
- elements
- = elements
- * (mpz_get_si (ref->u.ar.as->upper[i]->value.integer)
- - mpz_get_si (ref->u.ar.as->lower[i]->value.integer)
- + 1L)
- - (mpz_get_si (ref->u.ar.start[i]->value.integer)
- - mpz_get_si (ref->u.ar.as->lower[i]->value.integer));
- }
- }
- else if (ref->type == REF_COMPONENT && ref->u.c.component->attr.function
- && ref->u.c.component->attr.proc_pointer
- && ref->u.c.component->attr.dimension)
- {
- /* Array-valued procedure-pointer components. */
- gfc_array_spec *as = ref->u.c.component->as;
- for (i = 0; i < as->rank; i++)
- {
- if (!as->upper[i] || !as->lower[i]
- || as->upper[i]->expr_type != EXPR_CONSTANT
- || as->lower[i]->expr_type != EXPR_CONSTANT)
- return 0;
-
- elements = elements
- * (mpz_get_si (as->upper[i]->value.integer)
- - mpz_get_si (as->lower[i]->value.integer) + 1L);
- }
- }
- }
-
- if (substrlen)
- return (is_str_storage) ? substrlen + (elements-1)*strlen
- : elements*strlen;
- else
- return elements*strlen;
-}
-
-
-/* Given an expression, check whether it is an array section
- which has a vector subscript. */
-
-bool
-gfc_has_vector_subscript (gfc_expr *e)
-{
- int i;
- gfc_ref *ref;
-
- if (e == NULL || e->rank == 0 || e->expr_type != EXPR_VARIABLE)
- return false;
-
- for (ref = e->ref; ref; ref = ref->next)
- if (ref->type == REF_ARRAY && ref->u.ar.type == AR_SECTION)
- for (i = 0; i < ref->u.ar.dimen; i++)
- if (ref->u.ar.dimen_type[i] == DIMEN_VECTOR)
- return true;
-
- return false;
-}
-
-
-static bool
-is_procptr_result (gfc_expr *expr)
-{
- gfc_component *c = gfc_get_proc_ptr_comp (expr);
- if (c)
- return (c->ts.interface && (c->ts.interface->attr.proc_pointer == 1));
- else
- return ((expr->symtree->n.sym->result != expr->symtree->n.sym)
- && (expr->symtree->n.sym->result->attr.proc_pointer == 1));
-}
-
-
-/* Recursively append candidate argument ARG to CANDIDATES. Store the
- number of total candidates in CANDIDATES_LEN. */
-
-static void
-lookup_arg_fuzzy_find_candidates (gfc_formal_arglist *arg,
- char **&candidates,
- size_t &candidates_len)
-{
- for (gfc_formal_arglist *p = arg; p && p->sym; p = p->next)
- vec_push (candidates, candidates_len, p->sym->name);
-}
-
-
-/* Lookup argument ARG fuzzily, taking names in ARGUMENTS into account. */
-
-static const char*
-lookup_arg_fuzzy (const char *arg, gfc_formal_arglist *arguments)
-{
- char **candidates = NULL;
- size_t candidates_len = 0;
- lookup_arg_fuzzy_find_candidates (arguments, candidates, candidates_len);
- return gfc_closest_fuzzy_match (arg, candidates);
-}
-
-
-static gfc_dummy_arg *
-get_nonintrinsic_dummy_arg (gfc_formal_arglist *formal)
-{
- gfc_dummy_arg * const dummy_arg = gfc_get_dummy_arg ();
-
- dummy_arg->intrinsicness = GFC_NON_INTRINSIC_DUMMY_ARG;
- dummy_arg->u.non_intrinsic = formal;
-
- return dummy_arg;
-}
-
-
-/* Given formal and actual argument lists, see if they are compatible.
- If they are compatible, the actual argument list is sorted to
- correspond with the formal list, and elements for missing optional
- arguments are inserted. If WHERE pointer is nonnull, then we issue
- errors when things don't match instead of just returning the status
- code. */
-
-bool
-gfc_compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
- int ranks_must_agree, int is_elemental,
- bool in_statement_function, locus *where)
-{
- gfc_actual_arglist **new_arg, *a, *actual;
- gfc_formal_arglist *f;
- int i, n, na;
- unsigned long actual_size, formal_size;
- bool full_array = false;
- gfc_array_ref *actual_arr_ref;
- gfc_array_spec *fas, *aas;
- bool pointer_dummy, pointer_arg, allocatable_arg;
-
- bool ok = true;
-
- actual = *ap;
-
- if (actual == NULL && formal == NULL)
- return true;
-
- n = 0;
- for (f = formal; f; f = f->next)
- n++;
-
- new_arg = XALLOCAVEC (gfc_actual_arglist *, n);
-
- for (i = 0; i < n; i++)
- new_arg[i] = NULL;
-
- na = 0;
- f = formal;
- i = 0;
-
- for (a = actual; a; a = a->next, f = f->next)
- {
- if (a->name != NULL && in_statement_function)
- {
- gfc_error ("Keyword argument %qs at %L is invalid in "
- "a statement function", a->name, &a->expr->where);
- return false;
- }
-
- /* Look for keywords but ignore g77 extensions like %VAL. */
- if (a->name != NULL && a->name[0] != '%')
- {
- i = 0;
- for (f = formal; f; f = f->next, i++)
- {
- if (f->sym == NULL)
- continue;
- if (strcmp (f->sym->name, a->name) == 0)
- break;
- }
-
- if (f == NULL)
- {
- if (where)
- {
- const char *guessed = lookup_arg_fuzzy (a->name, formal);
- if (guessed)
- gfc_error ("Keyword argument %qs at %L is not in "
- "the procedure; did you mean %qs?",
- a->name, &a->expr->where, guessed);
- else
- gfc_error ("Keyword argument %qs at %L is not in "
- "the procedure", a->name, &a->expr->where);
- }
- return false;
- }
-
- if (new_arg[i] != NULL)
- {
- if (where)
- gfc_error ("Keyword argument %qs at %L is already associated "
- "with another actual argument", a->name,
- &a->expr->where);
- return false;
- }
- }
-
- if (f == NULL)
- {
- if (where)
- gfc_error ("More actual than formal arguments in procedure "
- "call at %L", where);
- return false;
- }
-
- if (f->sym == NULL && a->expr == NULL)
- goto match;
-
- if (f->sym == NULL)
- {
- /* These errors have to be issued, otherwise an ICE can occur.
- See PR 78865. */
- if (where)
- gfc_error_now ("Missing alternate return specifier in subroutine "
- "call at %L", where);
- return false;
- }
- else
- a->associated_dummy = get_nonintrinsic_dummy_arg (f);
-
- if (a->expr == NULL)
- {
- if (f->sym->attr.optional)
- continue;
- else
- {
- if (where)
- gfc_error_now ("Unexpected alternate return specifier in "
- "subroutine call at %L", where);
- return false;
- }
- }
-
- /* Make sure that intrinsic vtables exist for calls to unlimited
- polymorphic formal arguments. */
- if (UNLIMITED_POLY (f->sym)
- && a->expr->ts.type != BT_DERIVED
- && a->expr->ts.type != BT_CLASS
- && a->expr->ts.type != BT_ASSUMED)
- gfc_find_vtab (&a->expr->ts);
-
- if (a->expr->expr_type == EXPR_NULL
- && ((f->sym->ts.type != BT_CLASS && !f->sym->attr.pointer
- && (f->sym->attr.allocatable || !f->sym->attr.optional
- || (gfc_option.allow_std & GFC_STD_F2008) == 0))
- || (f->sym->ts.type == BT_CLASS
- && !CLASS_DATA (f->sym)->attr.class_pointer
- && (CLASS_DATA (f->sym)->attr.allocatable
- || !f->sym->attr.optional
- || (gfc_option.allow_std & GFC_STD_F2008) == 0))))
- {
- if (where
- && (!f->sym->attr.optional
- || (f->sym->ts.type != BT_CLASS && f->sym->attr.allocatable)
- || (f->sym->ts.type == BT_CLASS
- && CLASS_DATA (f->sym)->attr.allocatable)))
- gfc_error ("Unexpected NULL() intrinsic at %L to dummy %qs",
- where, f->sym->name);
- else if (where)
- gfc_error ("Fortran 2008: Null pointer at %L to non-pointer "
- "dummy %qs", where, f->sym->name);
- ok = false;
- goto match;
- }
-
- if (!compare_parameter (f->sym, a->expr, ranks_must_agree,
- is_elemental, where))
- {
- ok = false;
- goto match;
- }
-
- /* TS 29113, 6.3p2; F2018 15.5.2.4. */
- if (f->sym->ts.type == BT_ASSUMED
- && (a->expr->ts.type == BT_DERIVED
- || (a->expr->ts.type == BT_CLASS && CLASS_DATA (a->expr))))
- {
- gfc_symbol *derived = (a->expr->ts.type == BT_DERIVED
- ? a->expr->ts.u.derived
- : CLASS_DATA (a->expr)->ts.u.derived);
- gfc_namespace *f2k_derived = derived->f2k_derived;
- if (derived->attr.pdt_type
- || (f2k_derived
- && (f2k_derived->finalizers || f2k_derived->tb_sym_root)))
- {
- gfc_error ("Actual argument at %L to assumed-type dummy "
- "has type parameters or is of "
- "derived type with type-bound or FINAL procedures",
- &a->expr->where);
- ok = false;
- goto match;
- }
- }
-
- /* Special case for character arguments. For allocatable, pointer
- and assumed-shape dummies, the string length needs to match
- exactly. */
- if (a->expr->ts.type == BT_CHARACTER
- && a->expr->ts.u.cl && a->expr->ts.u.cl->length
- && a->expr->ts.u.cl->length->expr_type == EXPR_CONSTANT
- && f->sym->ts.type == BT_CHARACTER && f->sym->ts.u.cl
- && f->sym->ts.u.cl->length
- && f->sym->ts.u.cl->length->expr_type == EXPR_CONSTANT
- && (f->sym->attr.pointer || f->sym->attr.allocatable
- || (f->sym->as && f->sym->as->type == AS_ASSUMED_SHAPE))
- && (mpz_cmp (a->expr->ts.u.cl->length->value.integer,
- f->sym->ts.u.cl->length->value.integer) != 0))
- {
- if (where && (f->sym->attr.pointer || f->sym->attr.allocatable))
- gfc_warning (0, "Character length mismatch (%ld/%ld) between actual "
- "argument and pointer or allocatable dummy argument "
- "%qs at %L",
- mpz_get_si (a->expr->ts.u.cl->length->value.integer),
- mpz_get_si (f->sym->ts.u.cl->length->value.integer),
- f->sym->name, &a->expr->where);
- else if (where)
- gfc_warning (0, "Character length mismatch (%ld/%ld) between actual "
- "argument and assumed-shape dummy argument %qs "
- "at %L",
- mpz_get_si (a->expr->ts.u.cl->length->value.integer),
- mpz_get_si (f->sym->ts.u.cl->length->value.integer),
- f->sym->name, &a->expr->where);
- ok = false;
- goto match;
- }
-
- if ((f->sym->attr.pointer || f->sym->attr.allocatable)
- && f->sym->ts.deferred != a->expr->ts.deferred
- && a->expr->ts.type == BT_CHARACTER)
- {
- if (where)
- gfc_error ("Actual argument at %L to allocatable or "
- "pointer dummy argument %qs must have a deferred "
- "length type parameter if and only if the dummy has one",
- &a->expr->where, f->sym->name);
- ok = false;
- goto match;
- }
-
- if (f->sym->ts.type == BT_CLASS)
- goto skip_size_check;
-
- actual_size = get_expr_storage_size (a->expr);
- formal_size = get_sym_storage_size (f->sym);
- if (actual_size != 0 && actual_size < formal_size
- && a->expr->ts.type != BT_PROCEDURE
- && f->sym->attr.flavor != FL_PROCEDURE)
- {
- if (a->expr->ts.type == BT_CHARACTER && !f->sym->as && where)
- {
- gfc_warning (0, "Character length of actual argument shorter "
- "than of dummy argument %qs (%lu/%lu) at %L",
- f->sym->name, actual_size, formal_size,
- &a->expr->where);
- goto skip_size_check;
- }
- else if (where)
- {
- /* Emit a warning for -std=legacy and an error otherwise. */
- if (gfc_option.warn_std == 0)
- gfc_warning (0, "Actual argument contains too few "
- "elements for dummy argument %qs (%lu/%lu) "
- "at %L", f->sym->name, actual_size,
- formal_size, &a->expr->where);
- else
- gfc_error_now ("Actual argument contains too few "
- "elements for dummy argument %qs (%lu/%lu) "
- "at %L", f->sym->name, actual_size,
- formal_size, &a->expr->where);
- }
- ok = false;
- goto match;
- }
-
- skip_size_check:
-
- /* Satisfy F03:12.4.1.3 by ensuring that a procedure pointer actual
- argument is provided for a procedure pointer formal argument. */
- if (f->sym->attr.proc_pointer
- && !((a->expr->expr_type == EXPR_VARIABLE
- && (a->expr->symtree->n.sym->attr.proc_pointer
- || gfc_is_proc_ptr_comp (a->expr)))
- || (a->expr->expr_type == EXPR_FUNCTION
- && is_procptr_result (a->expr))))
- {
- if (where)
- gfc_error ("Expected a procedure pointer for argument %qs at %L",
- f->sym->name, &a->expr->where);
- ok = false;
- goto match;
- }
-
- /* Satisfy F03:12.4.1.3 by ensuring that a procedure actual argument is
- provided for a procedure formal argument. */
- if (f->sym->attr.flavor == FL_PROCEDURE
- && !((a->expr->expr_type == EXPR_VARIABLE
- && (a->expr->symtree->n.sym->attr.flavor == FL_PROCEDURE
- || a->expr->symtree->n.sym->attr.proc_pointer
- || gfc_is_proc_ptr_comp (a->expr)))
- || (a->expr->expr_type == EXPR_FUNCTION
- && is_procptr_result (a->expr))))
- {
- if (where)
- gfc_error ("Expected a procedure for argument %qs at %L",
- f->sym->name, &a->expr->where);
- ok = false;
- goto match;
- }
-
- /* Class array variables and expressions store array info in a
- different place from non-class objects; consolidate the logic
- to access it here instead of repeating it below. Note that
- pointer_arg and allocatable_arg are not fully general and are
- only used in a specific situation below with an assumed-rank
- argument. */
- if (f->sym->ts.type == BT_CLASS && CLASS_DATA (f->sym))
- {
- gfc_component *classdata = CLASS_DATA (f->sym);
- fas = classdata->as;
- pointer_dummy = classdata->attr.class_pointer;
- }
- else
- {
- fas = f->sym->as;
- pointer_dummy = f->sym->attr.pointer;
- }
-
- if (a->expr->expr_type != EXPR_VARIABLE)
- {
- aas = NULL;
- pointer_arg = false;
- allocatable_arg = false;
- }
- else if (a->expr->ts.type == BT_CLASS
- && a->expr->symtree->n.sym
- && CLASS_DATA (a->expr->symtree->n.sym))
- {
- gfc_component *classdata = CLASS_DATA (a->expr->symtree->n.sym);
- aas = classdata->as;
- pointer_arg = classdata->attr.class_pointer;
- allocatable_arg = classdata->attr.allocatable;
- }
- else
- {
- aas = a->expr->symtree->n.sym->as;
- pointer_arg = a->expr->symtree->n.sym->attr.pointer;
- allocatable_arg = a->expr->symtree->n.sym->attr.allocatable;
- }
-
- /* F2018:9.5.2(2) permits assumed-size whole array expressions as
- actual arguments only if the shape is not required; thus it
- cannot be passed to an assumed-shape array dummy.
- F2018:15.5.2.(2) permits passing a nonpointer actual to an
- intent(in) pointer dummy argument and this is accepted by
- the compare_pointer check below, but this also requires shape
- information.
- There's more discussion of this in PR94110. */
- if (fas
- && (fas->type == AS_ASSUMED_SHAPE
- || fas->type == AS_DEFERRED
- || (fas->type == AS_ASSUMED_RANK && pointer_dummy))
- && aas
- && aas->type == AS_ASSUMED_SIZE
- && (a->expr->ref == NULL
- || (a->expr->ref->type == REF_ARRAY
- && a->expr->ref->u.ar.type == AR_FULL)))
- {
- if (where)
- gfc_error ("Actual argument for %qs cannot be an assumed-size"
- " array at %L", f->sym->name, where);
- ok = false;
- goto match;
- }
-
- /* Diagnose F2018 C839 (TS29113 C535c). Here the problem is
- passing an assumed-size array to an INTENT(OUT) assumed-rank
- dummy when it doesn't have the size information needed to run
- initializers and finalizers. */
- if (f->sym->attr.intent == INTENT_OUT
- && fas
- && fas->type == AS_ASSUMED_RANK
- && aas
- && ((aas->type == AS_ASSUMED_SIZE
- && (a->expr->ref == NULL
- || (a->expr->ref->type == REF_ARRAY
- && a->expr->ref->u.ar.type == AR_FULL)))
- || (aas->type == AS_ASSUMED_RANK
- && !pointer_arg
- && !allocatable_arg))
- && (a->expr->ts.type == BT_CLASS
- || (a->expr->ts.type == BT_DERIVED
- && (gfc_is_finalizable (a->expr->ts.u.derived, NULL)
- || gfc_has_ultimate_allocatable (a->expr)
- || gfc_has_default_initializer
- (a->expr->ts.u.derived)))))
- {
- if (where)
- gfc_error ("Actual argument to assumed-rank INTENT(OUT) "
- "dummy %qs at %L cannot be of unknown size",
- f->sym->name, where);
- ok = false;
- goto match;
- }
-
- if (a->expr->expr_type != EXPR_NULL
- && compare_pointer (f->sym, a->expr) == 0)
- {
- if (where)
- gfc_error ("Actual argument for %qs must be a pointer at %L",
- f->sym->name, &a->expr->where);
- ok = false;
- goto match;
- }
-
- if (a->expr->expr_type != EXPR_NULL
- && (gfc_option.allow_std & GFC_STD_F2008) == 0
- && compare_pointer (f->sym, a->expr) == 2)
- {
- if (where)
- gfc_error ("Fortran 2008: Non-pointer actual argument at %L to "
- "pointer dummy %qs", &a->expr->where,f->sym->name);
- ok = false;
- goto match;
- }
-
-
- /* Fortran 2008, C1242. */
- if (f->sym->attr.pointer && gfc_is_coindexed (a->expr))
- {
- if (where)
- gfc_error ("Coindexed actual argument at %L to pointer "
- "dummy %qs",
- &a->expr->where, f->sym->name);
- ok = false;
- goto match;
- }
-
- /* Fortran 2008, 12.5.2.5 (no constraint). */
- if (a->expr->expr_type == EXPR_VARIABLE
- && f->sym->attr.intent != INTENT_IN
- && f->sym->attr.allocatable
- && gfc_is_coindexed (a->expr))
- {
- if (where)
- gfc_error ("Coindexed actual argument at %L to allocatable "
- "dummy %qs requires INTENT(IN)",
- &a->expr->where, f->sym->name);
- ok = false;
- goto match;
- }
-
- /* Fortran 2008, C1237. */
- if (a->expr->expr_type == EXPR_VARIABLE
- && (f->sym->attr.asynchronous || f->sym->attr.volatile_)
- && gfc_is_coindexed (a->expr)
- && (a->expr->symtree->n.sym->attr.volatile_
- || a->expr->symtree->n.sym->attr.asynchronous))
- {
- if (where)
- gfc_error ("Coindexed ASYNCHRONOUS or VOLATILE actual argument at "
- "%L requires that dummy %qs has neither "
- "ASYNCHRONOUS nor VOLATILE", &a->expr->where,
- f->sym->name);
- ok = false;
- goto match;
- }
-
- /* Fortran 2008, 12.5.2.4 (no constraint). */
- if (a->expr->expr_type == EXPR_VARIABLE
- && f->sym->attr.intent != INTENT_IN && !f->sym->attr.value
- && gfc_is_coindexed (a->expr)
- && gfc_has_ultimate_allocatable (a->expr))
- {
- if (where)
- gfc_error ("Coindexed actual argument at %L with allocatable "
- "ultimate component to dummy %qs requires either VALUE "
- "or INTENT(IN)", &a->expr->where, f->sym->name);
- ok = false;
- goto match;
- }
-
- if (f->sym->ts.type == BT_CLASS
- && CLASS_DATA (f->sym)->attr.allocatable
- && gfc_is_class_array_ref (a->expr, &full_array)
- && !full_array)
- {
- if (where)
- gfc_error ("Actual CLASS array argument for %qs must be a full "
- "array at %L", f->sym->name, &a->expr->where);
- ok = false;
- goto match;
- }
-
-
- if (a->expr->expr_type != EXPR_NULL
- && !compare_allocatable (f->sym, a->expr))
- {
- if (where)
- gfc_error ("Actual argument for %qs must be ALLOCATABLE at %L",
- f->sym->name, &a->expr->where);
- ok = false;
- goto match;
- }
-
- /* Check intent = OUT/INOUT for definable actual argument. */
- if (!in_statement_function
- && (f->sym->attr.intent == INTENT_OUT
- || f->sym->attr.intent == INTENT_INOUT))
- {
- const char* context = (where
- ? _("actual argument to INTENT = OUT/INOUT")
- : NULL);
-
- if (((f->sym->ts.type == BT_CLASS && f->sym->attr.class_ok
- && CLASS_DATA (f->sym)->attr.class_pointer)
- || (f->sym->ts.type != BT_CLASS && f->sym->attr.pointer))
- && !gfc_check_vardef_context (a->expr, true, false, false, context))
- {
- ok = false;
- goto match;
- }
- if (!gfc_check_vardef_context (a->expr, false, false, false, context))
- {
- ok = false;
- goto match;
- }
- }
-
- if ((f->sym->attr.intent == INTENT_OUT
- || f->sym->attr.intent == INTENT_INOUT
- || f->sym->attr.volatile_
- || f->sym->attr.asynchronous)
- && gfc_has_vector_subscript (a->expr))
- {
- if (where)
- gfc_error ("Array-section actual argument with vector "
- "subscripts at %L is incompatible with INTENT(OUT), "
- "INTENT(INOUT), VOLATILE or ASYNCHRONOUS attribute "
- "of the dummy argument %qs",
- &a->expr->where, f->sym->name);
- ok = false;
- goto match;
- }
-
- /* C1232 (R1221) For an actual argument which is an array section or
- an assumed-shape array, the dummy argument shall be an assumed-
- shape array, if the dummy argument has the VOLATILE attribute. */
-
- if (f->sym->attr.volatile_
- && a->expr->expr_type == EXPR_VARIABLE
- && a->expr->symtree->n.sym->as
- && a->expr->symtree->n.sym->as->type == AS_ASSUMED_SHAPE
- && !(fas && fas->type == AS_ASSUMED_SHAPE))
- {
- if (where)
- gfc_error ("Assumed-shape actual argument at %L is "
- "incompatible with the non-assumed-shape "
- "dummy argument %qs due to VOLATILE attribute",
- &a->expr->where,f->sym->name);
- ok = false;
- goto match;
- }
-
- /* Find the last array_ref. */
- actual_arr_ref = NULL;
- if (a->expr->ref)
- actual_arr_ref = gfc_find_array_ref (a->expr, true);
-
- if (f->sym->attr.volatile_
- && actual_arr_ref && actual_arr_ref->type == AR_SECTION
- && !(fas && fas->type == AS_ASSUMED_SHAPE))
- {
- if (where)
- gfc_error ("Array-section actual argument at %L is "
- "incompatible with the non-assumed-shape "
- "dummy argument %qs due to VOLATILE attribute",
- &a->expr->where, f->sym->name);
- ok = false;
- goto match;
- }
-
- /* C1233 (R1221) For an actual argument which is a pointer array, the
- dummy argument shall be an assumed-shape or pointer array, if the
- dummy argument has the VOLATILE attribute. */
-
- if (f->sym->attr.volatile_
- && a->expr->expr_type == EXPR_VARIABLE
- && a->expr->symtree->n.sym->attr.pointer
- && a->expr->symtree->n.sym->as
- && !(fas
- && (fas->type == AS_ASSUMED_SHAPE
- || f->sym->attr.pointer)))
- {
- if (where)
- gfc_error ("Pointer-array actual argument at %L requires "
- "an assumed-shape or pointer-array dummy "
- "argument %qs due to VOLATILE attribute",
- &a->expr->where,f->sym->name);
- ok = false;
- goto match;
- }
-
- match:
- if (a == actual)
- na = i;
-
- new_arg[i++] = a;
- }
-
- /* Give up now if we saw any bad argument. */
- if (!ok)
- return false;
-
- /* Make sure missing actual arguments are optional. */
- i = 0;
- for (f = formal; f; f = f->next, i++)
- {
- if (new_arg[i] != NULL)
- continue;
- if (f->sym == NULL)
- {
- if (where)
- gfc_error ("Missing alternate return spec in subroutine call "
- "at %L", where);
- return false;
- }
- /* For CLASS, the optional attribute might be set at either location. */
- if (((f->sym->ts.type != BT_CLASS || !CLASS_DATA (f->sym)->attr.optional)
- && !f->sym->attr.optional)
- || (in_statement_function
- && (f->sym->attr.optional
- || (f->sym->ts.type == BT_CLASS
- && CLASS_DATA (f->sym)->attr.optional))))
- {
- if (where)
- gfc_error ("Missing actual argument for argument %qs at %L",
- f->sym->name, where);
- return false;
- }
- }
-
- /* We should have handled the cases where the formal arglist is null
- already. */
- gcc_assert (n > 0);
-
- /* The argument lists are compatible. We now relink a new actual
- argument list with null arguments in the right places. The head
- of the list remains the head. */
- for (f = formal, i = 0; f; f = f->next, i++)
- if (new_arg[i] == NULL)
- {
- new_arg[i] = gfc_get_actual_arglist ();
- new_arg[i]->associated_dummy = get_nonintrinsic_dummy_arg (f);
- }
-
- if (na != 0)
- {
- std::swap (*new_arg[0], *actual);
- std::swap (new_arg[0], new_arg[na]);
- }
-
- for (i = 0; i < n - 1; i++)
- new_arg[i]->next = new_arg[i + 1];
-
- new_arg[i]->next = NULL;
-
- if (*ap == NULL && n > 0)
- *ap = new_arg[0];
-
- return true;
-}
-
-
-typedef struct
-{
- gfc_formal_arglist *f;
- gfc_actual_arglist *a;
-}
-argpair;
-
-/* qsort comparison function for argument pairs, with the following
- order:
- - p->a->expr == NULL
- - p->a->expr->expr_type != EXPR_VARIABLE
- - by gfc_symbol pointer value (larger first). */
-
-static int
-pair_cmp (const void *p1, const void *p2)
-{
- const gfc_actual_arglist *a1, *a2;
-
- /* *p1 and *p2 are elements of the to-be-sorted array. */
- a1 = ((const argpair *) p1)->a;
- a2 = ((const argpair *) p2)->a;
- if (!a1->expr)
- {
- if (!a2->expr)
- return 0;
- return -1;
- }
- if (!a2->expr)
- return 1;
- if (a1->expr->expr_type != EXPR_VARIABLE)
- {
- if (a2->expr->expr_type != EXPR_VARIABLE)
- return 0;
- return -1;
- }
- if (a2->expr->expr_type != EXPR_VARIABLE)
- return 1;
- if (a1->expr->symtree->n.sym > a2->expr->symtree->n.sym)
- return -1;
- return a1->expr->symtree->n.sym < a2->expr->symtree->n.sym;
-}
-
-
-/* Given two expressions from some actual arguments, test whether they
- refer to the same expression. The analysis is conservative.
- Returning false will produce no warning. */
-
-static bool
-compare_actual_expr (gfc_expr *e1, gfc_expr *e2)
-{
- const gfc_ref *r1, *r2;
-
- if (!e1 || !e2
- || e1->expr_type != EXPR_VARIABLE
- || e2->expr_type != EXPR_VARIABLE
- || e1->symtree->n.sym != e2->symtree->n.sym)
- return false;
-
- /* TODO: improve comparison, see expr.c:show_ref(). */
- for (r1 = e1->ref, r2 = e2->ref; r1 && r2; r1 = r1->next, r2 = r2->next)
- {
- if (r1->type != r2->type)
- return false;
- switch (r1->type)
- {
- case REF_ARRAY:
- if (r1->u.ar.type != r2->u.ar.type)
- return false;
- /* TODO: At the moment, consider only full arrays;
- we could do better. */
- if (r1->u.ar.type != AR_FULL || r2->u.ar.type != AR_FULL)
- return false;
- break;
-
- case REF_COMPONENT:
- if (r1->u.c.component != r2->u.c.component)
- return false;
- break;
-
- case REF_SUBSTRING:
- return false;
-
- case REF_INQUIRY:
- if (e1->symtree->n.sym->ts.type == BT_COMPLEX
- && e1->ts.type == BT_REAL && e2->ts.type == BT_REAL
- && r1->u.i != r2->u.i)
- return false;
- break;
-
- default:
- gfc_internal_error ("compare_actual_expr(): Bad component code");
- }
- }
- if (!r1 && !r2)
- return true;
- return false;
-}
-
-
-/* Given formal and actual argument lists that correspond to one
- another, check that identical actual arguments aren't not
- associated with some incompatible INTENTs. */
-
-static bool
-check_some_aliasing (gfc_formal_arglist *f, gfc_actual_arglist *a)
-{
- sym_intent f1_intent, f2_intent;
- gfc_formal_arglist *f1;
- gfc_actual_arglist *a1;
- size_t n, i, j;
- argpair *p;
- bool t = true;
-
- n = 0;
- for (f1 = f, a1 = a;; f1 = f1->next, a1 = a1->next)
- {
- if (f1 == NULL && a1 == NULL)
- break;
- if (f1 == NULL || a1 == NULL)
- gfc_internal_error ("check_some_aliasing(): List mismatch");
- n++;
- }
- if (n == 0)
- return t;
- p = XALLOCAVEC (argpair, n);
-
- for (i = 0, f1 = f, a1 = a; i < n; i++, f1 = f1->next, a1 = a1->next)
- {
- p[i].f = f1;
- p[i].a = a1;
- }
-
- qsort (p, n, sizeof (argpair), pair_cmp);
-
- for (i = 0; i < n; i++)
- {
- if (!p[i].a->expr
- || p[i].a->expr->expr_type != EXPR_VARIABLE
- || p[i].a->expr->ts.type == BT_PROCEDURE)
- continue;
- f1_intent = p[i].f->sym->attr.intent;
- for (j = i + 1; j < n; j++)
- {
- /* Expected order after the sort. */
- if (!p[j].a->expr || p[j].a->expr->expr_type != EXPR_VARIABLE)
- gfc_internal_error ("check_some_aliasing(): corrupted data");
-
- /* Are the expression the same? */
- if (!compare_actual_expr (p[i].a->expr, p[j].a->expr))
- break;
- f2_intent = p[j].f->sym->attr.intent;
- if ((f1_intent == INTENT_IN && f2_intent == INTENT_OUT)
- || (f1_intent == INTENT_OUT && f2_intent == INTENT_IN)
- || (f1_intent == INTENT_OUT && f2_intent == INTENT_OUT))
- {
- gfc_warning (0, "Same actual argument associated with INTENT(%s) "
- "argument %qs and INTENT(%s) argument %qs at %L",
- gfc_intent_string (f1_intent), p[i].f->sym->name,
- gfc_intent_string (f2_intent), p[j].f->sym->name,
- &p[i].a->expr->where);
- t = false;
- }
- }
- }
-
- return t;
-}
-
-
-/* Given formal and actual argument lists that correspond to one
- another, check that they are compatible in the sense that intents
- are not mismatched. */
-
-static bool
-check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a)
-{
- sym_intent f_intent;
-
- for (;; f = f->next, a = a->next)
- {
- gfc_expr *expr;
-
- if (f == NULL && a == NULL)
- break;
- if (f == NULL || a == NULL)
- gfc_internal_error ("check_intents(): List mismatch");
-
- if (a->expr && a->expr->expr_type == EXPR_FUNCTION
- && a->expr->value.function.isym
- && a->expr->value.function.isym->id == GFC_ISYM_CAF_GET)
- expr = a->expr->value.function.actual->expr;
- else
- expr = a->expr;
-
- if (expr == NULL || expr->expr_type != EXPR_VARIABLE)
- continue;
-
- f_intent = f->sym->attr.intent;
-
- if (gfc_pure (NULL) && gfc_impure_variable (expr->symtree->n.sym))
- {
- if ((f->sym->ts.type == BT_CLASS && f->sym->attr.class_ok
- && CLASS_DATA (f->sym)->attr.class_pointer)
- || (f->sym->ts.type != BT_CLASS && f->sym->attr.pointer))
- {
- gfc_error ("Procedure argument at %L is local to a PURE "
- "procedure and has the POINTER attribute",
- &expr->where);
- return false;
- }
- }
-
- /* Fortran 2008, C1283. */
- if (gfc_pure (NULL) && gfc_is_coindexed (expr))
- {
- if (f_intent == INTENT_INOUT || f_intent == INTENT_OUT)
- {
- gfc_error ("Coindexed actual argument at %L in PURE procedure "
- "is passed to an INTENT(%s) argument",
- &expr->where, gfc_intent_string (f_intent));
- return false;
- }
-
- if ((f->sym->ts.type == BT_CLASS && f->sym->attr.class_ok
- && CLASS_DATA (f->sym)->attr.class_pointer)
- || (f->sym->ts.type != BT_CLASS && f->sym->attr.pointer))
- {
- gfc_error ("Coindexed actual argument at %L in PURE procedure "
- "is passed to a POINTER dummy argument",
- &expr->where);
- return false;
- }
- }
-
- /* F2008, Section 12.5.2.4. */
- if (expr->ts.type == BT_CLASS && f->sym->ts.type == BT_CLASS
- && gfc_is_coindexed (expr))
- {
- gfc_error ("Coindexed polymorphic actual argument at %L is passed "
- "polymorphic dummy argument %qs",
- &expr->where, f->sym->name);
- return false;
- }
- }
-
- return true;
-}
-
-
-/* Check how a procedure is used against its interface. If all goes
- well, the actual argument list will also end up being properly
- sorted. */
-
-bool
-gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
-{
- gfc_actual_arglist *a;
- gfc_formal_arglist *dummy_args;
- bool implicit = false;
-
- /* Warn about calls with an implicit interface. Special case
- for calling a ISO_C_BINDING because c_loc and c_funloc
- are pseudo-unknown. Additionally, warn about procedures not
- explicitly declared at all if requested. */
- if (sym->attr.if_source == IFSRC_UNKNOWN && !sym->attr.is_iso_c)
- {
- bool has_implicit_none_export = false;
- implicit = true;
- if (sym->attr.proc == PROC_UNKNOWN)
- for (gfc_namespace *ns = sym->ns; ns; ns = ns->parent)
- if (ns->has_implicit_none_export)
- {
- has_implicit_none_export = true;
- break;
- }
- if (has_implicit_none_export)
- {
- const char *guessed
- = gfc_lookup_function_fuzzy (sym->name, sym->ns->sym_root);
- if (guessed)
- gfc_error ("Procedure %qs called at %L is not explicitly declared"
- "; did you mean %qs?",
- sym->name, where, guessed);
- else
- gfc_error ("Procedure %qs called at %L is not explicitly declared",
- sym->name, where);
- return false;
- }
- if (warn_implicit_interface)
- gfc_warning (OPT_Wimplicit_interface,
- "Procedure %qs called with an implicit interface at %L",
- sym->name, where);
- else if (warn_implicit_procedure && sym->attr.proc == PROC_UNKNOWN)
- gfc_warning (OPT_Wimplicit_procedure,
- "Procedure %qs called at %L is not explicitly declared",
- sym->name, where);
- gfc_find_proc_namespace (sym->ns)->implicit_interface_calls = 1;
- }
-
- if (sym->attr.if_source == IFSRC_UNKNOWN)
- {
- if (sym->attr.pointer)
- {
- gfc_error ("The pointer object %qs at %L must have an explicit "
- "function interface or be declared as array",
- sym->name, where);
- return false;
- }
-
- if (sym->attr.allocatable && !sym->attr.external)
- {
- gfc_error ("The allocatable object %qs at %L must have an explicit "
- "function interface or be declared as array",
- sym->name, where);
- return false;
- }
-
- if (sym->attr.allocatable)
- {
- gfc_error ("Allocatable function %qs at %L must have an explicit "
- "function interface", sym->name, where);
- return false;
- }
-
- for (a = *ap; a; a = a->next)
- {
- if (a->expr && a->expr->error)
- return false;
-
- /* F2018, 15.4.2.2 Explicit interface is required for a
- polymorphic dummy argument, so there is no way to
- legally have a class appear in an argument with an
- implicit interface. */
-
- if (implicit && a->expr && a->expr->ts.type == BT_CLASS)
- {
- gfc_error ("Explicit interface required for polymorphic "
- "argument at %L",&a->expr->where);
- a->expr->error = 1;
- break;
- }
-
- /* Skip g77 keyword extensions like %VAL, %REF, %LOC. */
- if (a->name != NULL && a->name[0] != '%')
- {
- gfc_error ("Keyword argument requires explicit interface "
- "for procedure %qs at %L", sym->name, &a->expr->where);
- break;
- }
-
- /* TS 29113, 6.2. */
- if (a->expr && a->expr->ts.type == BT_ASSUMED
- && sym->intmod_sym_id != ISOCBINDING_LOC)
- {
- gfc_error ("Assumed-type argument %s at %L requires an explicit "
- "interface", a->expr->symtree->n.sym->name,
- &a->expr->where);
- a->expr->error = 1;
- break;
- }
-
- /* F2008, C1303 and C1304. */
- if (a->expr
- && (a->expr->ts.type == BT_DERIVED || a->expr->ts.type == BT_CLASS)
- && a->expr->ts.u.derived
- && ((a->expr->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
- && a->expr->ts.u.derived->intmod_sym_id == ISOFORTRAN_LOCK_TYPE)
- || gfc_expr_attr (a->expr).lock_comp))
- {
- gfc_error ("Actual argument of LOCK_TYPE or with LOCK_TYPE "
- "component at %L requires an explicit interface for "
- "procedure %qs", &a->expr->where, sym->name);
- a->expr->error = 1;
- break;
- }
-
- if (a->expr
- && (a->expr->ts.type == BT_DERIVED || a->expr->ts.type == BT_CLASS)
- && a->expr->ts.u.derived
- && ((a->expr->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
- && a->expr->ts.u.derived->intmod_sym_id
- == ISOFORTRAN_EVENT_TYPE)
- || gfc_expr_attr (a->expr).event_comp))
- {
- gfc_error ("Actual argument of EVENT_TYPE or with EVENT_TYPE "
- "component at %L requires an explicit interface for "
- "procedure %qs", &a->expr->where, sym->name);
- a->expr->error = 1;
- break;
- }
-
- if (a->expr && a->expr->expr_type == EXPR_NULL
- && a->expr->ts.type == BT_UNKNOWN)
- {
- gfc_error ("MOLD argument to NULL required at %L",
- &a->expr->where);
- a->expr->error = 1;
- return false;
- }
-
- /* TS 29113, C407b. */
- if (a->expr && a->expr->expr_type == EXPR_VARIABLE
- && symbol_rank (a->expr->symtree->n.sym) == -1)
- {
- gfc_error ("Assumed-rank argument requires an explicit interface "
- "at %L", &a->expr->where);
- a->expr->error = 1;
- return false;
- }
- }
-
- return true;
- }
-
- dummy_args = gfc_sym_get_dummy_args (sym);
-
- /* For a statement function, check that types and type parameters of actual
- arguments and dummy arguments match. */
- if (!gfc_compare_actual_formal (ap, dummy_args, 0, sym->attr.elemental,
- sym->attr.proc == PROC_ST_FUNCTION, where))
- return false;
-
- if (!check_intents (dummy_args, *ap))
- return false;
-
- if (warn_aliasing)
- check_some_aliasing (dummy_args, *ap);
-
- return true;
-}
-
-
-/* Check how a procedure pointer component is used against its interface.
- If all goes well, the actual argument list will also end up being properly
- sorted. Completely analogous to gfc_procedure_use. */
-
-void
-gfc_ppc_use (gfc_component *comp, gfc_actual_arglist **ap, locus *where)
-{
- /* Warn about calls with an implicit interface. Special case
- for calling a ISO_C_BINDING because c_loc and c_funloc
- are pseudo-unknown. */
- if (warn_implicit_interface
- && comp->attr.if_source == IFSRC_UNKNOWN
- && !comp->attr.is_iso_c)
- gfc_warning (OPT_Wimplicit_interface,
- "Procedure pointer component %qs called with an implicit "
- "interface at %L", comp->name, where);
-
- if (comp->attr.if_source == IFSRC_UNKNOWN)
- {
- gfc_actual_arglist *a;
- for (a = *ap; a; a = a->next)
- {
- /* Skip g77 keyword extensions like %VAL, %REF, %LOC. */
- if (a->name != NULL && a->name[0] != '%')
- {
- gfc_error ("Keyword argument requires explicit interface "
- "for procedure pointer component %qs at %L",
- comp->name, &a->expr->where);
- break;
- }
- }
-
- return;
- }
-
- if (!gfc_compare_actual_formal (ap, comp->ts.interface->formal, 0,
- comp->attr.elemental, false, where))
- return;
-
- check_intents (comp->ts.interface->formal, *ap);
- if (warn_aliasing)
- check_some_aliasing (comp->ts.interface->formal, *ap);
-}
-
-
-/* Try if an actual argument list matches the formal list of a symbol,
- respecting the symbol's attributes like ELEMENTAL. This is used for
- GENERIC resolution. */
-
-bool
-gfc_arglist_matches_symbol (gfc_actual_arglist** args, gfc_symbol* sym)
-{
- gfc_formal_arglist *dummy_args;
- bool r;
-
- if (sym->attr.flavor != FL_PROCEDURE)
- return false;
-
- dummy_args = gfc_sym_get_dummy_args (sym);
-
- r = !sym->attr.elemental;
- if (gfc_compare_actual_formal (args, dummy_args, r, !r, false, NULL))
- {
- check_intents (dummy_args, *args);
- if (warn_aliasing)
- check_some_aliasing (dummy_args, *args);
- return true;
- }
-
- return false;
-}
-
-
-/* Given an interface pointer and an actual argument list, search for
- a formal argument list that matches the actual. If found, returns
- a pointer to the symbol of the correct interface. Returns NULL if
- not found. */
-
-gfc_symbol *
-gfc_search_interface (gfc_interface *intr, int sub_flag,
- gfc_actual_arglist **ap)
-{
- gfc_symbol *elem_sym = NULL;
- gfc_symbol *null_sym = NULL;
- locus null_expr_loc;
- gfc_actual_arglist *a;
- bool has_null_arg = false;
-
- for (a = *ap; a; a = a->next)
- if (a->expr && a->expr->expr_type == EXPR_NULL
- && a->expr->ts.type == BT_UNKNOWN)
- {
- has_null_arg = true;
- null_expr_loc = a->expr->where;
- break;
- }
-
- for (; intr; intr = intr->next)
- {
- if (gfc_fl_struct (intr->sym->attr.flavor))
- continue;
- if (sub_flag && intr->sym->attr.function)
- continue;
- if (!sub_flag && intr->sym->attr.subroutine)
- continue;
-
- if (gfc_arglist_matches_symbol (ap, intr->sym))
- {
- if (has_null_arg && null_sym)
- {
- gfc_error ("MOLD= required in NULL() argument at %L: Ambiguity "
- "between specific functions %s and %s",
- &null_expr_loc, null_sym->name, intr->sym->name);
- return NULL;
- }
- else if (has_null_arg)
- {
- null_sym = intr->sym;
- continue;
- }
-
- /* Satisfy 12.4.4.1 such that an elemental match has lower
- weight than a non-elemental match. */
- if (intr->sym->attr.elemental)
- {
- elem_sym = intr->sym;
- continue;
- }
- return intr->sym;
- }
- }
-
- if (null_sym)
- return null_sym;
-
- return elem_sym ? elem_sym : NULL;
-}
-
-
-/* Do a brute force recursive search for a symbol. */
-
-static gfc_symtree *
-find_symtree0 (gfc_symtree *root, gfc_symbol *sym)
-{
- gfc_symtree * st;
-
- if (root->n.sym == sym)
- return root;
-
- st = NULL;
- if (root->left)
- st = find_symtree0 (root->left, sym);
- if (root->right && ! st)
- st = find_symtree0 (root->right, sym);
- return st;
-}
-
-
-/* Find a symtree for a symbol. */
-
-gfc_symtree *
-gfc_find_sym_in_symtree (gfc_symbol *sym)
-{
- gfc_symtree *st;
- gfc_namespace *ns;
-
- /* First try to find it by name. */
- gfc_find_sym_tree (sym->name, gfc_current_ns, 1, &st);
- if (st && st->n.sym == sym)
- return st;
-
- /* If it's been renamed, resort to a brute-force search. */
- /* TODO: avoid having to do this search. If the symbol doesn't exist
- in the symtree for the current namespace, it should probably be added. */
- for (ns = gfc_current_ns; ns; ns = ns->parent)
- {
- st = find_symtree0 (ns->sym_root, sym);
- if (st)
- return st;
- }
- gfc_internal_error ("Unable to find symbol %qs", sym->name);
- /* Not reached. */
-}
-
-
-/* See if the arglist to an operator-call contains a derived-type argument
- with a matching type-bound operator. If so, return the matching specific
- procedure defined as operator-target as well as the base-object to use
- (which is the found derived-type argument with operator). The generic
- name, if any, is transmitted to the final expression via 'gname'. */
-
-static gfc_typebound_proc*
-matching_typebound_op (gfc_expr** tb_base,
- gfc_actual_arglist* args,
- gfc_intrinsic_op op, const char* uop,
- const char ** gname)
-{
- gfc_actual_arglist* base;
-
- for (base = args; base; base = base->next)
- if (base->expr->ts.type == BT_DERIVED || base->expr->ts.type == BT_CLASS)
- {
- gfc_typebound_proc* tb;
- gfc_symbol* derived;
- bool result;
-
- while (base->expr->expr_type == EXPR_OP
- && base->expr->value.op.op == INTRINSIC_PARENTHESES)
- base->expr = base->expr->value.op.op1;
-
- if (base->expr->ts.type == BT_CLASS)
- {
- if (!base->expr->ts.u.derived || CLASS_DATA (base->expr) == NULL
- || !gfc_expr_attr (base->expr).class_ok)
- continue;
- derived = CLASS_DATA (base->expr)->ts.u.derived;
- }
- else
- derived = base->expr->ts.u.derived;
-
- if (op == INTRINSIC_USER)
- {
- gfc_symtree* tb_uop;
-
- gcc_assert (uop);
- tb_uop = gfc_find_typebound_user_op (derived, &result, uop,
- false, NULL);
-
- if (tb_uop)
- tb = tb_uop->n.tb;
- else
- tb = NULL;
- }
- else
- tb = gfc_find_typebound_intrinsic_op (derived, &result, op,
- false, NULL);
-
- /* This means we hit a PRIVATE operator which is use-associated and
- should thus not be seen. */
- if (!result)
- tb = NULL;
-
- /* Look through the super-type hierarchy for a matching specific
- binding. */
- for (; tb; tb = tb->overridden)
- {
- gfc_tbp_generic* g;
-
- gcc_assert (tb->is_generic);
- for (g = tb->u.generic; g; g = g->next)
- {
- gfc_symbol* target;
- gfc_actual_arglist* argcopy;
- bool matches;
-
- gcc_assert (g->specific);
- if (g->specific->error)
- continue;
-
- target = g->specific->u.specific->n.sym;
-
- /* Check if this arglist matches the formal. */
- argcopy = gfc_copy_actual_arglist (args);
- matches = gfc_arglist_matches_symbol (&argcopy, target);
- gfc_free_actual_arglist (argcopy);
-
- /* Return if we found a match. */
- if (matches)
- {
- *tb_base = base->expr;
- *gname = g->specific_st->name;
- return g->specific;
- }
- }
- }
- }
-
- return NULL;
-}
-
-
-/* For the 'actual arglist' of an operator call and a specific typebound
- procedure that has been found the target of a type-bound operator, build the
- appropriate EXPR_COMPCALL and resolve it. We take this indirection over
- type-bound procedures rather than resolving type-bound operators 'directly'
- so that we can reuse the existing logic. */
-
-static void
-build_compcall_for_operator (gfc_expr* e, gfc_actual_arglist* actual,
- gfc_expr* base, gfc_typebound_proc* target,
- const char *gname)
-{
- e->expr_type = EXPR_COMPCALL;
- e->value.compcall.tbp = target;
- e->value.compcall.name = gname ? gname : "$op";
- e->value.compcall.actual = actual;
- e->value.compcall.base_object = base;
- e->value.compcall.ignore_pass = 1;
- e->value.compcall.assign = 0;
- if (e->ts.type == BT_UNKNOWN
- && target->function)
- {
- if (target->is_generic)
- e->ts = target->u.generic->specific->u.specific->n.sym->ts;
- else
- e->ts = target->u.specific->n.sym->ts;
- }
-}
-
-
-/* This subroutine is called when an expression is being resolved.
- The expression node in question is either a user defined operator
- or an intrinsic operator with arguments that aren't compatible
- with the operator. This subroutine builds an actual argument list
- corresponding to the operands, then searches for a compatible
- interface. If one is found, the expression node is replaced with
- the appropriate function call. We use the 'match' enum to specify
- whether a replacement has been made or not, or if an error occurred. */
-
-match
-gfc_extend_expr (gfc_expr *e)
-{
- gfc_actual_arglist *actual;
- gfc_symbol *sym;
- gfc_namespace *ns;
- gfc_user_op *uop;
- gfc_intrinsic_op i;
- const char *gname;
- gfc_typebound_proc* tbo;
- gfc_expr* tb_base;
-
- sym = NULL;
-
- actual = gfc_get_actual_arglist ();
- actual->expr = e->value.op.op1;
-
- gname = NULL;
-
- if (e->value.op.op2 != NULL)
- {
- actual->next = gfc_get_actual_arglist ();
- actual->next->expr = e->value.op.op2;
- }
-
- i = fold_unary_intrinsic (e->value.op.op);
-
- /* See if we find a matching type-bound operator. */
- if (i == INTRINSIC_USER)
- tbo = matching_typebound_op (&tb_base, actual,
- i, e->value.op.uop->name, &gname);
- else
- switch (i)
- {
-#define CHECK_OS_COMPARISON(comp) \
- case INTRINSIC_##comp: \
- case INTRINSIC_##comp##_OS: \
- tbo = matching_typebound_op (&tb_base, actual, \
- INTRINSIC_##comp, NULL, &gname); \
- if (!tbo) \
- tbo = matching_typebound_op (&tb_base, actual, \
- INTRINSIC_##comp##_OS, NULL, &gname); \
- break;
- CHECK_OS_COMPARISON(EQ)
- CHECK_OS_COMPARISON(NE)
- CHECK_OS_COMPARISON(GT)
- CHECK_OS_COMPARISON(GE)
- CHECK_OS_COMPARISON(LT)
- CHECK_OS_COMPARISON(LE)
-#undef CHECK_OS_COMPARISON
-
- default:
- tbo = matching_typebound_op (&tb_base, actual, i, NULL, &gname);
- break;
- }
-
- /* If there is a matching typebound-operator, replace the expression with
- a call to it and succeed. */
- if (tbo)
- {
- gcc_assert (tb_base);
- build_compcall_for_operator (e, actual, tb_base, tbo, gname);
-
- if (!gfc_resolve_expr (e))
- return MATCH_ERROR;
- else
- return MATCH_YES;
- }
-
- if (i == INTRINSIC_USER)
- {
- for (ns = gfc_current_ns; ns; ns = ns->parent)
- {
- uop = gfc_find_uop (e->value.op.uop->name, ns);
- if (uop == NULL)
- continue;
-
- sym = gfc_search_interface (uop->op, 0, &actual);
- if (sym != NULL)
- break;
- }
- }
- else
- {
- for (ns = gfc_current_ns; ns; ns = ns->parent)
- {
- /* Due to the distinction between '==' and '.eq.' and friends, one has
- to check if either is defined. */
- switch (i)
- {
-#define CHECK_OS_COMPARISON(comp) \
- case INTRINSIC_##comp: \
- case INTRINSIC_##comp##_OS: \
- sym = gfc_search_interface (ns->op[INTRINSIC_##comp], 0, &actual); \
- if (!sym) \
- sym = gfc_search_interface (ns->op[INTRINSIC_##comp##_OS], 0, &actual); \
- break;
- CHECK_OS_COMPARISON(EQ)
- CHECK_OS_COMPARISON(NE)
- CHECK_OS_COMPARISON(GT)
- CHECK_OS_COMPARISON(GE)
- CHECK_OS_COMPARISON(LT)
- CHECK_OS_COMPARISON(LE)
-#undef CHECK_OS_COMPARISON
-
- default:
- sym = gfc_search_interface (ns->op[i], 0, &actual);
- }
-
- if (sym != NULL)
- break;
- }
- }
-
- /* TODO: Do an ambiguity-check and error if multiple matching interfaces are
- found rather than just taking the first one and not checking further. */
-
- if (sym == NULL)
- {
- /* Don't use gfc_free_actual_arglist(). */
- free (actual->next);
- free (actual);
- return MATCH_NO;
- }
-
- /* Change the expression node to a function call. */
- e->expr_type = EXPR_FUNCTION;
- e->symtree = gfc_find_sym_in_symtree (sym);
- e->value.function.actual = actual;
- e->value.function.esym = NULL;
- e->value.function.isym = NULL;
- e->value.function.name = NULL;
- e->user_operator = 1;
-
- if (!gfc_resolve_expr (e))
- return MATCH_ERROR;
-
- return MATCH_YES;
-}
-
-
-/* Tries to replace an assignment code node with a subroutine call to the
- subroutine associated with the assignment operator. Return true if the node
- was replaced. On false, no error is generated. */
-
-bool
-gfc_extend_assign (gfc_code *c, gfc_namespace *ns)
-{
- gfc_actual_arglist *actual;
- gfc_expr *lhs, *rhs, *tb_base;
- gfc_symbol *sym = NULL;
- const char *gname = NULL;
- gfc_typebound_proc* tbo;
-
- lhs = c->expr1;
- rhs = c->expr2;
-
- /* Don't allow an intrinsic assignment with a BOZ rhs to be replaced. */
- if (c->op == EXEC_ASSIGN
- && c->expr1->expr_type == EXPR_VARIABLE
- && c->expr2->expr_type == EXPR_CONSTANT && c->expr2->ts.type == BT_BOZ)
- return false;
-
- /* Don't allow an intrinsic assignment to be replaced. */
- if (lhs->ts.type != BT_DERIVED && lhs->ts.type != BT_CLASS
- && (rhs->rank == 0 || rhs->rank == lhs->rank)
- && (lhs->ts.type == rhs->ts.type
- || (gfc_numeric_ts (&lhs->ts) && gfc_numeric_ts (&rhs->ts))))
- return false;
-
- actual = gfc_get_actual_arglist ();
- actual->expr = lhs;
-
- actual->next = gfc_get_actual_arglist ();
- actual->next->expr = rhs;
-
- /* TODO: Ambiguity-check, see above for gfc_extend_expr. */
-
- /* See if we find a matching type-bound assignment. */
- tbo = matching_typebound_op (&tb_base, actual, INTRINSIC_ASSIGN,
- NULL, &gname);
-
- if (tbo)
- {
- /* Success: Replace the expression with a type-bound call. */
- gcc_assert (tb_base);
- c->expr1 = gfc_get_expr ();
- build_compcall_for_operator (c->expr1, actual, tb_base, tbo, gname);
- c->expr1->value.compcall.assign = 1;
- c->expr1->where = c->loc;
- c->expr2 = NULL;
- c->op = EXEC_COMPCALL;
- return true;
- }
-
- /* See if we find an 'ordinary' (non-typebound) assignment procedure. */
- for (; ns; ns = ns->parent)
- {
- sym = gfc_search_interface (ns->op[INTRINSIC_ASSIGN], 1, &actual);
- if (sym != NULL)
- break;
- }
-
- if (sym)
- {
- /* Success: Replace the assignment with the call. */
- c->op = EXEC_ASSIGN_CALL;
- c->symtree = gfc_find_sym_in_symtree (sym);
- c->expr1 = NULL;
- c->expr2 = NULL;
- c->ext.actual = actual;
- return true;
- }
-
- /* Failure: No assignment procedure found. */
- free (actual->next);
- free (actual);
- return false;
-}
-
-
-/* Make sure that the interface just parsed is not already present in
- the given interface list. Ambiguity isn't checked yet since module
- procedures can be present without interfaces. */
-
-bool
-gfc_check_new_interface (gfc_interface *base, gfc_symbol *new_sym, locus loc)
-{
- gfc_interface *ip;
-
- for (ip = base; ip; ip = ip->next)
- {
- if (ip->sym == new_sym)
- {
- gfc_error ("Entity %qs at %L is already present in the interface",
- new_sym->name, &loc);
- return false;
- }
- }
-
- return true;
-}
-
-
-/* Add a symbol to the current interface. */
-
-bool
-gfc_add_interface (gfc_symbol *new_sym)
-{
- gfc_interface **head, *intr;
- gfc_namespace *ns;
- gfc_symbol *sym;
-
- switch (current_interface.type)
- {
- case INTERFACE_NAMELESS:
- case INTERFACE_ABSTRACT:
- return true;
-
- case INTERFACE_INTRINSIC_OP:
- for (ns = current_interface.ns; ns; ns = ns->parent)
- switch (current_interface.op)
- {
- case INTRINSIC_EQ:
- case INTRINSIC_EQ_OS:
- if (!gfc_check_new_interface (ns->op[INTRINSIC_EQ], new_sym,
- gfc_current_locus)
- || !gfc_check_new_interface (ns->op[INTRINSIC_EQ_OS],
- new_sym, gfc_current_locus))
- return false;
- break;
-
- case INTRINSIC_NE:
- case INTRINSIC_NE_OS:
- if (!gfc_check_new_interface (ns->op[INTRINSIC_NE], new_sym,
- gfc_current_locus)
- || !gfc_check_new_interface (ns->op[INTRINSIC_NE_OS],
- new_sym, gfc_current_locus))
- return false;
- break;
-
- case INTRINSIC_GT:
- case INTRINSIC_GT_OS:
- if (!gfc_check_new_interface (ns->op[INTRINSIC_GT],
- new_sym, gfc_current_locus)
- || !gfc_check_new_interface (ns->op[INTRINSIC_GT_OS],
- new_sym, gfc_current_locus))
- return false;
- break;
-
- case INTRINSIC_GE:
- case INTRINSIC_GE_OS:
- if (!gfc_check_new_interface (ns->op[INTRINSIC_GE],
- new_sym, gfc_current_locus)
- || !gfc_check_new_interface (ns->op[INTRINSIC_GE_OS],
- new_sym, gfc_current_locus))
- return false;
- break;
-
- case INTRINSIC_LT:
- case INTRINSIC_LT_OS:
- if (!gfc_check_new_interface (ns->op[INTRINSIC_LT],
- new_sym, gfc_current_locus)
- || !gfc_check_new_interface (ns->op[INTRINSIC_LT_OS],
- new_sym, gfc_current_locus))
- return false;
- break;
-
- case INTRINSIC_LE:
- case INTRINSIC_LE_OS:
- if (!gfc_check_new_interface (ns->op[INTRINSIC_LE],
- new_sym, gfc_current_locus)
- || !gfc_check_new_interface (ns->op[INTRINSIC_LE_OS],
- new_sym, gfc_current_locus))
- return false;
- break;
-
- default:
- if (!gfc_check_new_interface (ns->op[current_interface.op],
- new_sym, gfc_current_locus))
- return false;
- }
-
- head = &current_interface.ns->op[current_interface.op];
- break;
-
- case INTERFACE_GENERIC:
- case INTERFACE_DTIO:
- for (ns = current_interface.ns; ns; ns = ns->parent)
- {
- gfc_find_symbol (current_interface.sym->name, ns, 0, &sym);
- if (sym == NULL)
- continue;
-
- if (!gfc_check_new_interface (sym->generic,
- new_sym, gfc_current_locus))
- return false;
- }
-
- head = &current_interface.sym->generic;
- break;
-
- case INTERFACE_USER_OP:
- if (!gfc_check_new_interface (current_interface.uop->op,
- new_sym, gfc_current_locus))
- return false;
-
- head = &current_interface.uop->op;
- break;
-
- default:
- gfc_internal_error ("gfc_add_interface(): Bad interface type");
- }
-
- intr = gfc_get_interface ();
- intr->sym = new_sym;
- intr->where = gfc_current_locus;
-
- intr->next = *head;
- *head = intr;
-
- return true;
-}
-
-
-gfc_interface *
-gfc_current_interface_head (void)
-{
- switch (current_interface.type)
- {
- case INTERFACE_INTRINSIC_OP:
- return current_interface.ns->op[current_interface.op];
-
- case INTERFACE_GENERIC:
- case INTERFACE_DTIO:
- return current_interface.sym->generic;
-
- case INTERFACE_USER_OP:
- return current_interface.uop->op;
-
- default:
- gcc_unreachable ();
- }
-}
-
-
-void
-gfc_set_current_interface_head (gfc_interface *i)
-{
- switch (current_interface.type)
- {
- case INTERFACE_INTRINSIC_OP:
- current_interface.ns->op[current_interface.op] = i;
- break;
-
- case INTERFACE_GENERIC:
- case INTERFACE_DTIO:
- current_interface.sym->generic = i;
- break;
-
- case INTERFACE_USER_OP:
- current_interface.uop->op = i;
- break;
-
- default:
- gcc_unreachable ();
- }
-}
-
-
-/* Gets rid of a formal argument list. We do not free symbols.
- Symbols are freed when a namespace is freed. */
-
-void
-gfc_free_formal_arglist (gfc_formal_arglist *p)
-{
- gfc_formal_arglist *q;
-
- for (; p; p = q)
- {
- q = p->next;
- free (p);
- }
-}
-
-
-/* Check that it is ok for the type-bound procedure 'proc' to override the
- procedure 'old', cf. F08:4.5.7.3. */
-
-bool
-gfc_check_typebound_override (gfc_symtree* proc, gfc_symtree* old)
-{
- locus where;
- gfc_symbol *proc_target, *old_target;
- unsigned proc_pass_arg, old_pass_arg, argpos;
- gfc_formal_arglist *proc_formal, *old_formal;
- bool check_type;
- char err[200];
-
- /* This procedure should only be called for non-GENERIC proc. */
- gcc_assert (!proc->n.tb->is_generic);
-
- /* If the overwritten procedure is GENERIC, this is an error. */
- if (old->n.tb->is_generic)
- {
- gfc_error ("Cannot overwrite GENERIC %qs at %L",
- old->name, &proc->n.tb->where);
- return false;
- }
-
- where = proc->n.tb->where;
- proc_target = proc->n.tb->u.specific->n.sym;
- old_target = old->n.tb->u.specific->n.sym;
-
- /* Check that overridden binding is not NON_OVERRIDABLE. */
- if (old->n.tb->non_overridable)
- {
- gfc_error ("%qs at %L overrides a procedure binding declared"
- " NON_OVERRIDABLE", proc->name, &where);
- return false;
- }
-
- /* It's an error to override a non-DEFERRED procedure with a DEFERRED one. */
- if (!old->n.tb->deferred && proc->n.tb->deferred)
- {
- gfc_error ("%qs at %L must not be DEFERRED as it overrides a"
- " non-DEFERRED binding", proc->name, &where);
- return false;
- }
-
- /* If the overridden binding is PURE, the overriding must be, too. */
- if (old_target->attr.pure && !proc_target->attr.pure)
- {
- gfc_error ("%qs at %L overrides a PURE procedure and must also be PURE",
- proc->name, &where);
- return false;
- }
-
- /* If the overridden binding is ELEMENTAL, the overriding must be, too. If it
- is not, the overriding must not be either. */
- if (old_target->attr.elemental && !proc_target->attr.elemental)
- {
- gfc_error ("%qs at %L overrides an ELEMENTAL procedure and must also be"
- " ELEMENTAL", proc->name, &where);
- return false;
- }
- if (!old_target->attr.elemental && proc_target->attr.elemental)
- {
- gfc_error ("%qs at %L overrides a non-ELEMENTAL procedure and must not"
- " be ELEMENTAL, either", proc->name, &where);
- return false;
- }
-
- /* If the overridden binding is a SUBROUTINE, the overriding must also be a
- SUBROUTINE. */
- if (old_target->attr.subroutine && !proc_target->attr.subroutine)
- {
- gfc_error ("%qs at %L overrides a SUBROUTINE and must also be a"
- " SUBROUTINE", proc->name, &where);
- return false;
- }
-
- /* If the overridden binding is a FUNCTION, the overriding must also be a
- FUNCTION and have the same characteristics. */
- if (old_target->attr.function)
- {
- if (!proc_target->attr.function)
- {
- gfc_error ("%qs at %L overrides a FUNCTION and must also be a"
- " FUNCTION", proc->name, &where);
- return false;
- }
-
- if (!gfc_check_result_characteristics (proc_target, old_target,
- err, sizeof(err)))
- {
- gfc_error ("Result mismatch for the overriding procedure "
- "%qs at %L: %s", proc->name, &where, err);
- return false;
- }
- }
-
- /* If the overridden binding is PUBLIC, the overriding one must not be
- PRIVATE. */
- if (old->n.tb->access == ACCESS_PUBLIC
- && proc->n.tb->access == ACCESS_PRIVATE)
- {
- gfc_error ("%qs at %L overrides a PUBLIC procedure and must not be"
- " PRIVATE", proc->name, &where);
- return false;
- }
-
- /* Compare the formal argument lists of both procedures. This is also abused
- to find the position of the passed-object dummy arguments of both
- bindings as at least the overridden one might not yet be resolved and we
- need those positions in the check below. */
- proc_pass_arg = old_pass_arg = 0;
- if (!proc->n.tb->nopass && !proc->n.tb->pass_arg)
- proc_pass_arg = 1;
- if (!old->n.tb->nopass && !old->n.tb->pass_arg)
- old_pass_arg = 1;
- argpos = 1;
- proc_formal = gfc_sym_get_dummy_args (proc_target);
- old_formal = gfc_sym_get_dummy_args (old_target);
- for ( ; proc_formal && old_formal;
- proc_formal = proc_formal->next, old_formal = old_formal->next)
- {
- if (proc->n.tb->pass_arg
- && !strcmp (proc->n.tb->pass_arg, proc_formal->sym->name))
- proc_pass_arg = argpos;
- if (old->n.tb->pass_arg
- && !strcmp (old->n.tb->pass_arg, old_formal->sym->name))
- old_pass_arg = argpos;
-
- /* Check that the names correspond. */
- if (strcmp (proc_formal->sym->name, old_formal->sym->name))
- {
- gfc_error ("Dummy argument %qs of %qs at %L should be named %qs as"
- " to match the corresponding argument of the overridden"
- " procedure", proc_formal->sym->name, proc->name, &where,
- old_formal->sym->name);
- return false;
- }
-
- check_type = proc_pass_arg != argpos && old_pass_arg != argpos;
- if (!gfc_check_dummy_characteristics (proc_formal->sym, old_formal->sym,
- check_type, err, sizeof(err)))
- {
- gfc_error_opt (0, "Argument mismatch for the overriding procedure "
- "%qs at %L: %s", proc->name, &where, err);
- return false;
- }
-
- ++argpos;
- }
- if (proc_formal || old_formal)
- {
- gfc_error ("%qs at %L must have the same number of formal arguments as"
- " the overridden procedure", proc->name, &where);
- return false;
- }
-
- /* If the overridden binding is NOPASS, the overriding one must also be
- NOPASS. */
- if (old->n.tb->nopass && !proc->n.tb->nopass)
- {
- gfc_error ("%qs at %L overrides a NOPASS binding and must also be"
- " NOPASS", proc->name, &where);
- return false;
- }
-
- /* If the overridden binding is PASS(x), the overriding one must also be
- PASS and the passed-object dummy arguments must correspond. */
- if (!old->n.tb->nopass)
- {
- if (proc->n.tb->nopass)
- {
- gfc_error ("%qs at %L overrides a binding with PASS and must also be"
- " PASS", proc->name, &where);
- return false;
- }
-
- if (proc_pass_arg != old_pass_arg)
- {
- gfc_error ("Passed-object dummy argument of %qs at %L must be at"
- " the same position as the passed-object dummy argument of"
- " the overridden procedure", proc->name, &where);
- return false;
- }
- }
-
- return true;
-}
-
-
-/* The following three functions check that the formal arguments
- of user defined derived type IO procedures are compliant with
- the requirements of the standard, see F03:9.5.3.7.2 (F08:9.6.4.8.3). */
-
-static void
-check_dtio_arg_TKR_intent (gfc_symbol *fsym, bool typebound, bt type,
- int kind, int rank, sym_intent intent)
-{
- if (fsym->ts.type != type)
- {
- gfc_error ("DTIO dummy argument at %L must be of type %s",
- &fsym->declared_at, gfc_basic_typename (type));
- return;
- }
-
- if (fsym->ts.type != BT_CLASS && fsym->ts.type != BT_DERIVED
- && fsym->ts.kind != kind)
- gfc_error ("DTIO dummy argument at %L must be of KIND = %d",
- &fsym->declared_at, kind);
-
- if (!typebound
- && rank == 0
- && (((type == BT_CLASS) && CLASS_DATA (fsym)->attr.dimension)
- || ((type != BT_CLASS) && fsym->attr.dimension)))
- gfc_error ("DTIO dummy argument at %L must be a scalar",
- &fsym->declared_at);
- else if (rank == 1
- && (fsym->as == NULL || fsym->as->type != AS_ASSUMED_SHAPE))
- gfc_error ("DTIO dummy argument at %L must be an "
- "ASSUMED SHAPE ARRAY", &fsym->declared_at);
-
- if (type == BT_CHARACTER && fsym->ts.u.cl->length != NULL)
- gfc_error ("DTIO character argument at %L must have assumed length",
- &fsym->declared_at);
-
- if (fsym->attr.intent != intent)
- gfc_error ("DTIO dummy argument at %L must have INTENT %s",
- &fsym->declared_at, gfc_code2string (intents, (int)intent));
- return;
-}
-
-
-static void
-check_dtio_interface1 (gfc_symbol *derived, gfc_symtree *tb_io_st,
- bool typebound, bool formatted, int code)
-{
- gfc_symbol *dtio_sub, *generic_proc, *fsym;
- gfc_typebound_proc *tb_io_proc, *specific_proc;
- gfc_interface *intr;
- gfc_formal_arglist *formal;
- int arg_num;
-
- bool read = ((dtio_codes)code == DTIO_RF)
- || ((dtio_codes)code == DTIO_RUF);
- bt type;
- sym_intent intent;
- int kind;
-
- dtio_sub = NULL;
- if (typebound)
- {
- /* Typebound DTIO binding. */
- tb_io_proc = tb_io_st->n.tb;
- if (tb_io_proc == NULL)
- return;
-
- gcc_assert (tb_io_proc->is_generic);
-
- specific_proc = tb_io_proc->u.generic->specific;
- if (specific_proc == NULL || specific_proc->is_generic)
- return;
-
- dtio_sub = specific_proc->u.specific->n.sym;
- }
- else
- {
- generic_proc = tb_io_st->n.sym;
- if (generic_proc == NULL || generic_proc->generic == NULL)
- return;
-
- for (intr = tb_io_st->n.sym->generic; intr; intr = intr->next)
- {
- if (intr->sym && intr->sym->formal && intr->sym->formal->sym
- && ((intr->sym->formal->sym->ts.type == BT_CLASS
- && CLASS_DATA (intr->sym->formal->sym)->ts.u.derived
- == derived)
- || (intr->sym->formal->sym->ts.type == BT_DERIVED
- && intr->sym->formal->sym->ts.u.derived == derived)))
- {
- dtio_sub = intr->sym;
- break;
- }
- else if (intr->sym && intr->sym->formal && !intr->sym->formal->sym)
- {
- gfc_error ("Alternate return at %L is not permitted in a DTIO "
- "procedure", &intr->sym->declared_at);
- return;
- }
- }
-
- if (dtio_sub == NULL)
- return;
- }
-
- gcc_assert (dtio_sub);
- if (!dtio_sub->attr.subroutine)
- gfc_error ("DTIO procedure %qs at %L must be a subroutine",
- dtio_sub->name, &dtio_sub->declared_at);
-
- if (!dtio_sub->resolve_symbol_called)
- gfc_resolve_formal_arglist (dtio_sub);
-
- arg_num = 0;
- for (formal = dtio_sub->formal; formal; formal = formal->next)
- arg_num++;
-
- if (arg_num < (formatted ? 6 : 4))
- {
- gfc_error ("Too few dummy arguments in DTIO procedure %qs at %L",
- dtio_sub->name, &dtio_sub->declared_at);
- return;
- }
-
- if (arg_num > (formatted ? 6 : 4))
- {
- gfc_error ("Too many dummy arguments in DTIO procedure %qs at %L",
- dtio_sub->name, &dtio_sub->declared_at);
- return;
- }
-
- /* Now go through the formal arglist. */
- arg_num = 1;
- for (formal = dtio_sub->formal; formal; formal = formal->next, arg_num++)
- {
- if (!formatted && arg_num == 3)
- arg_num = 5;
- fsym = formal->sym;
-
- if (fsym == NULL)
- {
- gfc_error ("Alternate return at %L is not permitted in a DTIO "
- "procedure", &dtio_sub->declared_at);
- return;
- }
-
- switch (arg_num)
- {
- case(1): /* DTV */
- type = derived->attr.sequence || derived->attr.is_bind_c ?
- BT_DERIVED : BT_CLASS;
- kind = 0;
- intent = read ? INTENT_INOUT : INTENT_IN;
- check_dtio_arg_TKR_intent (fsym, typebound, type, kind,
- 0, intent);
- break;
-
- case(2): /* UNIT */
- type = BT_INTEGER;
- kind = gfc_default_integer_kind;
- intent = INTENT_IN;
- check_dtio_arg_TKR_intent (fsym, typebound, type, kind,
- 0, intent);
- break;
- case(3): /* IOTYPE */
- type = BT_CHARACTER;
- kind = gfc_default_character_kind;
- intent = INTENT_IN;
- check_dtio_arg_TKR_intent (fsym, typebound, type, kind,
- 0, intent);
- break;
- case(4): /* VLIST */
- type = BT_INTEGER;
- kind = gfc_default_integer_kind;
- intent = INTENT_IN;
- check_dtio_arg_TKR_intent (fsym, typebound, type, kind,
- 1, intent);
- break;
- case(5): /* IOSTAT */
- type = BT_INTEGER;
- kind = gfc_default_integer_kind;
- intent = INTENT_OUT;
- check_dtio_arg_TKR_intent (fsym, typebound, type, kind,
- 0, intent);
- break;
- case(6): /* IOMSG */
- type = BT_CHARACTER;
- kind = gfc_default_character_kind;
- intent = INTENT_INOUT;
- check_dtio_arg_TKR_intent (fsym, typebound, type, kind,
- 0, intent);
- break;
- default:
- gcc_unreachable ();
- }
- }
- derived->attr.has_dtio_procs = 1;
- return;
-}
-
-void
-gfc_check_dtio_interfaces (gfc_symbol *derived)
-{
- gfc_symtree *tb_io_st;
- bool t = false;
- int code;
- bool formatted;
-
- if (derived->attr.is_class == 1 || derived->attr.vtype == 1)
- return;
-
- /* Check typebound DTIO bindings. */
- for (code = 0; code < 4; code++)
- {
- formatted = ((dtio_codes)code == DTIO_RF)
- || ((dtio_codes)code == DTIO_WF);
-
- tb_io_st = gfc_find_typebound_proc (derived, &t,
- gfc_code2string (dtio_procs, code),
- true, &derived->declared_at);
- if (tb_io_st != NULL)
- check_dtio_interface1 (derived, tb_io_st, true, formatted, code);
- }
-
- /* Check generic DTIO interfaces. */
- for (code = 0; code < 4; code++)
- {
- formatted = ((dtio_codes)code == DTIO_RF)
- || ((dtio_codes)code == DTIO_WF);
-
- tb_io_st = gfc_find_symtree (derived->ns->sym_root,
- gfc_code2string (dtio_procs, code));
- if (tb_io_st != NULL)
- check_dtio_interface1 (derived, tb_io_st, false, formatted, code);
- }
-}
-
-
-gfc_symtree*
-gfc_find_typebound_dtio_proc (gfc_symbol *derived, bool write, bool formatted)
-{
- gfc_symtree *tb_io_st = NULL;
- bool t = false;
-
- if (!derived || !derived->resolve_symbol_called
- || derived->attr.flavor != FL_DERIVED)
- return NULL;
-
- /* Try to find a typebound DTIO binding. */
- if (formatted == true)
- {
- if (write == true)
- tb_io_st = gfc_find_typebound_proc (derived, &t,
- gfc_code2string (dtio_procs,
- DTIO_WF),
- true,
- &derived->declared_at);
- else
- tb_io_st = gfc_find_typebound_proc (derived, &t,
- gfc_code2string (dtio_procs,
- DTIO_RF),
- true,
- &derived->declared_at);
- }
- else
- {
- if (write == true)
- tb_io_st = gfc_find_typebound_proc (derived, &t,
- gfc_code2string (dtio_procs,
- DTIO_WUF),
- true,
- &derived->declared_at);
- else
- tb_io_st = gfc_find_typebound_proc (derived, &t,
- gfc_code2string (dtio_procs,
- DTIO_RUF),
- true,
- &derived->declared_at);
- }
- return tb_io_st;
-}
-
-
-gfc_symbol *
-gfc_find_specific_dtio_proc (gfc_symbol *derived, bool write, bool formatted)
-{
- gfc_symtree *tb_io_st = NULL;
- gfc_symbol *dtio_sub = NULL;
- gfc_symbol *extended;
- gfc_typebound_proc *tb_io_proc, *specific_proc;
-
- tb_io_st = gfc_find_typebound_dtio_proc (derived, write, formatted);
-
- if (tb_io_st != NULL)
- {
- const char *genname;
- gfc_symtree *st;
-
- tb_io_proc = tb_io_st->n.tb;
- gcc_assert (tb_io_proc != NULL);
- gcc_assert (tb_io_proc->is_generic);
- gcc_assert (tb_io_proc->u.generic->next == NULL);
-
- specific_proc = tb_io_proc->u.generic->specific;
- gcc_assert (!specific_proc->is_generic);
-
- /* Go back and make sure that we have the right specific procedure.
- Here we most likely have a procedure from the parent type, which
- can be overridden in extensions. */
- genname = tb_io_proc->u.generic->specific_st->name;
- st = gfc_find_typebound_proc (derived, NULL, genname,
- true, &tb_io_proc->where);
- if (st)
- dtio_sub = st->n.tb->u.specific->n.sym;
- else
- dtio_sub = specific_proc->u.specific->n.sym;
-
- goto finish;
- }
-
- /* If there is not a typebound binding, look for a generic
- DTIO interface. */
- for (extended = derived; extended;
- extended = gfc_get_derived_super_type (extended))
- {
- if (extended == NULL || extended->ns == NULL
- || extended->attr.flavor == FL_UNKNOWN)
- return NULL;
-
- if (formatted == true)
- {
- if (write == true)
- tb_io_st = gfc_find_symtree (extended->ns->sym_root,
- gfc_code2string (dtio_procs,
- DTIO_WF));
- else
- tb_io_st = gfc_find_symtree (extended->ns->sym_root,
- gfc_code2string (dtio_procs,
- DTIO_RF));
- }
- else
- {
- if (write == true)
- tb_io_st = gfc_find_symtree (extended->ns->sym_root,
- gfc_code2string (dtio_procs,
- DTIO_WUF));
- else
- tb_io_st = gfc_find_symtree (extended->ns->sym_root,
- gfc_code2string (dtio_procs,
- DTIO_RUF));
- }
-
- if (tb_io_st != NULL
- && tb_io_st->n.sym
- && tb_io_st->n.sym->generic)
- {
- for (gfc_interface *intr = tb_io_st->n.sym->generic;
- intr && intr->sym; intr = intr->next)
- {
- if (intr->sym->formal)
- {
- gfc_symbol *fsym = intr->sym->formal->sym;
- if ((fsym->ts.type == BT_CLASS
- && CLASS_DATA (fsym)->ts.u.derived == extended)
- || (fsym->ts.type == BT_DERIVED
- && fsym->ts.u.derived == extended))
- {
- dtio_sub = intr->sym;
- break;
- }
- }
- }
- }
- }
-
-finish:
- if (dtio_sub
- && dtio_sub->formal->sym->ts.type == BT_CLASS
- && derived != CLASS_DATA (dtio_sub->formal->sym)->ts.u.derived)
- gfc_find_derived_vtab (derived);
-
- return dtio_sub;
-}
-
-/* Helper function - if we do not find an interface for a procedure,
- construct it from the actual arglist. Luckily, this can only
- happen for call by reference, so the information we actually need
- to provide (and which would be impossible to guess from the call
- itself) is not actually needed. */
-
-void
-gfc_get_formal_from_actual_arglist (gfc_symbol *sym,
- gfc_actual_arglist *actual_args)
-{
- gfc_actual_arglist *a;
- gfc_formal_arglist **f;
- gfc_symbol *s;
- char name[GFC_MAX_SYMBOL_LEN + 1];
- static int var_num;
-
- f = &sym->formal;
- for (a = actual_args; a != NULL; a = a->next)
- {
- (*f) = gfc_get_formal_arglist ();
- if (a->expr)
- {
- snprintf (name, GFC_MAX_SYMBOL_LEN, "_formal_%d", var_num ++);
- gfc_get_symbol (name, gfc_current_ns, &s);
- if (a->expr->ts.type == BT_PROCEDURE)
- {
- s->attr.flavor = FL_PROCEDURE;
- }
- else
- {
- s->ts = a->expr->ts;
-
- if (s->ts.type == BT_CHARACTER)
- s->ts.u.cl = gfc_get_charlen ();
-
- s->ts.deferred = 0;
- s->ts.is_iso_c = 0;
- s->ts.is_c_interop = 0;
- s->attr.flavor = FL_VARIABLE;
- if (a->expr->rank > 0)
- {
- s->attr.dimension = 1;
- s->as = gfc_get_array_spec ();
- s->as->rank = 1;
- s->as->lower[0] = gfc_get_int_expr (gfc_index_integer_kind,
- &a->expr->where, 1);
- s->as->upper[0] = NULL;
- s->as->type = AS_ASSUMED_SIZE;
- }
- else
- s->maybe_array = maybe_dummy_array_arg (a->expr);
- }
- s->attr.dummy = 1;
- s->attr.artificial = 1;
- s->declared_at = a->expr->where;
- s->attr.intent = INTENT_UNKNOWN;
- (*f)->sym = s;
- }
- else /* If a->expr is NULL, this is an alternate rerturn. */
- (*f)->sym = NULL;
-
- f = &((*f)->next);
- }
-}
-
-
-const char *
-gfc_dummy_arg_get_name (gfc_dummy_arg & dummy_arg)
-{
- switch (dummy_arg.intrinsicness)
- {
- case GFC_INTRINSIC_DUMMY_ARG:
- return dummy_arg.u.intrinsic->name;
-
- case GFC_NON_INTRINSIC_DUMMY_ARG:
- return dummy_arg.u.non_intrinsic->sym->name;
-
- default:
- gcc_unreachable ();
- }
-}
-
-
-const gfc_typespec &
-gfc_dummy_arg_get_typespec (gfc_dummy_arg & dummy_arg)
-{
- switch (dummy_arg.intrinsicness)
- {
- case GFC_INTRINSIC_DUMMY_ARG:
- return dummy_arg.u.intrinsic->ts;
-
- case GFC_NON_INTRINSIC_DUMMY_ARG:
- return dummy_arg.u.non_intrinsic->sym->ts;
-
- default:
- gcc_unreachable ();
- }
-}
-
-
-bool
-gfc_dummy_arg_is_optional (gfc_dummy_arg & dummy_arg)
-{
- switch (dummy_arg.intrinsicness)
- {
- case GFC_INTRINSIC_DUMMY_ARG:
- return dummy_arg.u.intrinsic->optional;
-
- case GFC_NON_INTRINSIC_DUMMY_ARG:
- return dummy_arg.u.non_intrinsic->sym->attr.optional;
-
- default:
- gcc_unreachable ();
- }
-}