Hi Harald, On 28.03.22 22:03, Harald Anlauf via Fortran wrote:
All current cases of printing a HOST_WIDE_INT in gcc/fortran/ use 'sprintf', and I did not find any other use of %wd/%wu. So the mentioned implementation is not really stressed yet... ;-)
That's all your fault ;-) (Your commit https://gcc.gnu.org/r12-3273-ge4cb3bb9ac11b4126ffa718287dd509a4b10a658 did remove the only user.)
../../gcc-trunk/gcc/fortran/resolve.cc: In function 'bool resolve_structure_cons(gfc_expr*, int)': ../../gcc-trunk/gcc/fortran/resolve.cc:1388:43: warning: unknown conversion type character 'w' in format [-Wformat=] la, lb, comp->name, &cons->expr->where); ^
That's only a warning. Have you tried whether it works at runtime? My bet is that it does! Question: Do you build with --disable-bootstrap ? Or do you do a proper bootstrap? I am asking because: * Here, it bootstraps *without* warnings/errors (I do a full bootstrap) * GCC is bootstrapped with -Werror, i.e. I had expected an error and not a warning, while with --disable-bootstrap, the -Werror is not used as some random compiler may have additional (correct or bogus) warnings. * %wd is only supported since GCC 12. The supported formats + the warning is bound to the compiler version, i.e. an older compiler does not support newer flags and, thus, warns for them when compiling. (But as the support depends on the current source, the compile-time warning of older compilers can be ignored.) * * * Can you check & try again? I don't mind getting a format warning with GCC < GCC 12. But with GCC 12 compiled (either installed compiler or when bootstrapping) it should compile without errors. If you can confirm my suspicion, the patch LGTM. Tobias PS: I played around a bit. And with a GCC 12 bootstrap, I get as expected an error (not a warning) for something unsupported (%Wd) while %wd is supported. Additionally, I see a '|' in the output. The "|" appeared with GCC 9. Thus, I wonder whether you compile w/o bootstrapping with GCC 8? ../gcc/fortran/resolve.cc:1386:55: error: unknown conversion type character ‘W’ in format [-Werror=format=] 1386 | gfc_error ("Unequal character lengths (%Wd/%wd) for pointer " | ^ ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955