public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH TEST]Add test for PR78652
@ 2016-12-09 10:21 Bin Cheng
  2016-12-12 16:32 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Bin Cheng @ 2016-12-09 10:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

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.

[-- Attachment #2: pr78652.txt --]
[-- Type: text/plain, Size: 1468 bytes --]

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;
+}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH TEST]Add test for PR78652
  2016-12-09 10:21 [PATCH TEST]Add test for PR78652 Bin Cheng
@ 2016-12-12 16:32 ` Jeff Law
  2016-12-12 16:35   ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2016-12-12 16:32 UTC (permalink / raw)
  To: Bin Cheng, gcc-patches; +Cc: nd

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH TEST]Add test for PR78652
  2016-12-12 16:32 ` Jeff Law
@ 2016-12-12 16:35   ` Jakub Jelinek
  2017-01-13 15:48     ` Bin.Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2016-12-12 16:35 UTC (permalink / raw)
  To: Jeff Law; +Cc: Bin Cheng, gcc-patches, nd

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH TEST]Add test for PR78652
  2016-12-12 16:35   ` Jakub Jelinek
@ 2017-01-13 15:48     ` Bin.Cheng
  0 siblings, 0 replies; 4+ messages in thread
From: Bin.Cheng @ 2017-01-13 15:48 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jeff Law, Bin Cheng, gcc-patches, nd

[-- Attachment #1: Type: text/plain, Size: 955 bytes --]

On Mon, Dec 12, 2016 at 4:35 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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.
Hi,
Thank you both for reviewing, the attribute is irrelevant to test, so
this version has it removed.

Thanks,
bin
>
>         Jakub

[-- Attachment #2: pr78652.txt --]
[-- Type: text/plain, Size: 1433 bytes --]

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..0b9ba87
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr78652.c
@@ -0,0 +1,76 @@
+/* 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 ();
+}
+
+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;
+}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-13 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-09 10:21 [PATCH TEST]Add test for PR78652 Bin Cheng
2016-12-12 16:32 ` Jeff Law
2016-12-12 16:35   ` Jakub Jelinek
2017-01-13 15:48     ` Bin.Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).