https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113907
--- Comment #58 from Jan Hubicka <hubicka at gcc dot gnu.org> --- Created attachment 57702 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57702&action=edit Compare value ranges in jump functions This patch implements the jump function compare, however it is not good enough. Here is another wrong code: jh@ryzen3:~/gcc/build/stage1-gcc> cat a.c #include <stddef.h> #include <stdlib.h> __attribute__((used)) int val,val2 = 1; struct foo {int a;}; struct foo **ptr; __attribute__ ((noipa)) int test2 (void *a) { ptr = (struct foo **)a; } int test3 (void *a); int test(void) { struct foo *fp; test2 ((void *)&fp); fp = NULL; (*ptr)++; test3 ((void *)&fp); } int testb (void); int main() { for (int i = 0; i < val2; i++) if (val) testb (); else test(); } jh@ryzen3:~/gcc/build/stage1-gcc> cat b.c #include <stdlib.h> struct bar {int a;}; struct foo {int a;}; struct barp {struct bar *f; struct bar *g;}; extern struct foo **ptr; int test2 (void *); int test3 (void *); int testb(void) { struct bar *fp; test2 ((void *)&fp); fp = NULL; (*ptr)++; test3 ((void *)&fp); } jh@ryzen3:~/gcc/build/stage1-gcc> cat c.c #include <stdlib.h> __attribute__ ((noinline)) int test3 (void *a) { if (!*(void **)a) abort (); return 0; } jh@ryzen3:~/gcc/build/stage1-gcc> ./xgcc -B ./ -O3 a.c b.c -flto -c ; ./xgcc -B ./ -O3 c.c -flto -fno-strict-aliasing -c ; ./xgcc -B ./ b.o a.o c.o ; ./a.out Aborted (core dumped) jh@ryzen3:~/gcc/build/stage1-gcc> ./xgcc -B ./ -O3 a.c b.c -flto -c ; ./xgcc -B ./ -O3 c.c -flto -fno-strict-aliasing -c ; ./xgcc -B ./ b.o a.o c.o --disable-ipa-icf ; ./a.out lto1: note: disable pass ipa-icf for functions in the range of [0, 4294967295] lto1: note: disable pass ipa-icf for functions in the range of [0, 4294967295]