diff mbox

PR tree-optimization/52904 testcase

Message ID 53E6151A.203@linaro.org
State New
Headers show

Commit Message

Kugan Vivekanandarajah Aug. 9, 2014, 12:33 p.m. UTC
Hi,

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904

Tescase was generating warning: assuming signed overflow does not occur
when simplifying conditional to constant [-Wstrict-overflow] due to VRP
missing the value range.

This seems to have been fixed and the PR is now closed. However, as
requested there in the PR, I am sending this patch to add the test-case
to test-suite.


Is this OK ?

Thanks,
Kugan

gcc/testsuite


2014-08-09  Kugan Vivekanandarajah  <kuganv@linaro.org>

	PR tree-optimization/52904
	* gcc.dg/PR52904.c: New test.

Comments

Richard Biener Aug. 11, 2014, 8:03 a.m. UTC | #1
On Sat, Aug 9, 2014 at 2:33 PM, Kugan <kugan.vivekanandarajah@linaro.org> wrote:
> Hi,
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904
>
> Tescase was generating warning: assuming signed overflow does not occur
> when simplifying conditional to constant [-Wstrict-overflow] due to VRP
> missing the value range.
>
> This seems to have been fixed and the PR is now closed. However, as
> requested there in the PR, I am sending this patch to add the test-case
> to test-suite.
>
>
> Is this OK ?

Did you verify the testcase fails before the revision that fixed it?
Esp. the placement of the dg-bogus looks bogus to me.

Also don't use -S in dg-options, use lower-case filenames and
avoid spurious vertical white-space.  The VRP dump scan is
also very unspecific - I suggest to drop it entirely.

Thanks,
Richard.

> Thanks,
> Kugan
>
> gcc/testsuite
>
>
> 2014-08-09  Kugan Vivekanandarajah  <kuganv@linaro.org>
>
>         PR tree-optimization/52904
>         * gcc.dg/PR52904.c: New test.
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/PR52904.c b/gcc/testsuite/gcc.dg/PR52904.c
index e69de29..e490d23 100644
--- a/gcc/testsuite/gcc.dg/PR52904.c
+++ b/gcc/testsuite/gcc.dg/PR52904.c
@@ -0,0 +1,26 @@ 
+
+/* { dg-do compile } */
+/* { dg-options "-S -Wstrict-overflow -O2 -fdump-tree-vrp2" } */
+
+extern int foo (int);
+
+
+int
+wait_reading_process_output (void)
+{
+  int nfds = 0;
+  int channel;
+  for (channel = 0; channel < 1024; ++channel)
+    {
+      if (foo (channel))
+	nfds++;
+    }
+  if (nfds < 0)
+    return 1;
+  return 0;
+}
+
+/* { dg-bogus "assuming signed overflow does not occur when simplifying\
+   conditional to constant" */
+/* { dg-final { scan-tree-dump "\\\[0, 1023\\\]" "vrp2" } } */
+/* { dg-final { cleanup-tree-dump "vrp2" } } */