conda-forge / ctng-compilers-feedstock

A conda-smithy repository for ctng-compilers.
BSD 3-Clause "New" or "Revised" License
12 stars 28 forks source link

Internal Compiler Error in gfortran 14.1.0 #155

Open ATPXenogen opened 1 month ago

ATPXenogen commented 1 month ago

Solution to issue cannot be found in the documentation.

Issue

This is a minimal reproducible example

subroutine icemaker()
  implicit none
  real(kind=8) :: re
  re = func(1d0)%re
  contains
  complex(kind=8) function func(x)
    real(kind=8) :: x
    func = x
  end function
end subroutine icemaker

When compiled with gfortran 14.1.0, the following error occurs

$ gfortran -freport-bug ICE.f90
f951: internal compiler error: in gfc_find_derived_types, at fortran/symbol.cc:2458
0x1f16198 internal_error(char const*, ...)
        ???:0
0x7a11cc fancy_abort(char const*, int, char const*)
        ???:0
0x86a792 gfc_match_varspec(gfc_expr*, int, bool, bool)
        ???:0
0x86c678 gfc_match_rvalue(gfc_expr**)
        ???:0
0x82ddf6 gfc_match_expr(gfc_expr**)
        ???:0
0x8249de gfc_match(char const*, ...)
        ???:0
0x8269d1 gfc_match_assignment()
        ???:0
0x86564f gfc_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://github.com/conda-forge/ctng-compilers-feedstock/issues/new/choose> for instructions.

The source of the bug is this line, which is not valid syntax,

  re = func(1d0)%re

When the original example is compiled with ifx,

$ ifx ICE.f90
ICE.f90(4): error #6837: The leftmost part-ref in a data-ref can not be a function reference.
  re = func(1d0)%re
-------^
ICE.f90(4): error #6158: The structure-name is invalid or is missing.
  re = func(1d0)%re
-------^
compilation aborted for ICE.f90 (code 1)

The following code makes gfortran correctly identify the syntax error:

subroutine icemaker()
  implicit none
  real(kind=8) :: re
  complex(kind=8), external :: func
  re = func(1d0)%re
end subroutine icemaker
complex(kind=8) function func(x)
  real(kind=8) :: x
  func = x
end function
$ gfortran ICE.f90
ICE.f90:5:17:

    5 |   re = func(1d0)%re
      |                 1
Error: The leftmost part-ref in a data-ref cannot be a function reference at (1)

When the line

  complex(kind=8), external :: func

is removed, the internal compiler error appears again.

Installed packages

packages in environment at /home/yongyanhan/miniconda3/envs/fortran:

