The following program returns an incorrect result when compiled for
arm-none-elf at -O2:

~~~~~~~~~~

typedef struct {
  int data[4];
} arr16_t;

int result = 0;

void func2(int i, int j, arr16_t arr)
{
  result = (arr.data[0] != 1
            || arr.data[1] != 2
            || arr.data[2] != 3
            || arr.data[3] != 4);
}

void func1(int i, int j, int k, arr16_t a)
{
  func2(i, j, a);
}

int main(int argc, const char *argv[])
{
  arr16_t arr = {{1, 2, 3, 4}};

  func1(0, 0, 0, arr);
  return result;
}

~~~~~~~~~~

It should exit with 0, but instead exits with 1.


-- 
           Summary: Sibcall optimization fails to detect overlap
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jconner at apple dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32602

Reply via email to