[PATCH] Return undef on conversions that overflow (PR21330).
spatel at rotateright.com
Fri Oct 3 09:35:30 PDT 2014
Hi asl, hfinkel, sylvestre.ledru,
The LLVM Lang Ref states for signed/unsigned int to float conversions:
"If the value cannot fit in the floating point value, the results are undefined."
And for FP to signed/unsigned int:
"If the value cannot fit in ty2, the results are undefined."
This matches the C definitions.
The existing behavior pins to infinity or a max int value, but that may just lead to more confusion as seen in:
Returning undef will hopefully lead to a less silent failure.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2881 bytes
Desc: not available
More information about the llvm-commits