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

            Bug ID: 122141
           Summary: bpf: wrong code with -mcpu=v1 or -mno-jmpext
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kristerw at gcc dot gnu.org
            Blocks: 118443
  Target Milestone: ---
            Target: bpf-unknown-none

The following function is miscompiled with -O2 -mcpu=v1:

int
f(long a, long b)
{
  return a > b ? 2 : 3;
}

The generated code is:

  f:
        jsgt    %r2,%r1,.L3
        mov     %r0,2
        exit
  .L3:
        mov     %r0,3
        exit

This incorrectly returns 2 when a == b.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118443
[Bug 118443] [Meta bug] Bugs triggered by and blocking more smtgcc testing

Reply via email to