https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103584
Bug ID: 103584 Summary: Points-to information is not conservatively correct Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rsandifo at gcc dot gnu.org CC: hubicka at gcc dot gnu.org, rguenth at gcc dot gnu.org Target Milestone: --- Created attachment 51934 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51934&action=edit Patch to demonstrate the behaviour Applying the attached patch shows that points-to information cannot be used independently of check_fnspec. E.g. for gcc.c-torture/execute/20000703-1.c, the patch trips the new assert for: (gdb) call debug (def_stmt) __builtin_memset (p_3(D), 0, 28); (gdb) call debug (ref.base) *p_3(D) The check: else if ((TREE_CODE (base) == MEM_REF || TREE_CODE (base) == TARGET_MEM_REF) && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) { struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)); if (pi && !pt_solutions_intersect (gimple_call_clobber_set (call), &pi->pt)) { passes. If the asserts in the patch are disabled (by setting ASSERTS to 0) then we instead get: FAIL: gcc.c-torture/execute/memcpy-1.c -O2 execution test FAIL: gcc.c-torture/execute/memcpy-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test FAIL: gcc.c-torture/execute/memcpy-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test FAIL: gcc.c-torture/execute/memcpy-1.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gcc.c-torture/execute/memcpy-1.c -O3 -g execution test FAIL: gcc.c-torture/execute/memcpy-1.c -Os execution test FAIL: gcc.c-torture/execute/memset-3.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gcc.c-torture/execute/memset-3.c -O3 -g execution test See https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586201.html for more details.