On Mon, Dec 12, 2016 at 4:35 PM, Jakub Jelinek <[email protected]> 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 <[email protected]>
>> >
>> > 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
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;
+}