#

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_kmp_llvm conda-forge _sysroot_linux-64_curr_repodata_hack 3 h69a702a_16 conda-forge binutils_impl_linux-64 2.43 h4bf12b8_0 conda-forge blas 1.0 mkl
brotli 1.0.9 h5eee18b_8
brotli-bin 1.0.9 h5eee18b_8
bzip2 1.0.8 h5eee18b_6
c-ares 1.19.1 h5eee18b_0
ca-certificates 2024.9.24 h06a4308_0
cmake 3.26.4 h96355d8_0
contourpy 1.2.0 py312hdb19cb5_0
cycler 0.11.0 pyhd3eb1b0_0
cyrus-sasl 2.1.28 h52b45da_1
dbus 1.13.18 hb2f20db_0
expat 2.6.3 h6a678d5_0
fontconfig 2.14.1 h55d465d_3
fonttools 4.51.0 py312h5eee18b_0
fortls 3.1.2 pypi_0 pypi fpm 0.10.0 hd8f1df9_0 conda-forge freetype 2.12.1 h4a9f257_0
gcc 14.1.0 h6f9ffa1_1 conda-forge gcc_impl_linux-64 14.1.0 h3c94d91_1 conda-forge gfortran 14.1.0 h6f9ffa1_1 conda-forge gfortran_impl_linux-64 14.1.0 he4a1faa_1 conda-forge glib 2.78.4 h6a678d5_0
glib-tools 2.78.4 h6a678d5_0
gst-plugins-base 1.14.1 h6a678d5_1
gstreamer 1.14.1 h5eee18b_1
gxx 14.1.0 h6f9ffa1_1 conda-forge gxx_impl_linux-64 14.1.0 h8d00ecb_1 conda-forge icu 73.1 h6a678d5_0
jpeg 9e h5eee18b_3
json5 0.9.25 pypi_0 pypi kernel-headers_linux-64 3.10.0 h4a8ded7_16 conda-forge kiwisolver 1.4.4 py312h6a678d5_0
krb5 1.20.1 h143b758_1
lcms2 2.12 h3be6417_0
ld_impl_linux-64 2.43 h712a8e2_0 conda-forge lerc 3.0 h295c915_0
libbrotlicommon 1.0.9 h5eee18b_8
libbrotlidec 1.0.9 h5eee18b_8
libbrotlienc 1.0.9 h5eee18b_8
libclang 14.0.6 default_hc6dbbc7_1
libclang13 14.0.6 default_he11475f_1
libcups 2.4.2 h2d74bed_1
libcurl 8.9.1 h251f7ec_0
libdeflate 1.17 h5eee18b_1
libedit 3.1.20230828 h5eee18b_0
libev 4.33 h7f8727e_1
libffi 3.4.4 h6a678d5_1
libgcc 14.1.0 h77fa898_1 conda-forge libgcc-devel_linux-64 14.1.0 h5d3d1c9_101 conda-forge libgcc-ng 14.1.0 h69a702a_1 conda-forge libgfortran 14.1.0 h69a702a_1 conda-forge libgfortran-ng 14.1.0 h69a702a_1 conda-forge libgfortran5 14.1.0 hc5f4f2c_1 conda-forge libglib 2.78.4 hdc74915_0
libgomp 14.1.0 h77fa898_1 conda-forge libiconv 1.16 h5eee18b_3
libllvm14 14.0.6 hecde1de_4
libnghttp2 1.57.0 h2d74bed_0
libpng 1.6.39 h5eee18b_0
libpq 12.17 hdbd6064_0
libsanitizer 14.1.0 hcba0ae0_1 conda-forge libssh2 1.11.0 h251f7ec_0
libstdcxx 14.1.0 hc0a3c3a_1 conda-forge libstdcxx-devel_linux-64 14.1.0 h5d3d1c9_101 conda-forge libstdcxx-ng 14.1.0 h4852527_1 conda-forge libtiff 4.5.1 h6a678d5_0
libuuid 1.41.5 h5eee18b_0
libuv 1.48.0 h5eee18b_0
libwebp-base 1.3.2 h5eee18b_0
libxcb 1.15 h7f8727e_0
libxkbcommon 1.0.1 h097e994_2
libxml2 2.13.1 hfdd30dd_2
libzlib 1.2.13 h4ab18f5_6 conda-forge llvm-openmp 18.1.4 ha31de31_0 conda-forge lz4-c 1.9.4 h6a678d5_1
matplotlib 3.9.2 py312h06a4308_0
matplotlib-base 3.9.2 py312h66fe004_0
mkl 2023.2.0 h84fe81f_50496 conda-forge mkl-service 2.4.0 py312h5eee18b_1
mkl_fft 1.3.10 py312h5eee18b_0
mkl_random 1.2.7 py312h526ad5a_0
mysql 5.7.24 h721c034_2
ncurses 6.4 h6a678d5_0
numpy 1.26.4 py312hc5e2394_0
numpy-base 1.26.4 py312h0da6c21_0
openjpeg 2.5.2 he7f1fd0_0
openssl 3.3.2 hb9d3cd8_0 conda-forge packaging 24.1 py312h06a4308_0
pcre2 10.42 hebb0a14_1
pillow 10.4.0 py312h5eee18b_0
pip 24.2 py312h06a4308_0
ply 3.11 py312h06a4308_1
pybind11-abi 5 hd3eb1b0_0
pyparsing 3.1.2 py312h06a4308_0
pyqt 5.15.10 py312h6a678d5_0
pyqt5-sip 12.13.0 py312h5eee18b_0
python 3.12.5 h5148396_1
python-dateutil 2.9.0post0 py312h06a4308_2
qt-main 5.15.2 h53bd1ea_10
readline 8.2 h5eee18b_0
rhash 1.4.3 hdbd6064_0
scipy 1.13.1 py312hc5e2394_0
setuptools 75.1.0 py312h06a4308_0
sip 6.7.12 py312h6a678d5_0
six 1.16.0 pyhd3eb1b0_1
sqlite 3.45.3 h5eee18b_0
sysroot_linux-64 2.17 h4a8ded7_16 conda-forge tbb 2021.8.0 hdb19cb5_0
tk 8.6.14 h39e8969_0
tornado 6.4.1 py312h5eee18b_0
typing 3.10.0.0 py312h06a4308_0
tzdata 2024a h04d1e81_0
unicodedata2 15.1.0 py312h5eee18b_0
wheel 0.44.0 py312h06a4308_0
xz 5.4.6 h5eee18b_1
zlib 1.2.13 h4ab18f5_6 conda-forge zstd 1.5.5 hc292b87_2

Environment info

 active environment : fortran
active env location : /home/yongyanhan/miniconda3/envs/fortran
        shell level : 1
   user config file : /home/yongyanhan/.condarc

populated config files : /home/yongyanhan/.condarc conda version : 24.7.1 conda-build version : not installed python version : 3.12.4.final.0 solver : libmamba (default) virtual packages : archspec=1=ivybridge conda=24.7.1=0 glibc=2.17=0 linux=3.10.0=0 __unix=0=0 base environment : /home/yongyanhan/miniconda3 (writable) conda av data dir : /home/yongyanhan/miniconda3/etc/conda conda av metadata url : None channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /home/yongyanhan/miniconda3/pkgs /home/yongyanhan/.conda/pkgs envs directories : /home/yongyanhan/miniconda3/envs /home/yongyanhan/.conda/envs platform : linux-64 user-agent : conda/24.7.1 requests/2.32.3 CPython/3.12.4 Linux/3.10.0-1160.31.1.el7.x86_64 centos/7.9.2009 glibc/2.17 solver/libmamba conda-libmamba-solver/24.7.0 libmambapy/1.5.8 aau/0.4.4 c/. s/. e/. UID:GID : 10042:10042 netrc file : None offline mode : False