Re: Is PRE architecture dependent? aarch64 vs x86_64

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

 



* David Brown:

> Are you able to give an example of the C code for which the
> optimisation above applies, and values for which the result is
> affected?  (When thinking about overflows, I always like to use 16-bit
> int because the numbers are smaller and easier to work with.)

I think this code can turn something like

  (X * 3 - Y * 5) * 7

to

  X * 21 - Y * 35

Plug in X = 715827882 and Y = 429496729, then the original operation
does not have an overflow (the difference is 1), but the transformed
expression overflows on both 715827882 * 21 and 429496729 * 35.  So
this transformation is only correct for -fwrapv because it introduces
overflow cases that are not present in the original expression.

Thanks,
Florian




[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