[PR,target/85401,v2] Add test-cases
diff mbox series

Message ID 20191009194315.GA4882@SDF.ORG
State New
Headers show
Series
  • [PR,target/85401,v2] Add test-cases
Related show

Commit Message

Maya Rashish Oct. 9, 2019, 7:43 p.m. UTC
On Fri, Oct 04, 2019 at 02:28:55PM -0600, Jeff Law wrote:
> On 10/4/19 1:43 PM, coypu@sdf.org wrote:
> > On Tue, Oct 01, 2019 at 01:26:16PM -0600, Jeff Law wrote:
> >> On 9/30/19 2:45 PM, coypu@sdf.org wrote:
> >>> On Mon, Sep 30, 2019 at 11:46:24AM -0400, Vladimir Makarov wrote:
> >>>> Yes, the patch is mostly ok.  You can commit it into the trunk after
> >>>> applying changes mentioned below. If you do not have a write access, let me
> >>>> know I'll commit the patch by myself.
> >>>
> >>> I don't have commit access. It would be nice if you committed it :)
> >> I took care of the nits and committed the patch.
> >>
> >>
> >>>
> >>>> It would be nice to add a small test too.  But it is not obligatory for this
> >>>> case as the patch is obvious and it might be hard to create a small test to
> >>>> reproduce the bug.
> >>>
> >>> I have the C code that produces this failure. I can creduce it, but I'm
> >>> not sure there's a relationship between it and the bug.
> >>> Doing unrelated changes (adding instruction scheduling) to vax also hid it.
> >>>
> >>> Is this kind of test still valuable?
> >> Often they are.
> >>
> >> jeff
> > 
> > Here's the two tests I used. It might be too machine-made.
> > One is in the vax specific directory since it needed -fno-pic.
> > 
> > 
> > 2019-10-04  Maya Rashish  <coypu@sdf.org>
> > 	* gcc.c-torture/compile/pr85401-2.c: New test.
> > 	* gcc.target/vax/pr85401-1.c: New test.
> ISTM that both should be in c-torture.  We can use dg-* things in there too.
> 
> jeff

Sorry. I didn't realize while sending that they both produce the same
crash.

I was trying to produce test cases that don't produce warnings, and
didn't notice the change. The original second test case has an
unintialized variable use, so I am omitting it.


2019-10-09  Maya Rashish  <coypu@sdf.org>
	* gcc.c-torture/compile/pr85401: New test.

Comments

Maciej W. Rozycki Oct. 10, 2019, 8:41 a.m. UTC | #1
On Wed, 9 Oct 2019, coypu@sdf.org wrote:

> diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c b/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c
> new file mode 100644
> index 0000000..1d68d0b
> --- /dev/null
> +++ b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
> @@ -0,0 +1,18 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2" } */
> +
> +int h(void);
> +int i(int);
> +
> +struct a b;
> +struct a {
> +  unsigned c : 4;
> +} d() {
> +  int e, f = b.c << 2, g = h();
> +  for (; g;)
> +    ;
> +  if (e == 0)
> +    if (f)
> +      i(f);
> +  return b;
> +}

 Can you please run this (and the other test case) through `indent -gnu'?

  Maciej
Maya Rashish Oct. 10, 2019, 9:14 a.m. UTC | #2
On Thu, Oct 10, 2019 at 09:41:35AM +0100, Maciej W. Rozycki wrote:
> On Wed, 9 Oct 2019, coypu@sdf.org wrote:
> 
> > diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c b/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c
> > new file mode 100644
> > index 0000000..1d68d0b
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
> > @@ -0,0 +1,18 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-O2" } */
> > +
> > +int h(void);
> > +int i(int);
> > +
> > +struct a b;
> > +struct a {
> > +  unsigned c : 4;
> > +} d() {
> > +  int e, f = b.c << 2, g = h();
> > +  for (; g;)
> > +    ;
> > +  if (e == 0)
> > +    if (f)
> > +      i(f);
> > +  return b;
> > +}
> 
>  Can you please run this (and the other test case) through `indent -gnu'?
> 
>   Maciej

OK.

2019-10-09  Maya Rashish  <coypu@sdf.org>
	* gcc.c-torture/compile/pr85401: New test.

diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85401.c b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
new file mode 100644
index 00000000000..fa8fa19be59
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int h (void);
+int i (int);
+
+struct a b;
+struct a
+{
+  unsigned c:4;
+} d ()
+{
+  int e, f = b.c << 2, g = h ();
+  for (; g;)
+    ;
+  if (e == 0)
+    if (f)
+      i (f);
+  return b;
+}
Jeff Law Oct. 14, 2019, 9:14 p.m. UTC | #3
On 10/10/19 3:14 AM, coypu@sdf.org wrote:
> On Thu, Oct 10, 2019 at 09:41:35AM +0100, Maciej W. Rozycki wrote:
>> On Wed, 9 Oct 2019, coypu@sdf.org wrote:
>>
>>> diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c b/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c
>>> new file mode 100644
>>> index 0000000..1d68d0b
>>> --- /dev/null
>>> +++ b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
>>> @@ -0,0 +1,18 @@
>>> +/* { dg-do compile } */
>>> +/* { dg-options "-O2" } */
>>> +
>>> +int h(void);
>>> +int i(int);
>>> +
>>> +struct a b;
>>> +struct a {
>>> +  unsigned c : 4;
>>> +} d() {
>>> +  int e, f = b.c << 2, g = h();
>>> +  for (; g;)
>>> +    ;
>>> +  if (e == 0)
>>> +    if (f)
>>> +      i(f);
>>> +  return b;
>>> +}
>>  Can you please run this (and the other test case) through `indent -gnu'?
>>
>>   Maciej
> OK.
> 
> 2019-10-09  Maya Rashish  <coypu@sdf.org>
> 	* gcc.c-torture/compile/pr85401: New test.
Installed.  Note the formatting is still rather goofy, but that's
because "struct a" is defined within the context of the return type of d().

But rather than fix that up, I kept the test as-is.

jeff

Patch
diff mbox series

diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c b/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c
new file mode 100644
index 0000000..1d68d0b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
@@ -0,0 +1,18 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int h(void);
+int i(int);
+
+struct a b;
+struct a {
+  unsigned c : 4;
+} d() {
+  int e, f = b.c << 2, g = h();
+  for (; g;)
+    ;
+  if (e == 0)
+    if (f)
+      i(f);
+  return b;
+}