[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    [Comitted] Add testcase for some miscompile in older versions of GCC
From:       Andrew Pinski <pinskia () gmail ! com>
Date:       2014-08-30 22:35:35
Message-ID: CA+=Sn1mwo2sbG62X5b8rrj9w=w=kO+XhjmDLnZFgBz0rpTDJYg () mail ! gmail ! com
[Download RAW message or body]

Hi,
  In some versions of GCC with AARCH64 backported, I got a miscompile
of a shift that involved a load which had a post increment of the
address.  This adds the testcase I created for that case.

Comitted after a quick test on x86_64-linux-gnu of the testcase.  I
had meant to commit this two days which is why the testcase is dated
two days ago.

Thanks,
Andrew Pinski

ChangeLog:
* gcc.c-torture/execute/20140828-1.c: New testcase.

["addtestcase.diff.txt" (text/plain)]

Index: gcc.c-torture/execute/20140828-1.c
===================================================================
--- gcc.c-torture/execute/20140828-1.c	(revision 0)
+++ gcc.c-torture/execute/20140828-1.c	(revision 0)
@@ -0,0 +1,22 @@
+short *f(short *a, int b, int *d) __attribute__((noinline,noclone));
+
+short *f(short *a, int b, int *d)
+{
+  short c = *a;
+  a++;
+  c = b << c;
+  *d = c;
+  return a;
+}
+
+int main(void)
+{
+  int d;
+  short a[2];
+  a[0] = 0;
+  if (f(a, 1, &d) != &a[1])
+    __builtin_abort ();
+  if (d != 1)
+    __builtin_abort ();
+  return 0;
+}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic