Re: Is PRE architecture dependent? aarch64 vs x86_64

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

 



Hi!

On Fri, Jul 18, 2025 at 07:11:12PM +0200, David Brown wrote:
> I'm getting the feeling that we've got our wires crossed somewhere.
> 
> Signed integer /arithmetic/ overflow is UB in the C standards and in gcc
> (unless "-fwrapv" is in effect).

Yup.

> Conversion to a signed integer type, when the value cannot be preserved, is
> implementation-defined behaviour in the C standards, and in gcc (gcc defines
> it to be two's complement wrapping).

And leaving it UB is a valid implementation.  An implementation is not
required to specify anything in particular.

> A "cast from unsigned to int" is a conversion, thus it is
> implementation-defined.

Yup.

> I think somewhere along the line in this thread, the conversions and signed
> integer arithmetic overflows have been mixed together.

Oh, people do that all the time!


Segher



[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