https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691
physiker at toast2 dot net changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |physiker at toast2 dot net --- Comment #4 from physiker at toast2 dot net --- When I use gfortran version 7 to compile the code listed in comment 3, executing the resulting binary yields the following output: ./pr56691 Values in work are: 1.00000000 2.00000000 3.00000000 4.00000000 Call with whole array: works fine Inside LCB: size is 4 1.00000000 2.00000000 3.00000000 4.00000000 Call with array slice: off by 1 Inside LCB: size is 4 1.00000000 2.00000000 3.00000000 4.00000000 This is the expected result. The bug might be fixed. LANG=C gfortran-7 -o pr56691 pr56691.f90 -v -W -Wall Driving: gfortran-7 -o pr56691 pr56691.f90 -v -W -Wall -mmacosx-version-min=10.11.6 -asm_macosx_version_min=10.11 -l gfortran -shared-libgcc Using built-in specs. COLLECT_GCC=gfortran-7 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/lto-wrapper Target: x86_64-apple-darwin15.6.0 Configured with: ../gcc/configure --enable-languages=c,c++,fortran,lto --with-gmp=/sw --with-libiconv-prefix=/sw --with-isl=/sw --with-mpc=/sw --with-system-zlib --program-suffix=-7 Thread model: posix gcc version 7.0.0 20161215 (experimental) [trunk revision 243680] (GCC) COLLECT_GCC_OPTIONS='-o' 'pr56691' '-v' '-Wextra' '-Wall' '-mmacosx-version-min=10.11.6' '-asm_macosx_version_min=10.11' '-shared-libgcc' '-mtune=core2' /usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951 pr56691.f90 -fPIC -quiet -dumpbase pr56691.f90 -mmacosx-version-min=10.11.6 -mtune=core2 -auxbase pr56691 -Wextra -Wall -version -fintrinsic-modules-path /usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/finclude -o /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccv54gNH.s GNU Fortran (GCC) version 7.0.0 20161215 (experimental) [trunk revision 243680] (x86_64-apple-darwin15.6.0) compiled by GNU C version 7.0.0 20161215 (experimental) [trunk revision 243680], GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU Fortran2008 (GCC) version 7.0.0 20161215 (experimental) [trunk revision 243680] (x86_64-apple-darwin15.6.0) compiled by GNU C version 7.0.0 20161215 (experimental) [trunk revision 243680], GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 COLLECT_GCC_OPTIONS='-o' 'pr56691' '-v' '-Wextra' '-Wall' '-mmacosx-version-min=10.11.6' '-shared-libgcc' '-mtune=core2' as -arch x86_64 -v -force_cpusubtype_ALL -mmacosx-version-min=10.11 -o /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccSNEf1F.o /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccv54gNH.s Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1as -triple x86_64-apple-macosx10.11.0 -filetype obj -main-file-name ccv54gNH.s -target-cpu core2 -fdebug-compilation-dir /Users/Peter/Devel/f90 -dwarf-debug-producer Apple LLVM version 8.0.0 (clang-800.0.42.1) -dwarf-version=2 -mrelocation-model pic -o /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccSNEf1F.o /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccv54gNH.s Reading specs from /usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/../../../libgfortran.spec rename spec lib to liborig COLLECT_GCC_OPTIONS='-o' 'pr56691' '-v' '-Wextra' '-Wall' '-mmacosx-version-min=10.11.6' '-shared-libgcc' '-mtune=core2' COMPILER_PATH=/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/:/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/:/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/:/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/:/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/ LIBRARY_PATH=/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/:/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/../../../ COLLECT_GCC_OPTIONS='-o' 'pr56691' '-v' '-Wextra' '-Wall' '-mmacosx-version-min=10.11.6' '-shared-libgcc' '-mtune=core2' /usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/collect2 -dynamic -arch x86_64 -macosx_version_min 10.11.6 -weak_reference_mismatches non-weak -o pr56691 -L/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0 -L/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/../../.. /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccSNEf1F.o -lgfortran -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lquadmath -lm -lgcc_ext.10.5 -lgcc -lSystem -v collect2 version 7.0.0 20161215 (experimental) [trunk revision 243680] /usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.11.6 -weak_reference_mismatches non-weak -o pr56691 -L/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0 -L/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/../../.. /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccSNEf1F.o -lgfortran -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lquadmath -lm -lgcc_ext.10.5 -lgcc -lSystem -v @(#)PROGRAM:ld PROJECT:ld64-274.2 configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS) Library search paths: /usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0 /usr/local/lib /usr/lib /usr/local/lib Framework search paths: /Library/Frameworks/ /System/Library/Frameworks/ /usr/bin/nm -n /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccSNEf1F.o