https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121627
Bug ID: 121627
Summary: ICE: Segmentation fault upon using ISO_FORTRAN_ENV
KIND constant
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: dustin-warkotsch at web dot de
Target Milestone: ---
Hi,
I have found an ICE segmentation fault in gfortran upon using, e.g. printing, a
named KIND constant, such as REAL64, from ISO_FORTRAN_ENV.
This can be triggered with a very short code snippet:
program real_kinds
use ISO_FORTRAN_ENV
print *, REAL64
end program real_kinds
causing the following messages upon compiling it with gfortran:
f951: internal compiler error: Segmentation fault
0x250a7f1 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x250b030 internal_error(char const*, ...)
???:0
0x7c6d13 gfc_use_modules()
???:0
0x818343 gfc_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues>
for instructions.
I have reproduced this bug using
GNU Fortran (GCC) 15.2.1 20250813
under Arch Linux
and
GNU Fortran (Debian 12.2.0-14+deb12u1) 12.2.0
under Debian 12.11, which is the reason, I reported directly to upstream.
Interestingly, this bug is NOT triggered, when only importing the
aforementioned constant, i.e.
program real_kinds
use ISO_FORTRAN_ENV, only: REAL64
print *, REAL64
end program real_kinds
works fine.
The bug is also NOT present in more complex programs, i.e. not *every* usage of
REAL64 et al. is broken.
Let me know, if you need any further information.
Best regards
Dustin