https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93806

--- Comment #1 from Alexander Cherepanov <ch3root at openwall dot com> ---
And instability of integers then easily taints surrounding code:

----------------------------------------------------------------------
#include <stdio.h>

__attribute__((noipa)) // imagine it in a separate TU
static double opaque(double d) { return d; }

int main()
{
    int one = opaque(1);

    int x = opaque(1);
    int a = 1 + opaque(0x1p-60) == x;

    printf("one = %d\n", one);

    opaque(a);
    if (one == a) {
        opaque(0);
        if (x == 1) {
            opaque(0);
            if (a == 0) {
                opaque(0);
                if (one == 0)
                    printf("one = %d\n", one);
            }
        }
    }
}
----------------------------------------------------------------------
$ gcc -std=c11 -pedantic -Wall -Wextra -funsafe-math-optimizations -O3 test.c
&& ./a.out
one = 1
one = 0
----------------------------------------------------------------------
gcc x86-64 version: gcc (GCC) 10.0.1 20200218 (experimental)
----------------------------------------------------------------------

Reply via email to