On 3/17/21 6:00 PM, Sandra Loosemore wrote:
On 3/17/21 4:40 PM, Martin Sebor wrote:

[*] Does -Wformat-diag really trigger when using older GCC to build?
I thought it only triggered in stage 2 and 3 when using the same GCC
to rebuild itself.

I always end up hopelessly confused by anything involving configure scripts and makefiles, but....

Our scripts normally configure cross-compilers with --disable-build-format-warnings and there's a comment on that bit that these diagnostics are normally enabled when building non-stage-1 compilers.  A cross compiler doesn't bootstrap so is never stage 1, I guess.  For the purposes of testing this patch I did an explicit --enable-build-format-warnings instead, anyway.

Jan-Benedict, who reported the problem to me off-list, said he just did

configure --target=nios2-linux-gnu

and

make all-gcc

using the host gcc including with his distro, identified as "Debian 10.2.1-6".


I see.  I routinely notice -Wformat warnings when building
cross-compilers (my system compiler is GCC 8.3) so I've been
assuming they're to be expected.  For instance this one:

/src/gcc/master/gcc/gimple-fold.c: In function ‘bool gimple_fold_builtin_strncpy(gimple_stmt_iterator*, tree, tree, tree)’: /src/gcc/master/gcc/gimple-fold.c:1921:4: warning: format ‘%G’ expects argument of type ‘gcall*’, but argument 4 has type ‘gimple*’ [-Wformat=]
    "%G%qD destination unchanged after copying no bytes "
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    "from a string of length %E",
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    stmt, fndecl, slen);
    ~~~~

Since, as you say, cross-compilers don't build stages 2 and later,
disabling these warnings for their builds would seem like the only
solution.  Either that, or building them with the current GCC.

Either way, I'll try to remember to relax the warning for GCC 12
as I mentioned.

Martin

Reply via email to