[bootstrap-O1] change value type to avoid sprintf buffer size warning (was: Re: [bootstrap-O1] enlarge sprintf output buffer to avoid warning)

2017-01-04 Thread Alexandre Oliva
On Jan 4, 2017, Martin Sebor wrote: > The manual recommends to use a length modifier to constrain the length > of output to that of a narrower type: > sprintf (xname, "", ((unsigned short)((uintptr_t)(t) & 0x))); > This should work even without optimization. It might not work if short h

Re: [bootstrap-O1] enlarge sprintf output buffer to avoid warning

2017-01-04 Thread Martin Sebor
On 01/03/2017 10:39 AM, Jeff Law wrote: On 01/02/2017 10:28 PM, Alexandre Oliva wrote: In stage2 of bootstrap-O1, the code that warns if sprintf might overflow its output buffer cannot tell that an unsigned value narrowed to 16 bits will fit in 4 bytes with %4x. I couldn't find a better way to

Re: [bootstrap-O1] enlarge sprintf output buffer to avoid warning

2017-01-03 Thread Jeff Law
On 01/02/2017 10:28 PM, Alexandre Oliva wrote: In stage2 of bootstrap-O1, the code that warns if sprintf might overflow its output buffer cannot tell that an unsigned value narrowed to 16 bits will fit in 4 bytes with %4x. I couldn't find a better way to avoid the warning at -O1 than growing the

[bootstrap-O1] enlarge sprintf output buffer to avoid warning

2017-01-02 Thread Alexandre Oliva
In stage2 of bootstrap-O1, the code that warns if sprintf might overflow its output buffer cannot tell that an unsigned value narrowed to 16 bits will fit in 4 bytes with %4x. I couldn't find a better way to avoid the warning at -O1 than growing the buffer so that there's no doubt the output will