https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68560
--- Comment #12 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- > Looks like it's PR68540. So it should work now? The statement in fortran/trans-intrinsic.c gfc_copy_formal_args_intr (sym, expr->value.function.isym, ignore_optional ? expr->value.function.actual : NULL); looks suspicious: if ignore_optional means what indicated by the name and is true, why passing expr->value.function.actual and NULL otherwise? --- ../_clean/gcc/fortran/trans-intrinsic.c 2015-12-02 23:00:12.000000000 +0100 +++ gcc/fortran/trans-intrinsic.c 2015-12-04 12:26:05.000000000 +0100 @@ -3032,7 +3032,7 @@ gfc_get_symbol_for_expr (gfc_expr * expr } gfc_copy_formal_args_intr (sym, expr->value.function.isym, - ignore_optional ? expr->value.function.actual + !ignore_optional ? expr->value.function.actual : NULL); return sym; "fixes" the failure for gfortran.dg/shape_8.f90, but causes FAIL: gfortran.dg/char_pack_1.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/char_eoshift_1.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/char_pack_2.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/char_eoshift_2.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/cshift_large_1.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/eoshift_large_1.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/nested_reshape.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/optional_dim_2.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/optional_dim_3.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/reshape_4.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/reshape_zerosize_1.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/widechar_intrinsics_10.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/widechar_intrinsics_5.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/zero_sized_1.f90 -g -flto (test for excess errors) with -m32/-m64 and FAIL: gfortran.dg/cshift_large_1.f90 -g -flto (test for excess errors) FAIL: gfortran.dg/eoshift_large_1.f90 -g -flto (test for excess errors) with -m64 (not run with -m32). For gfortran.dg/optional_dim_2.f90 the diff between the patched (-) and unpatched (+) trans-intrinsic.c is logical(kind=4) A.12[4]; struct array1_logical(kind=4) atmp.11; + integer(kind=8) * D.3471; integer(kind=8) D.3470; atmp.11.dim[0].lbound = 0; atmp.11.dim[0].ubound = 3; atmp.11.data = (void * restrict) &A.12; atmp.11.offset = 0; - _gfortran_eoshift0_8 (&atmp.11, D.3467, D.3469, 0B, &D.3470); + _gfortran_eoshift0_8 (&atmp.11, D.3467, D.3469, 0B, D.3471);