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

            Bug ID: 62142
           Summary: internal compiler error: Segmentation fault (X = X -
                    L*floor(X/L))
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ondrej.certik at gmail dot com

Created attachment 33327
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33327&action=edit
Source file to reproduce the segfault

$ cat test_segfault.f90 
program test_segfault
implicit none
integer, parameter :: dp=kind(0.d0)
real(dp) :: L
real(dp), allocatable :: X(:)
X = X - L*floor(X/L)
end program

$ gfortran -v test_segfault.f90 
Driving: gfortran -v test_segfault.f90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/local/certik/bld/gcc/5att4mtprf52/libexec/gcc/x86_64-unknown-linux-gnu/4.9.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/local/certik/bld/gcc/5att4mtprf52
--enable-checking=release --enable-languages=fortran,c,c++
--with-local-prefix=/local/certik/bld/gcc/5att4mtprf52
--with-gmp=/local/certik/bld/gmp/vadkrj43wtyr
--with-mpc=/local/certik/bld/mpc/sushaq7ufe2f
--with-mpfr=/local/certik/bld/mpfr/vxwmnxjsshse
--with-cloog=/local/certik/bld/cloog/x3kd73rwqkzj
--with-isl=/local/certik/bld/isl/lfrjunwloawr --enable-clocale=gnu
--enable-__cxa_atexit --enable-shared --enable-threads=posix --disable-multilib
--libdir=/local/certik/bld/gcc/5att4mtprf52/lib
--with-stage1-ldflags='-L/local/certik/bld/cloog/x3kd73rwqkzj/lib
-Wl,-rpath=/local/certik/bld/cloog/x3kd73rwqkzj/lib
-L/local/certik/bld/gmp/vadkrj43wtyr/lib
-Wl,-rpath=/local/certik/bld/gmp/vadkrj43wtyr/lib
-L/local/certik/bld/isl/lfrjunwloawr/lib
-Wl,-rpath=/local/certik/bld/isl/lfrjunwloawr/lib
-L/local/certik/bld/mpc/sushaq7ufe2f/lib
-Wl,-rpath=/local/certik/bld/mpc/sushaq7ufe2f/lib
-L/local/certik/bld/mpfr/vxwmnxjsshse/lib
-Wl,-rpath=/local/certik/bld/mpfr/vxwmnxjsshse/lib
-L/local/certik/bld/patchelf/k3rloj265ogt/lib
-Wl,-rpath=/local/certik/bld/patchelf/k3rloj265ogt/lib
-L/local/certik/bld/zlib/3el5ccejre7b/lib
-Wl,-rpath=/local/certik/bld/zlib/3el5ccejre7b/lib'
--with-boot-ldflags='-L/local/certik/bld/cloog/x3kd73rwqkzj/lib
-Wl,-rpath=/local/certik/bld/cloog/x3kd73rwqkzj/lib
-L/local/certik/bld/gmp/vadkrj43wtyr/lib
-Wl,-rpath=/local/certik/bld/gmp/vadkrj43wtyr/lib
-L/local/certik/bld/isl/lfrjunwloawr/lib
-Wl,-rpath=/local/certik/bld/isl/lfrjunwloawr/lib
-L/local/certik/bld/mpc/sushaq7ufe2f/lib
-Wl,-rpath=/local/certik/bld/mpc/sushaq7ufe2f/lib
-L/local/certik/bld/mpfr/vxwmnxjsshse/lib
-Wl,-rpath=/local/certik/bld/mpfr/vxwmnxjsshse/lib
-L/local/certik/bld/patchelf/k3rloj265ogt/lib
-Wl,-rpath=/local/certik/bld/patchelf/k3rloj265ogt/lib
-L/local/certik/bld/zlib/3el5ccejre7b/lib
-Wl,-rpath=/local/certik/bld/zlib/3el5ccejre7b/lib'
Thread model: posix
gcc version 4.9.1 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'

/local/certik/bld/gcc/5att4mtprf52/libexec/gcc/x86_64-unknown-linux-gnu/4.9.1/f951
test_segfault.f90 -quiet -dumpbase test_segfault.f90 -mtune=generic
-march=x86-64 -auxbase test_segfault -version -fintrinsic-modules-path
/local/certik/bld/gcc/5att4mtprf52/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/finclude
-o /tmp/ccliCcO4.s
GNU Fortran (GCC) version 4.9.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.9.1, GMP version 5.1.3, MPFR version 3.1.2, MPC
version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (GCC) version 4.9.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.9.1, GMP version 5.1.3, MPFR version 3.1.2, MPC
version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
test_segfault.f90: In function ‘test_segfault’:
test_segfault.f90:6:0: internal compiler error: Segmentation fault
 X = X - L*floor(X/L)
 ^
0x90f44f crash_signal
    ../.././gcc/toplev.c:337
0x604e0d is_runtime_conformable
    ../.././gcc/fortran/trans-expr.c:7856
0x604e1b is_runtime_conformable
    ../.././gcc/fortran/trans-expr.c:7856
0x611aa4 gfc_trans_assignment_1
    ../.././gcc/fortran/trans-expr.c:8117
0x5e3fc5 trans_code
    ../.././gcc/fortran/trans.c:1639
0x6033bb gfc_generate_function_code(gfc_namespace*)
    ../.././gcc/fortran/trans-decl.c:5653
0x5a2f80 translate_all_program_units
    ../.././gcc/fortran/parse.c:4953
0x5a2f80 gfc_parse_file()
    ../.././gcc/fortran/parse.c:5150
0x5e0025 gfc_be_parse_file
    ../.././gcc/fortran/f95-lang.c:212
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


When I execute "gfortran -v -save-temps  test_segfault.f90", it doesn't produce
preprocessed sources, I assume the segfault happens in the parser. I have
isolated the segfault, it happens in a large codebase and prevents its
compilation (the array is allocated in our code, the above is the simplest code
to reproduce the problem).

This is my first bug report, please let me know if you need further
information.

Reply via email to