https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68560
Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tkoenig at gcc dot gnu.org Component|lto |fortran --- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- For the test program test implicit none integer :: c(2), d(2) real, allocatable :: x(:,:) allocate(x(2,5)) c = shape(x) d = shape(x,kind=4) end the result of the compilation with -fdump-tree-original is ... { struct array2_real(kind=4) * D.3443; struct array1_integer(kind=4) parm.1; parm.1.dtype = 265; parm.1.dim[0].lbound = 1; parm.1.dim[0].ubound = 2; parm.1.dim[0].stride = 1; parm.1.data = (void *) &c[0]; parm.1.offset = -1; D.3443 = &x; _gfortran_shape_4 (&parm.1, D.3443); } { integer(kind=4) * D.3453; static integer(kind=4) C.3452 = 4; struct array2_real(kind=4) * D.3451; struct array1_integer(kind=4) parm.2; parm.2.dtype = 265; parm.2.dim[0].lbound = 1; parm.2.dim[0].ubound = 2; parm.2.dim[0].stride = 1; parm.2.data = (void *) &d[0]; parm.2.offset = -1; D.3451 = &x; D.3453 = &C.3452; _gfortran_shape_4 (&parm.2, D.3451, D.3453); } ... and -Wlto-type-mismatch seems right to complain that _gfortran_shape_4 (&parm.2, D.3451, D.3453); does not match _gfortran_shape_4 (&parm.1, D.3443); I have tried to understand why using the optional 'kind' argument generates a third argument (not needed as it is reflected by _gfortran_shape_x for kind=x). Looking at libgfortran/generated/shape_i4.c I see that shape_4 expects only two arguments. Looking at gcc/fortran/trans-intrinsic.c, I see ... case GFC_ISYM_SHAPE: case GFC_ISYM_SPREAD: case GFC_ISYM_YN2: /* Ignore absent optional parameters. */ return 1; ... Am I correct to understand that it is intended to prevents the emission of the optional argument? If yes, why is it not working (I lost the scent after that)?