diff mbox

[TEST] Add test for PR78652

Message ID VI1PR0802MB217647BE26854962AEF2F9FFE7870@VI1PR0802MB2176.eurprd08.prod.outlook.com
State New
Headers show

Commit Message

Bin Cheng Dec. 9, 2016, 10:20 a.m. UTC
Hi,
PR78652 was fixed by patch for PR77856, this patch adds a test for it.  Test result checked, is it OK?

Thanks,
bin

gcc/testsuite/ChangeLog
2016-12-07  Bin Cheng  <bin.cheng@arm.com>

	PR rtl-optimization/78652
	* gcc.c-torture/execute/pr78652.c: New test.

Comments

Jeff Law Dec. 12, 2016, 4:32 p.m. UTC | #1
On 12/09/2016 03:20 AM, Bin Cheng wrote:
> Hi,
> PR78652 was fixed by patch for PR77856, this patch adds a test for it.  Test result checked, is it OK?
>
> Thanks,
> bin
>
> gcc/testsuite/ChangeLog
> 2016-12-07  Bin Cheng  <bin.cheng@arm.com>
>
> 	PR rtl-optimization/78652
> 	* gcc.c-torture/execute/pr78652.c: New test.
>
You need to restrict it to targets with named section support -- or -- 
remove the attribute section from main.

/* { dg-require-effective-target named_sections } */

Jeff
Jakub Jelinek Dec. 12, 2016, 4:35 p.m. UTC | #2
On Mon, Dec 12, 2016 at 09:32:30AM -0700, Jeff Law wrote:
> On 12/09/2016 03:20 AM, Bin Cheng wrote:
> >Hi,
> >PR78652 was fixed by patch for PR77856, this patch adds a test for it.  Test result checked, is it OK?
> >
> >Thanks,
> >bin
> >
> >gcc/testsuite/ChangeLog
> >2016-12-07  Bin Cheng  <bin.cheng@arm.com>
> >
> >	PR rtl-optimization/78652
> >	* gcc.c-torture/execute/pr78652.c: New test.
> >
> You need to restrict it to targets with named section support -- or --
> remove the attribute section from main.
> 
> /* { dg-require-effective-target named_sections } */

If the testcase fails before r243038 without the attribute and succeeds
with it, I'd strongly prefer the latter option - remove the attribute.

	Jakub
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.c-torture/execute/pr78652.c b/gcc/testsuite/gcc.c-torture/execute/pr78652.c
new file mode 100644
index 0000000..277f108
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr78652.c
@@ -0,0 +1,77 @@ 
+/* PR rtl-optimization/78652 */
+/* { dg-options "-fno-strict-aliasing" } */
+
+short a, b = 1, p, t;
+struct {
+  signed f1 : 9;
+} m = {3};
+
+int c, g = 0, h = 8, i, k, l, q, r, s, w, x = 9;
+long long d = 1;
+long long e = 1;
+char f[9][6][4] = {{{1}}};
+short j[6] = {1};
+
+unsigned n;
+static long long *o = &e;
+char u;
+short *v;
+char *y = &f[6][4][3];
+short fn1 (short p1) { return a == 0 ? p1 : p1 % a; }
+
+static int *fn2 (signed char p1, int p2, signed char p3) {
+lbl_2057:
+  if (n >= (q >= fn1 (3)))
+    return &r;
+  if (p2)
+    t = u;
+  *v = (t | *o) * p2;
+  for (;;) {
+    for (; u <= 1;)
+      goto lbl_2057;
+    if (p1)
+      s = g = 0;
+  }
+}
+
+void fn3 (int *p1) {
+  if (*p1)
+    ;
+  else {
+    x = w;
+    for (;;)
+      ;
+  }
+}
+
+int *fn4 (long p1) {
+  for (; p1; p1--)
+    e = 1;
+  y = 0;
+  return &h;
+}
+
+__attribute__((noinline))
+void bar (int a)
+{
+  if (a != 3)
+    __builtin_abort ();
+}
+
+__attribute__((section(".text")))
+int main () {
+  int *z;
+  long t1;
+  long long *t2 = &d;
+  *t2 = b;
+  z = fn4 (*t2);
+  fn3 (z);
+  short *t3 = &j[0];
+  *t3 = f[6][4][3] >= (b = i);
+  t1 = p < n;
+  fn2 (c < t1 >= m.f1, l, k);
+  j[5]++;
+  bar (m.f1);
+
+  return 0;
+}