https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77278
--- Comment #21 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #20) > OK, the mismatched declaration types are: > void <T67d> (struct array01_integer(kind=4) &, float & restrict, > logical(kind=4) *) > and > void <T621> (struct gfc_array_i4 * restrict, struct gfc_array_r4 * restrict, > GFC_LOGICAL_4) > > The mismatch happens in the last parameter that is logical(kind=4) and > GFC_LOGICAL_4. Thanks for looking into this. One question: What do I have to do to get at this type of information, and the following tree type dump? What exactly would I have to run? (I looked around, but could not find any info). > So mixing up enum and pointer to enum. > Fixing C source to expect pointer to enum makes warning to go away, but > looking at the gimple produced, it really just seems in bug in fortran FE > declaring the function incorrectly? It seems to really just pass 0 instead > of pointer to 0: > _gfortran_minloc0_4_r4 (&parm.1, _40, 0); It was certainly the inention to pass a value. However, I tried doing this with this little patchlet Index: intrinsic.c =================================================================== --- intrinsic.c (Revision 271843) +++ intrinsic.c (Arbeitskopie) @@ -2614,6 +2614,8 @@ add_functions (void) msk, BT_LOGICAL, dl, OPTIONAL, kind, BT_INTEGER, di, OPTIONAL, bck, BT_LOGICAL, dl, OPTIONAL); + set_attr_value (5, false, false, false, false, true); + make_generic ("minloc", GFC_ISYM_MINLOC, GFC_STD_F95); add_sym_3red ("minval", GFC_ISYM_MINVAL, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95, and ended up with minloc.f90:5: warning: type of '_gfortran_minloc0_4_r4' does not match original declaration [-Wlto-type-mismatch] 5 | m1 = minloc(a) | ../../../ggdb3/libgfortran/generated/minloc0_4_r4.c:38:1: note: type mismatch in parameter 3 ../../../ggdb3/libgfortran/generated/minloc0_4_r4.c:38:1: note: type 'GFC_LOGICAL_4' should match type 'logical(kind=4)' ../../../ggdb3/libgfortran/generated/minloc0_4_r4.c:38:1: note: 'minloc0_4_r4' was previously declared here ../../../ggdb3/libgfortran/generated/minloc0_4_r4.c:38:1: note: code may be misoptimized unless '-fno-strict-aliasing' is used Now, currently GFC_LOGICAL_4 is just a typedef for GFC_INTEGER_4, which in turn is just a typedef for int. Could this be the source of the trouble here? And what could we do about a GFC_LOGICAL_2 and so on?