NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/53618: bogus warnings from printf %u and ntohs with -O1



The following reply was made to PR toolchain/53618; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: toolchain/53618: bogus warnings from printf %u and ntohs with -O1
Date: Sat, 22 Sep 2018 03:33:35 +0700

     Date:        Fri, 21 Sep 2018 11:20:01 +0000 (UTC)
     From:        Valery Ushakov <uwe%stderr.spb.ru@localhost>
     Message-ID:  <20180921112001.6B4C07A1D2%mollari.NetBSD.org@localhost>
 
   |  Isn't that what the 'h' length modifier (i.e. "%hu") is for?
 
 No, 'h' truncates the int value provided to 16 bits, it doesn't prevent the
 value being promoted from short to int in the first place.   And yes, all of 
 this is bizarre, and gcc could be lots smarter about (almost all of) these
 kinds of warnings ....
 
 kre
 


Home | Main Index | Thread Index | Old Index