This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]