https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61502
--- Comment #40 from Alexander Cherepanov <ch3root at openwall dot com> --- Example with a flexible array member: ---------------------------------------------------------------------- #include <string.h> #include <stdio.h> __attribute__((noipa)) // imagine it in a separate TU static void *opaque(void *p) { return p; } int main() { int x[5]; struct { int i, j, a[]; } y; printf("eq1: %d\n", x == y.a); int *p = x; int *q = y.a; printf("eq2: %d\n", p == q); printf("diff: %d\n", memcmp(&p, &q, sizeof(int *))); opaque(q); // escaped opaque(&p); // move the next comparison to run-time printf("eq3: %d\n", p == q); } ---------------------------------------------------------------------- $ gcc -std=c11 -pedantic -Wall -Wextra test.c && ./a.out eq1: 0 eq2: 1 diff: 0 eq3: 1 $ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out eq1: 0 eq2: 0 diff: 0 eq3: 1 ---------------------------------------------------------------------- gcc x86-64 version: gcc (GCC) 10.0.0 20200110 (experimental) ---------------------------------------------------------------------- This example should be standard-compliant. eq1 is wrong even without optimization, eq2 folded by fre1.