Liste des Groupes | Revenir à c arch |
>
The main bad effect is that I replaced more efficient and shorter code
with less efficient and longer code. In theory the compiler can
generate the same code for both, but in practice that does not happen.
As an example, the test for the smallest signed integer can be written
with -fwrapv as:
if (x<=x-1)
and gcc -fwrapv compiles this to shorter code on AMD64 than
if (x==CELL_MIN)
What gcc produces for both formulations is longer than
dec %rdi
jno ...
>
Maybe instead of pursuing "optimizations" against the intentions of
the programmer, they should concentrate on implementing real
optimizations like optimizing either variant into the small code shown
last.
Interestingly, the first idiom is a case where gcc recognizes what the
intention of the programmer is, and warns that it is going to
miscompile it. The warning is good, the miscompilation not (but it
would be worse without the warning).
>
In any case, while the actual experience is that I have not been hit
by "optimizations" that ATUBDNH in production code, possibly because I
minimize these assumptions with flags like -fwrapv, the possibility
that my code might be hit by such an "optimization" (e.g., a new one
in a new compiler version, if I am lucky with a new flag for disabling
the assumption, but my source code does not know about it yet) and the
attitude of people who implement such "optimizations" is what I
resent.
- anton
Les messages affichés proviennent d'usenet.