https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118779
Bug ID: 118779 Summary: [15 Regression] clisp miscompilation since r15-580 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- Created attachment 60409 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60409&action=edit package.i clisp package.c seems to be miscompiled since r15-580-gf3e5f4c58591f5dacdd14a65ec47bbe310df02a0 /opt/notnfs/gcc-bisect/obj/gcc/cc1.r15-579 -quiet -fexceptions -fpie -fstack-protector-strong -m64 -march=x86-64 -mtune=generic -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O -fwrapv -fno-strict-aliasing package.i -std=gnu2x -fdump-tree-dom3-details-folding -fdump-tree-slsr vs. /opt/notnfs/gcc-bisect/obj/gcc/cc1.r15-580 -quiet -fexceptions -fpie -fstack-protector-strong -m64 -march=x86-64 -mtune=generic -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O -fwrapv -fno-strict-aliasing package.i -std=gnu2x -fdump-tree-dom3-details-folding -fdump-tree-slsr has identical slsr dump but in dom3 I see only in the r15-580 dump in rehash_symtab function (noinline added by me, but it still reproduces with that). Applying pattern match.pd:7200, generic-match-6.cc:1457 [6] Registering jump thread: (13, 14) incoming edge; (14, 18) normal; where match.pd:7200 at that revision was 98998245d99f (Richard Biener 2016-04-29 08:36:49 +0000 7194) /* Simplify pointer equality compares using PTA. */ 98998245d99f (Richard Biener 2016-04-29 08:36:49 +0000 7195) (for neeq (ne eq) 98998245d99f (Richard Biener 2016-04-29 08:36:49 +0000 7196) (simplify 98998245d99f (Richard Biener 2016-04-29 08:36:49 +0000 7197) (neeq @0 @1) 98998245d99f (Richard Biener 2016-04-29 08:36:49 +0000 7198) (if (POINTER_TYPE_P (TREE_TYPE (@0)) 98998245d99f (Richard Biener 2016-04-29 08:36:49 +0000 7199) && ptrs_compare_unequal (@0, @1)) f913ff2adc41 (Thomas Koenig 2018-04-07 23:52:03 +0000 7200) { constant_boolean_node (neeq != EQ_EXPR, type); }))) _126 = (unsigned int) _9; _127 = _126 + 4294967295; _128 = (sizetype) _127; _129 = _128 + 1; _130 = _129 * 8; _131 = (void * *) _130; ... <bb 7> [local count: 738197516]: # offset_66 = PHI <0B(6), offset_101(9)> ... offset_101 = offset_66 + 8; if (offset_101 != _131) ... _119 = (unsigned int) _9; _120 = _119 + 4294967295; _121 = (sizetype) _120; _122 = _121 + 1; _123 = _122 * 8; _124 = (void * *) _123; ... <bb 11> [local count: 738197528]: # offset_69 = PHI <0B(10), offset_108(14)> ... offset_108 = offset_69 + 8; if (offset_108 != _124) bb 7 is one loop, bb 11 is another. Now, _131 and _124 to me look to be the same thing. In the source, those 2 loops are { { gcv_object_t* offset = 0; { uintWL count = oldsize; do { { object oldentry = *(gcv_object_t*)(((UBYTE*)(&((Svector)((oint)(((STACK[-1-(sintP)(2)])))-1UL))->data[0])+((aint)offset)) ); if ((((oint)(oldentry) & 7) == (3UL +0))) do { ((STACK[-1-(sintP)(-1)]) = ((((Cons)((oint)(oldentry)-3UL))->cdr)), STACK -= -1); (((Cons)((oint)(oldentry)-3UL))->cdr) = ((STACK[-1-(sintP)(2)])); ((STACK[-1-(sintP)(2)])) = oldentry; newinsert((((Cons)((oint)(oldentry)-3UL))->car),newsize); oldentry = (STACK -= 1, (STACK[-1-(sintP)(-1)])); } while ((((oint)(oldentry) & 7) == (3UL +0))); offset++; }} while (--count); }}} { { gcv_object_t* offset = 0; { uintWL count; do { if (!(sizeof(count)==sizeof(uintL))) { dotimes_called_with_count_of_wrong_size(); }; { count = (oldsize); do {{ { object oldentry = *(gcv_object_t*)(((UBYTE*)(&((Svector)((oint)(((STACK[-1-(sintP)(2)])))-1UL))->data[0])+((aint)offset))); if (!((((oldentry) == (((object)((UBYTE*)(&symbol_tab_data.S_nil)+(1UL)))))) || (((oint)(oldentry) & 7) == (3UL +0)))) { ((STACK[-1-(sintP)(-1)]) = (oldentry), STACK -= -1); newinsert(oldentry,newsize); (STACK -= (sintP)(1)); } offset++; }}} while (--count != 0); }; } while(0) # 224 "../src/package.d" ; }}} Arguably, maybe the 2 offset vars should have aint type and use offset+=sizeof (gcv_object_t); instead of offset++.