https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115070

            Bug ID: 115070
           Summary: ICE using IEEE_ARITHMETIC in a derived type method
                    with intent(out) statement
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bardeau at iram dot fr
  Target Milestone: ---

Hi,

gfortran 14.0.1 raises an ICE in the following context:

~> uname -a
Linux bardeau-lap 6.8.8-300.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Apr 27
17:53:31 UTC 2024 x86_64 GNU/Linux

~> cat /etc/redhat-release 
Fedora release 40 (Forty)

~> gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/14/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu
--enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-14.0.1-20240411/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none,amdgcn-amdhsa --enable-offload-defaulted
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240411 (Red Hat 14.0.1-0) (GCC)

~> cat bug-gfortran.f90
module my_mod
  type my_type
    integer :: a
  end type my_type
contains
  subroutine my_sub(obs)
    use ieee_arithmetic
    class(my_type), intent(out) :: obs
  end subroutine my_sub
end module my_mod

~> gfortran -c bug-gfortran.f90 
bug-gfortran.f90:10:17:

   10 | end module my_mod
      |                 ^
internal compiler error: in gimplify_var_or_parm_decl, at gimplify.cc:3307
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <http://bugzilla.redhat.com/bugzilla> for instructions.

It seems that the combination of "use ieee_arithmetic" and the "intent(out)"
statement is important (for example using intent(inout) fixes the ICE). I let
you rephrase the summary to a better description.

Reply via email to