https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69304
Bug ID: 69304 Summary: Fortran logical common block equivalence lto Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: physiker at toast2 dot net Target Milestone: --- Compiling m.f90 and f.f90 into a shared library with the -flto opion active causes a strange "warning: type of 'l' does not match original declaration". The definition of the common block is identical in both input files (include 'l.inc'), though. The same message occurs when the files are compiled with gcc-5.3 on osx or on linux. l.inc COMMON /L/ F LOGICAL(4) F SAVE /L/ !=========================================================================== m.f90 SUBROUTINE A IMPLICIT NONE INCLUDE 'l.inc' LOGICAL(4) :: M(12) EQUIVALENCE (M(1),F) END SUBROUTINE A !=========================================================================== t.f90 SUBROUTINE B IMPLICIT NONE INCLUDE 'l.inc' END SUBROUTINE B !=========================================================================== bash-3.2$ gfortran-6 -v -c -flto -fPIC -W -Wall -pedantic t.f90 Using built-in specs. COLLECT_GCC=gfortran-6 Target: x86_64-apple-darwin13.4.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=-6 Thread model: posix gcc version 6.0.0 20160114 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-c' '-flto' '-fPIC' '-Wextra' '-Wall' '-Wpedantic' '-mmacosx-version-min=10.9.4' '-mtune=core2' /usr/local/libexec/gcc/x86_64-apple-darwin13.4.0/6.0.0/f951 t.f90 -fPIC -quiet -dumpbase t.f90 -mmacosx-version-min=10.9.4 -mtune=core2 -auxbase t -Wextra -Wall -Wpedantic -version -flto -fPIC -fintrinsic-modules-path /usr/local/lib/gcc/x86_64-apple-darwin13.4.0/6.0.0/finclude -o /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccHS2R6E.s GNU Fortran (GCC) version 6.0.0 20160114 (experimental) (x86_64-apple-darwin13.4.0) compiled by GNU C version 6.0.0 20160114 (experimental), GMP version 6.1.0, MPFR version 3.1.3, MPC version 1.0.3, isl version 0.14 or 0.13 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU Fortran2008 (GCC) version 6.0.0 20160114 (experimental) (x86_64-apple-darwin13.4.0) compiled by GNU C version 6.0.0 20160114 (experimental), GMP version 6.1.0, MPFR version 3.1.3, MPC version 1.0.3, isl version 0.14 or 0.13 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 COLLECT_GCC_OPTIONS='-v' '-c' '-flto' '-fPIC' '-Wextra' '-Wall' '-Wpedantic' '-mmacosx-version-min=10.9.4' '-mtune=core2' as -arch x86_64 -force_cpusubtype_ALL -o t.o /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccHS2R6E.s COMPILER_PATH=/usr/local/libexec/gcc/x86_64-apple-darwin13.4.0/6.0.0/:/usr/local/libexec/gcc/x86_64-apple-darwin13.4.0/6.0.0/:/usr/local/libexec/gcc/x86_64-apple-darwin13.4.0/:/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/6.0.0/:/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/ LIBRARY_PATH=/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/6.0.0/:/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/6.0.0/../../../ COLLECT_GCC_OPTIONS='-v' '-c' '-flto' '-fPIC' '-Wextra' '-Wall' '-Wpedantic' '-mmacosx-version-min=10.9.4' '-mtune=core2' bash-3.2$ gfortran-6 -v -c -flto -fPIC -W -Wall -pedantic m.f90 Using built-in specs. COLLECT_GCC=gfortran-6 Target: x86_64-apple-darwin13.4.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=-6 Thread model: posix gcc version 6.0.0 20160114 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-c' '-flto' '-fPIC' '-Wextra' '-Wall' '-Wpedantic' '-mmacosx-version-min=10.9.4' '-mtune=core2' /usr/local/libexec/gcc/x86_64-apple-darwin13.4.0/6.0.0/f951 m.f90 -fPIC -quiet -dumpbase m.f90 -mmacosx-version-min=10.9.4 -mtune=core2 -auxbase m -Wextra -Wall -Wpedantic -version -flto -fPIC -fintrinsic-modules-path /usr/local/lib/gcc/x86_64-apple-darwin13.4.0/6.0.0/finclude -o /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccJqlXsY.s GNU Fortran (GCC) version 6.0.0 20160114 (experimental) (x86_64-apple-darwin13.4.0) compiled by GNU C version 6.0.0 20160114 (experimental), GMP version 6.1.0, MPFR version 3.1.3, MPC version 1.0.3, isl version 0.14 or 0.13 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU Fortran2008 (GCC) version 6.0.0 20160114 (experimental) (x86_64-apple-darwin13.4.0) compiled by GNU C version 6.0.0 20160114 (experimental), GMP version 6.1.0, MPFR version 3.1.3, MPC version 1.0.3, isl version 0.14 or 0.13 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 COLLECT_GCC_OPTIONS='-v' '-c' '-flto' '-fPIC' '-Wextra' '-Wall' '-Wpedantic' '-mmacosx-version-min=10.9.4' '-mtune=core2' as -arch x86_64 -force_cpusubtype_ALL -o m.o /var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//ccJqlXsY.s COMPILER_PATH=/usr/local/libexec/gcc/x86_64-apple-darwin13.4.0/6.0.0/:/usr/local/libexec/gcc/x86_64-apple-darwin13.4.0/6.0.0/:/usr/local/libexec/gcc/x86_64-apple-darwin13.4.0/:/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/6.0.0/:/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/ LIBRARY_PATH=/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/6.0.0/:/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/6.0.0/../../../ COLLECT_GCC_OPTIONS='-v' '-c' '-flto' '-fPIC' '-Wextra' '-Wall' '-Wpedantic' '-mmacosx-version-min=10.9.4' '-mtune=core2' bash-3.2$ gfortran-6 -shared -o lib.dylib -W -Wall -pedantic m.o t.o l.inc:2:0: warning: type of 'l' does not match original declaration [-Wlto-type-mismatch] COMMON /L/ F l.inc:2:0: note: 'l' was previously declared here COMMON /L/ F l.inc:2:0: note: code may be misoptimized unless -fno-strict-aliasing is used