I'm really looking forward to conditional expressions because I like using them in other languages.  So I built a gfortran from the trunk a few days ago to test the mod.

Here is a simple test case that compiles, but SEGVs at run-time:

program cond_expr
  implicit none

! Segv at run time
  print *, (.true.?1:0)

end program

$ gfortran --version
GNU Fortran (GCC) 16.0.0 20250916 (experimental)
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gfortran -g condexpr.f90
$ ./a.out

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f4a7215ed11 in ???
#1  0x7f4a7215dee5 in ???
#2  0x7f4a71e2508f in ???
    at /build/glibc-B3wQXB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
#3  0x7f4a723abbe0 in ???
#4  0x7f4a723acdc4 in ???
#5  0x7f4a723b0f7b in ???
#6  0x7f4a723b1ef6 in ???
#7  0x4011c1 in cond_expr
    at /home/wws/computer/fortran/tests/condexpr.f90:5
#8  0x401207 in main
    at /home/wws/computer/fortran/tests/condexpr.f90:7
Segmentation fault (core dumped)
$

Walter

Reply via email to