http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59997
Bug ID: 59997 Summary: c_pointer = c_loc(...) internal compiler error Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: major Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: chrisonian at gmail dot com The following program cannot compile with gfortran 4.8.1: gfortran gfortran_c_ptr_bug.f90 gfortran_c_ptr_bug.f90:14:0: internal compiler error: Segmentation fault c_string_ptr = c_loc(X%c_line) ^ Changing X%c_line to X%c_line(1) removes the error. -----gfortran_c_ptr_bug.f90------- program test use iso_c_binding implicit none type scratch character(c_char) :: c_line(2) end type type(scratch), target :: X type(c_ptr) :: c_string_ptr character(1) :: line line = 'a' X%c_line(1) = line X%c_line(2) = c_null_char c_string_ptr = c_loc(X%c_line) end program ---------------------------------- gfortran -v -save-temps gfortran_c_ptr_bug.f90 Driving: gfortran -v -save-temps gfortran_c_ptr_bug.f90 -l gfortran -l m -shared-libgcc Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/nfs/cms/sw/install/slc6_amd64_gcc481/external/gcc/4.8.1/bin/../libexec/gcc/x86_64-redhat-linux-gnu/4.8.1/lto-wrapper Target: x86_64-redhat-linux-gnu Configured with: ../configure --prefix=/build/davidlt/build-BOOTSTRAP_slc6_amd64_gcc481/b/tmp/BUILDROOT/e55a93caf1185342d60da645a6c0626d/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1 --disable-multilib --disable-nls --with-zlib=no --enable-languages=c,c++,fortran --enable-gold=yes --enable-ld=default --enable-lto --with-gmp=/build/davidlt/build-BOOTSTRAP_slc6_amd64_gcc481/b/tmp/BUILDROOT/e55a93caf1185342d60da645a6c0626d/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1 --with-mpfr=/build/davidlt/build-BOOTSTRAP_slc6_amd64_gcc481/b/tmp/BUILDROOT/e55a93caf1185342d60da645a6c0626d/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1 --with-mpc=/build/davidlt/build-BOOTSTRAP_slc6_amd64_gcc481/b/tmp/BUILDROOT/e55a93caf1185342d60da645a6c0626d/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1 --with-isl=/build/davidlt/build-BOOTSTRAP_slc6_amd64_gcc481/b/tmp/BUILDROOT/e55a93caf1185342d60da645a6c0626d/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1 --with-cloog=/build/davidlt/build-BOOTSTRAP_slc6_amd64_gcc481/b/tmp/BUILDROOT/e55a93caf1185342d60da645a6c0626d/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1 --enable-checking=release --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --enable-libstdcxx-time=rt --enable-shared CC='gcc -fPIC' CXX='c++ -fPIC' CPP=cpp CXXCPP='c++ -E' Thread model: posix gcc version 4.8.1 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /nfs/cms/sw/install/slc6_amd64_gcc481/external/gcc/4.8.1/bin/../libexec/gcc/x86_64-redhat-linux-gnu/4.8.1/f951 gfortran_c_ptr_bug.f90 -quiet -dumpbase gfortran_c_ptr_bug.f90 -mtune=generic -march=x86-64 -auxbase gfortran_c_ptr_bug -version -fintrinsic-modules-path /nfs/cms/sw/install/slc6_amd64_gcc481/external/gcc/4.8.1/bin/../lib/gcc/x86_64-redhat-linux-gnu/4.8.1/finclude -o gfortran_c_ptr_bug.s GNU Fortran (GCC) version 4.8.1 (x86_64-redhat-linux-gnu) compiled by GNU C version 4.8.1, GMP version 5.1.0, MPFR version 3.1.1, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU Fortran (GCC) version 4.8.1 (x86_64-redhat-linux-gnu) compiled by GNU C version 4.8.1, GMP version 5.1.0, MPFR version 3.1.1, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 gfortran_c_ptr_bug.f90: In function 'test': gfortran_c_ptr_bug.f90:14:0: internal compiler error: Segmentation fault c_string_ptr = c_loc(X%c_line) ^ Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.