$ gcc/xgcc -Bgcc/ ../../gcc/gcc/testsuite/gcc.c-torture/execute/alias-2.c -O1 -lm -o ./alias-2.exe ../../gcc/gcc/testsuite/gcc.c-torture/execute/alias-2.c:5:1: warning: return type defaults to ‘int’ [-Wimplicit-int] main() ^~~~ $ ./alias-2.exe Aborted (core dumped) abort is called unconditionally, the condition disappears during fwprop1.
I think a commit-order mixup? Works for me on x86_64. fwprop1 doesn't make much sense to me...
I see this on aarch64 as well. For me the abort becomes unconditional with cse1
Fails on arm too
Honza, please have a look here.
I will take a look. Seems something still needs update for alias.
The bug is caused by achors. We call Breakpoint 6, write_dependence_p (mem=0x7ffff69006f0, x=0x7ffff69006c0, x_mode=SImode, x_addr=0x7ffff6900690, mem_canonicalized=true, x_canonicalized=true, writep=false) at ../../gcc/alias.c:2897 2897 gcc_checking_assert (x_canonicalized (gdb) p debug_rtx (x) (mem:SI (plus:SI (mult:SI (reg:SI 110 [ off.0_2 ]) (const_int 4 [0x4])) (symbol_ref:SI ("*.LANCHOR0") [flags 0x182])) [1 a S4 A32]) $38 = void (gdb) p debug_rtx (mem) (mem:SI (plus:SI (mult:SI (reg:SI 110 [ off.0_2 ]) (const_int 4 [0x4])) (symbol_ref:SI ("b") [flags 0x2] <var_decl 0x7ffff7ff8a20 b>)) [1 b S4 A32]) $39 = void which is OK but we also have: (gdb) p debug_rtx (x_addr) (plus:SI (mult:SI (reg:SI 110 [ off.0_2 ]) (const_int 4 [0x4])) (symbol_ref:SI ("*.LANCHOR0") [flags 0x182])) $50 = void and we dispatch to: Breakpoint 9, base_alias_check (x=0x7ffff6900690, x_base=0x7ffff68fb5f0, y=0x7ffff69006d8, y_base=0x7ffff68fef48, x_mode=SImode, y_mode=SImode) at ../../gcc/alias.c:2065 (gdb) p debug_rtx (x_base) (symbol_ref:SI ("*.LANCHOR0") [flags 0x182]) $57 = void (gdb) p debug_rtx (y_base) (symbol_ref:SI ("b") [flags 0x2] <var_decl 0x7ffff7ff8a20 b>) $58 = void and eventually we return 0 in: if (GET_CODE (x_base) == SYMBOL_REF && GET_CODE (y_base) == SYMBOL_REF) { tree x_decl = SYMBOL_REF_DECL (x_base); tree y_decl = SYMBOL_REF_DECL (y_base); /* We can assume that no stores are made to labels. */ if (!x_decl || !y_decl) return 0; return compare_base_decls (x_decl, y_decl) != 0; } because x_base is NULL. I suppose easy fix is to always return true for anchor/decl compare, but perhaps there is a better way to check if the anchor possibly corresponds to the declaration?
Created attachment 37055 [details] proposed fix This patch adds compare of anchored variables
*** Bug 69206 has been marked as a duplicate of this bug. ***
Should be fixed by the following commit: 2016-01-14 Jan Hubicka <hubicka@ucw.cz> * alias.c (compare_base_symbol_refs): New function. (rtx_equal_for_memref_p, base_alias_check, memrefs_conflict_p): Use it.