Re: optimizer discards sign information

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

 



在 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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux