On Sat, Jan 13, 2018 at 7:35 PM, Dominique d'Humières <domi...@tournesol.lps.ens.fr> wrote: > I have finally bootstrapped gfortran with the two patches applied and the > spurious warnings with -Wall are now gone (limited testing), but I see a > regression for gfortran.dg/string_1.f90 due to an additional error > > /opt/gcc/_clean/gcc/testsuite/gfortran.dg/string_1.f90:13:15: > > print *, len(s) > 1 > Error: Result of LEN overflows its kind at (1) > > No idea why this was not emitted without the patch.
Thanks for testing, I'll look into this. Was it on a 32 or 64-bit target? (I suspect the issue could be that the 32-bit truncated value fits in [0,INT_MAX] and hence no problem is detected, but I'll have to look into it further to say something definite). >> Le 12 janv. 2018 à 21:43, Joseph Myers <jos...@codesourcery.com> a écrit : >> >> On Fri, 12 Jan 2018, Janne Blomqvist wrote: >> >>> (I don't know why HOST_WIDE_INT_PRINT_DEC doesn't work with the >>> diagnostics machinery on darwin, but IMHO at this point it's too late >> >> HOST_WIDE_INT_PRINT_DEC is a host-specific printf format; for example, it >> might use %I64d on Windows host or %lld elsewhere. The formats used in >> diagnostic functions must *not* be host-specific or use macros anywhere in >> them at all, because that won't work with translation. Diagnostic >> functions have their own host-independent formats; %wd is the correct >> format for HOST_WIDE_INT in diagnostic functions. >> >> -- >> Joseph S. Myers >> jos...@codesourcery.com > > I have tried to use %wp, but it didn’t work: > > ../../work/gcc/fortran/decl.c: In function 'void > gfc_set_constant_character_len(gfc_charlen_t, gfc_expr*, gfc_charlen_t)': > ../../work/gcc/fortran/decl.c:1567:5: error: unknown conversion type > character 'w' in format [-Werror=format=] > "CHARACTER expression at %L is being truncated " > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > "(%wd/%wd)", &expr->where, > ~~~~~~~~~~~ > ../../work/gcc/fortran/decl.c:1567:5: error: unknown conversion type > character 'w' in format [-Werror=format=] > ../../work/gcc/fortran/decl.c:1567:5: error: too many arguments for format > [-Werror=format-extra-args] > ../../work/gcc/fortran/decl.c:1575:17: error: unknown conversion type > character 'w' in format [-Werror=format=] > gfc_error_now ("The CHARACTER elements of the array constructor " > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > "at %L must have the same length (%wd/%wd)", > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ../../work/gcc/fortran/decl.c:1575:17: error: unknown conversion type > character 'w' in format [-Werror=format=] > ../../work/gcc/fortran/decl.c:1575:17: error: too many arguments for format > [-Werror=format-extra-args] Yes, same for the on x86-64 Linux. Might be something weird on the gfortran diagnostics stuff, as it seems %wd is used in the middle end. Anyway, that's stage1 stuff IMHO. -- Janne Blomqvist