[PATCH] Fix undefined behaviour in lround,llround.
Dave Korn
dave.korn.cygwin@gmail.com
Mon Jul 19 10:37:00 GMT 2010
On 16/07/2010 19:14, Howland Craig D (Craig) wrote:
> (which would be nothing). So I think that just one SAFE_SHIFT per file
> is needed and appropriate.
Fair enough. I also got tired of doing it in my head, so I went and
annotated the whole thing as well, in case anyone wants to check my working.
(Another approach would be to replace "unsigned int tmp" with an unsigned
long long, or cast it to that when it gets shifted, but we could only do that
in llround, as newlib has to run on non-C99 systems so we can't assume the
availability of long long in any function that doesn't require them as
parameters. So I took this approach because it works identically for both
files. Also, allocating another DImode pseudo in the middle of all this
wouldn't do the register pressure any favours, particularly on x86.)
Also, I could omit SAFE_LEFT_SHIFT from the header file since it's unused
now, but I didn't do so in this iteration; I'll wait and do it before
committing if this version gets approved. Likewise if the annotations aren't
desired, I could remove them on commit.
Same changelog as before. OK now/with/without above-mentioned minor
alterations?
cheers,
DaveK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fpmath-lround-fix.diff
Type: text/x-c
Size: 5434 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20100719/d860aba5/attachment.bin>
More information about the Newlib
mailing list