[Bug rtl-optimization/62030] New: wrong code due to aliasing issue

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 6 05:08:00 GMT 2014


            Bug ID: 62030
           Summary: wrong code due to aliasing issue
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Keywords: alias, wrong-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Blocks: 61964
            Target: mipsisa64-elf

With a slightly modified version of the testcase for PR 61964 (I have an
optimization pass which does the optimization but I can confirm it with an
upstream GCC with the modified source), I get the failure on mipsisa64-elf.
Here is the testcase:
/* { dg-do run } */

extern void abort (void);

struct node { struct node *next, *prev; } node;
struct head { struct node *first; } heads[5];
int k = 2;
struct head *head = &heads[2];

static int __attribute__((noinline))
  node.prev = (void *)head;
  head->first = &node;

  struct node *n = head->first;
  struct head *h = &heads[k];
  struct node *next = n->next;

  if (n->prev == (void *)h)
    h->first = next;
    n->prev->next = next;

  n->next = h->first;
  return n->next == &node;

int main()
  if (foo ())
    abort ();
  return 0;

Compile with -O2 -march=octeon to see the failure.

CE1 is where the combining of the two stores happen.

More information about the Gcc-bugs mailing list