Dear Mikael, Your set of patches works as defined, i.e., it fixes pr45586 without regression on the test suite. However, If the test suite is run with -flto, there are still some failures depending on the way gcc is configured.
Configured with: ../p_work/configure --prefix=/opt/gcc/gcc4.8p-190641p1 --enable-languages=c,c++,lto,fortran,ada,objc,obj-c++ --with-gmp=/opt/mp --with-system-zlib --enable-checking=release --with-isl=/opt/mp --enable-lto --enable-plugin --enable-build-with-cxx === gfortran Summary for unix/-m64/-flto === # of expected passes 42057 # of unexpected failures 40 # of expected failures 56 # of unsupported tests 72 === gfortran Summary === # of expected passes 83827 # of unexpected failures 80 # of expected failures 112 # of unsupported tests 282 The failing tests are: FAIL: gfortran.dg/debug/pr35154-dwarf2.f -gdwarf-2 scan-assembler (DW_AT_name: "label"|"label[^\n]*"[^\n]*DW_AT_name) FAIL: gfortran.dg/debug/pr35154-dwarf2.f -gdwarf-2 -g3 scan-assembler (DW_AT_name: "label"|"label[^\n]*"[^\n]*DW_AT_name) FAIL: gfortran.dg/bind_c_array_params_2.f90 -O scan-assembler-times myBindC 1 FAIL: gfortran.dg/bind_c_vars.f90 -O0 (test for excess errors) FAIL: gfortran.dg/class_array_7.f03 -O1 (internal compiler error) FAIL: gfortran.dg/pr52835.f90 -O scan-tree-dump optimized "bar " FAIL: gfortran.dg/typebound_proc_27.f03 -O1 (internal compiler error) ... The ICEs and excess errors are [macbook] f90/bug% gfc /opt/gcc/work/gcc/testsuite/gfortran.dg/class_array_7.f03 -flto -O1 In file included from :0:0: /opt/gcc/work/gcc/testsuite/gfortran.dg/class_array_7.f03: In function 'main': /opt/gcc/work/gcc/testsuite/gfortran.dg/class_array_7.f03:49:0: internal compiler error: in fold_convert_loc, at fold-const.c:2008 use realloc ^ Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: gfc returned 1 exit status collect2: error: lto-wrapper returned 1 exit status [macbook] f90/bug% gfc /opt/gcc/work/gcc/testsuite/gfortran.dg/typebound_proc_27.f03 -flto -O1 In file included from :0:0: /opt/gcc/work/gcc/testsuite/gfortran.dg/typebound_proc_27.f03: In function 'main': /opt/gcc/work/gcc/testsuite/gfortran.dg/typebound_proc_27.f03:34:0: internal compiler error: in fold_convert_loc, at fold-const.c:2008 use m ^ Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: gfc returned 1 exit status collect2: error: lto-wrapper returned 1 exit status [macbook] f90/bug% gfc /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_vars.f90 /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_vars_driver.c -flto In file included from :0:0: /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_vars.f90:16:0: warning: type of 'b' does not match original declaration [enabled by default] integer(c_int), bind(c, name="myF90Array2D") :: B(3, 2) ^ In file included from /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_vars.f90:16:0, from :0: /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_vars_driver.c:12:5: note: previously declared here int myF90Array2D[2][3]; /* B in bind_c_vars */ ^ In file included from :0:0: /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_vars.f90:15:0: warning: type of 'a' does not match original declaration [enabled by default] integer(c_int), bind(c, name="myF90Array3D") :: A(18, 3:7, 10) ^ In file included from /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_vars.f90:16:0, from :0: /opt/gcc/work/gcc/testsuite/gfortran.dg/bind_c_vars_driver.c:11:5: note: previously declared here int myF90Array3D[10][5][18]; /* A in bind_c_vars */ ^ Note that despite the warnings, executing the test succeeds. Configured with: ../p_work/configure --prefix=/opt/gcc/gcc4.8x-190641p1 --enable-languages=c,c++,lto,fortran --with-gmp=/opt/mp --with-system-zlib --with-isl=/opt/mp --enable-lto --enable-plugin --enable-build-with-cxx === gfortran Summary for unix/-m64/-flto === # of expected passes 41905 # of unexpected failures 193 # of expected failures 56 # of unsupported tests 72 === gfortran Summary === # of expected passes 83523 # of unexpected failures 386 # of expected failures 112 # of unsupported tests 282 The additional failing tests are: FAIL: gfortran.dg/alloc_comp_assign_2.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_assign_3.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_assign_4.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_auto_array_2.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_bounds_1.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_constructor_1.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_constructor_2.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_constructor_3.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_constructor_4.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_initializer_1.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_result_2.f90 -O0 (internal compiler error) FAIL: gfortran.dg/assumed_rank_7.f90 -O0 (internal compiler error) FAIL: gfortran.dg/assumed_rank_9.f90 -O0 (internal compiler error) FAIL: gfortran.dg/class_to_type_1.f03 -O0 (internal compiler error) FAIL: gfortran.dg/extends_4.f03 -O0 (internal compiler error) FAIL: gfortran.dg/pr43808.f90 -O0 (internal compiler error) FAIL: gfortran.dg/select_type_26.f03 -O0 (internal compiler error) FAIL: gfortran.dg/select_type_27.f03 -O0 (internal compiler error) FAIL: gfortran.dg/type_to_class_1.f03 -O0 (internal compiler error) FAIL: gfortran.dg/typebound_operator_13.f03 -O0 (internal compiler error) FAIL: gfortran.dg/typebound_proc_20.f90 -O0 (internal compiler error) FAIL: gfortran.fortran-torture/execute/forall_5.f90, -O0 (internal compiler error) If I am not mistaken, all the failures are of the kind: FAIL: gfortran.dg/alloc_comp_assign_2.f90 -O0 (internal compiler error) FAIL: gfortran.dg/alloc_comp_assign_2.f90 -O0 (test for excess errors) Excess errors: /opt/gcc/p_work/gcc/testsuite/gfortran.dg/alloc_comp_assign_2.f90:7:0:0: error: non-trivial conversion at assignment struct array1_integer(kind=4) struct array1_integer(kind=4) a.0.i = parm.2; /opt/gcc/p_work/gcc/testsuite/gfortran.dg/alloc_comp_assign_2.f90:7:0:0: error: non-trivial conversion at assignment struct array1_integer(kind=4) struct array1_integer(kind=4) a.3.i = parm.5; /opt/gcc/p_work/gcc/testsuite/gfortran.dg/alloc_comp_assign_2.f90:7:0:0: error: non-trivial conversion at assignment struct array1_integer(kind=4) struct array1_integer(kind=4) a.65.i = parm.67; /opt/gcc/p_work/gcc/testsuite/gfortran.dg/alloc_comp_assign_2.f90:7:0:0: error: non-trivial conversion at assignment struct array1_integer(kind=4) struct array1_integer(kind=4) a.68.i = parm.70; /opt/gcc/p_work/gcc/testsuite/gfortran.dg/alloc_comp_assign_2.f90:7:0:0: error: non-trivial conversion at assignment struct b struct b temp.74[count1.73_47] = b.75; /opt/gcc/p_work/gcc/testsuite/gfortran.dg/alloc_comp_assign_2.f90:7:0:0: internal compiler error: verify_gimple failed lto-wrapper: /opt/gcc/p_xbuild/gcc/testsuite/gfortran/../../gfortran returned 1 exit status collect2: error: lto-wrapper returned 1 exit status Thanks for working on this annoying PR. Dominique