[Bug c/81840] Incorrect warning issued in arm-to-x86_64 cross compilation

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Aug 13 22:27:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81840

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
I don't see this with trunk (GCC 8.0) configured for the same target.  The
warning tends to be sensitive to char (and short) conversions because of
limitations in its integration with the Value Range Propagation pass.  It's
possible that changes to it or to other areas have improved the quality of the
range info to avoid the warning.  To avoid these false positives it's best to
use the length modifier most appropriate for the type of the argument.  I.e.,
in the gas source, use the %hhx directive like so:

    snprintf (output_invalid_buf, sizeof (output_invalid_buf),
       "(0x%hhx)", (unsigned char) c);


More information about the Gcc-bugs mailing list