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

            Bug ID: 110754
           Summary: assume create spurious load for volatile variable
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

With optimization, using assume with volatile create spurious loads:

int bar(int p)
{
    volatile int n = p;
    [[assume (1 == n)]];
    return 1 + n;
}


bar(int):
        mov     DWORD PTR [rsp-4], edi
        mov     eax, DWORD PTR [rsp-4]
        mov     eax, DWORD PTR [rsp-4]
        add     eax, 1
        ret

Reply via email to