https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91126

            Bug ID: 91126
           Summary: [10 regression] Incorrect constant propagation of
                    BIT_FIELD_REF
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wilco at gcc dot gnu.org
  Target Milestone: ---

gcc.c-torture/execute/pr31448-2.c generates incorrect code due to a recent
change with -O2 -mbig-endian on AArch64. fre3 constant-folds a BIT_FIELD_REF
<a, 32, 0> with value 0xFEFEFEFE as 0xFFFEFEFE. As a result the if-statement is
removed and we abort:

Value numbering store a.iIndex1 to -65794
Setting value number of .MEM_8 to .MEM_8 (changed)
Value numbering stmt = _1 = BIT_FIELD_REF <a, 32, 0>;
Successfully combined 2 partial definitions
Setting value number of _1 to 4294901503 (changed)
Value numbering stmt = _2 = _1 & 4294967040;
Match-and-simplified _1 & 4294967040 to 4294901248
RHS _1 & 4294967040 simplified to 4294901248
Setting value number of _2 to 4294901248 (changed)
Value numbering stmt = if (_2 != 4278124032)
marking known outgoing edge 2 -> 3 executable
Block 1: BB4 found not executable
...

Merging blocks 2 and 3
fix_loop_structure: fixing up loops for function
main ()
{
  struct stD.3411 aD.3421;

;;   basic block 2, loop depth 0, count 0 (precise), probably never executed
;;   Invalid sum of incoming counts 1073741824 (estimated locally), should be 0
(precise)
;;    prev block 0, next block 1, flags: (NEW, REACHABLE, VISITED)
;;    pred:       ENTRY [always]  count:1073741824 (estimated locally)
(FALLTHRU,EXECUTABLE)
  # .MEM_4 = VDEF <.MEM_3(D)>
  nextD.3412 = &aD.3421;
  # .MEM_7 = VDEF <.MEM_4>
  aD.3421.iIndexD.3408 = -65794;
  # .MEM_8 = VDEF <.MEM_7>
  aD.3421.iIndex1D.3409 = -65794;
  # .MEM_6 = VDEF <.MEM_8>
  # USE = nonlocal { D.3421 } (escaped)
  # CLB = nonlocal { D.3421 } (escaped)
  abortD.1083 ();
;;    succ:

}

Reply via email to