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

            Bug ID: 95908
           Summary: [AArch64] wrong code with ILP32 and -fwrapv
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markus at oberhumer dot com
  Target Milestone: ---

[this issue has been extraced from bug 95903]

Link at Compiler Explorer: https://gcc.godbolt.org/z/mRf2kd


The function below does compute the address in 64 (and not in 32) bits, which
seems wrong when using "-fwrapv -fwrapv-pointer".

As discussed in bug 95903 some feedback from the target maintainer
would be welcome.


// arm64-linux-gcc -mabi=ilp32 -O2 -fwrapv -fwrapv-pointer

char get_byte(const char* ptr, int off)
{
    off += 2147483647;
    return ptr[off];
}

Reply via email to