[Bug fortran/105182] New: compiling NJOY21 causes a ICE segmentation fault: 11

2022-04-06 Thread kermitnuc at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105182

Bug ID: 105182
   Summary: compiling NJOY21 causes a ICE segmentation fault: 11
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kermitnuc at gmail dot com
  Target Milestone: ---

GCC 10.3 compiles NJOY21 without issue.  GCC 11.1 and 11.2 do not.  

GCC configure script:
/configure  --prefix=/usr/local/gcc-1030 --enable-languages=c,c++,fortran,lto
CC=/usr/bin/gcc CXX=/usr/bin/g++ LD=/usr/bin/ld  --with-gmp=/usr/local
--with-mpfr=/usr/local  --with-mpc=/usr/local --with-isl=/usr/local
--with-libiconv-prefix=/usr/local --with-libiconv=/usr/local --with-system-zlib
--with-native-system-header-dir=/usr/include --build=x86_64-apple-darwin21.4.0 
CXXFLAGS="-I/usr/local/include " CCFLAGS="-I/usr/local/include " 
LDFLAGS="-L/usr/local/lib " CPPFLAGS="-I/usr/local/include " --enable-libatomic
--enable-libgomp --enable-libitm --enable-libquadmath
--enable-libquadmath-support -enable-shared --enable-shared-libgcc
--enable-static --enable-version-specific-runtime-libs
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk 

Similar for 11.1 and 11.2.
Using XCODE 13 on MacOS 12.3.1

NJOY21 is available at:  https://www.njoy21.io
The error when compiling the ERRORR.F90 subroutine.

NJOY configure script:
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE -D
CMAKE_CXX_COMPILER=/usr/local/gcc-1120/bin/x86_64-apple-darwin21.4.0-c++ -D
CMAKE_Fortran_COMPILER=/usr/local/gcc-1120/bin/x86_64-apple-darwin21.4.0-gfortran
-D CMAKE_Fortran_FLAGS_RELEASE='-fno-stack-limit -frecursive -fcheck=all
-pedantic -Wdo-subscript  -std=legacy -v -fdump-tree-original -Wdo-subscript '
../


Compiler output:


[ 27%] Building Fortran object
_deps/njoy-build/CMakeFiles/njoy.dir/src/samm.f90.o
/Users/kermitnuc/NJOY21/bin/_deps/njoy-src/src/samm.f90:4518:38:

 4515 |do n=1,100
  | 2 
..
 4518 |  a(n)=-(delta*(xn-1)*(xn-2)*a(n-1)+&
  |  1
Warning: Array reference at (1) out of bounds (0 < 1) in loop beginning at (2)
[-Wdo-subscript]
/Users/kermitnuc/NJOY21/bin/_deps/njoy-src/src/samm.f90:4519:37:

 4515 |do n=1,100
  | 2
..
 4519 |(rhoi-2*eta)*(delta**2)*a(n-2)+(delta**3)*a(n-3))/&
  | 1
Warning: Array reference at (1) out of bounds (-1 < 1) in loop beginning at (2)
[-Wdo-subscript]
/Users/kermitnuc/NJOY21/bin/_deps/njoy-src/src/samm.f90:4519:55:

 4515 |do n=1,100
  | 2  
..
 4519 |(rhoi-2*eta)*(delta**2)*a(n-2)+(delta**3)*a(n-3))/&
  |   1
Warning: Array reference at (1) out of bounds (-2 < 1) in loop beginning at (2)
[-Wdo-subscript]
[ 28%] Building Fortran object
_deps/njoy-build/CMakeFiles/njoy.dir/src/errorr.f90.o
f951: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
make[2]: *** [_deps/njoy-build/CMakeFiles/njoy.dir/build.make:239:
_deps/njoy-build/CMakeFiles/njoy.dir/src/errorr.f90.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2603:
_deps/njoy-build/CMakeFiles/njoy.dir/all] Error 2
make: *** [Makefile:161: all] Error 2

[Bug fortran/105182] compiling NJOY21 causes a ICE segmentation fault: 11

2022-04-06 Thread kermitnuc at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105182

--- Comment #2 from Kermit Bunde  ---
(In reply to kargl from comment #1)
> Thanks for the report, but we're going to need some help.  Code in NJOY21
> seems to be C++.  I found an errorr.f90 file under NJOY2016. This is an
> 11000 line code, which pulls in a number of modules.  Can you try to 
> reduce this to something manageable?

If one comments out these lines in subroutine resprx:
 !--Unresolved
 if (lru.eq.2) then
call rpxunr(a,amur,mxlru2,iest,ieed,nwscr)
 !--Resolved with sammy method
 else if (nmtres.gt.0) then
call rpxsamm(nwscr,a,ier)
 !--Resolved with errorj method
 else
if (lcomp.eq.0) then
   call rpxlc0(nwscr,a)
else if (lcomp.eq.1.or.lcomp.eq.2) then
   call rpxlc12(nwscr,a,iest,ieed)
endif
 endif

Then error.f90 will compile.
Is there a limit to how many subroutine calls are allowed?

[Bug fortran/105182] compiling NJOY21 causes a ICE segmentation fault: 11

2022-04-06 Thread kermitnuc at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105182

--- Comment #4 from Kermit Bunde  ---
This subroutine compiles when GCC 10.3 is used.  What was changed for 11.1 that
might impact this?

Is there a compiler option that I can use to provide more information to you?

[Bug fortran/105182] compiling NJOY21 causes a ICE segmentation fault: 11

2022-04-06 Thread kermitnuc at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105182

--- Comment #6 from Kermit Bunde  ---
I ran the stack size up to ~64Mb.

I can compile MCNP which is much bigger.
Again, 10.3 compiled it with a stack size of 8 Mb.

[Bug fortran/105182] [11/12 Regression] compiling NJOY21 causes a ICE segmentation fault: 11

2022-04-10 Thread kermitnuc at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105182

--- Comment #18 from Kermit Bunde  ---
The latest GIT pull fixed the issue