optimizer discards sign information
LIU Hao
lh_mouse@126.com
Wed Apr 10 10:07:48 GMT 2024
在 2024-04-10 17:52, Xi Ruoyao via Gcc-help 写道:
> No, the OP is still thinking it's a wrong-code.
Would you read the Subject please?
u32 x = a * b;
u64 r = x;
return r;
This is same as
u32 x = (int) a * (int) b;
u64 r = x;
return r;
and
return (u64)(u32) ((int) a * (int) b);
The code requests an `int` be zero-extended to a `u64` (if the result is written to EAX then this is
no-op), but GCC performs sign extension anyway. Do you still consider it not a bug?
--
Best regards,
LIU Hao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20240410/a09943f0/attachment-0001.sig>
More information about the Gcc-help
mailing list