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

--- Comment #4 from Alexander Cherepanov <ch3root at openwall dot com> ---
(In reply to Richard Biener from comment #1)
> guess DOM would also happily propagate equivalences

Yeah, this gives a simpler testcase:

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

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

int main()
{
    unsigned char x = opaque(1);
    unsigned char y;
    (void)&y;

    if (x - 1 == y) {
        printf("x = %d;  x - 1 = %d\n", x, opaque(1) ? x - 1 : 5);
        opaque(y);
    }
}
----------------------------------------------------------------------
$ gcc -std=c11 test.c && ./a.out
x = 1;  x - 1 = 0
$ gcc -std=c11 -O3 test.c && ./a.out
x = 1;  x - 1 = 5
----------------------------------------------------------------------
gcc x86-64 version: gcc (GCC) 10.0.1 20200126 (experimental)
----------------------------------------------------------------------

Reply via email to