[gcc r12-7383] Add testcase from PR103845

Alexandre Oliva aoliva@gcc.gnu.org
Fri Feb 25 01:20:00 GMT 2022


https://gcc.gnu.org/g:33c7df5854ecb31e2d645ab672ad3987b591ebfd

commit r12-7383-g33c7df5854ecb31e2d645ab672ad3987b591ebfd
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Feb 24 22:03:38 2022 -0300

    Add testcase from PR103845
    
    This problem was already fixed as part of PR104263: the abnormal edge
    that remained from before inlining didn't make sense after inlining.
    So this patch adds only the testcase.
    
    
    for  gcc/testsuite/ChangeLog
    
            PR tree-optimization/103845
            PR tree-optimization/104263
            * gcc.dg/pr103845.c: New.

Diff:
---
 gcc/testsuite/gcc.dg/pr103845.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/pr103845.c b/gcc/testsuite/gcc.dg/pr103845.c
new file mode 100644
index 00000000000..45ab518d07c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr103845.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fharden-compares -fno-ipa-pure-const" } */
+
+int
+baz (void);
+
+__attribute__ ((returns_twice)) void
+bar (void)
+{
+}
+
+int
+quux (int y, int z)
+{
+  return (y || z >= 0) ? y : z;
+}
+
+int
+foo (int x)
+{
+  int a = 0, b = x == a;
+
+  bar ();
+
+  if (!!baz () < quux (b, a))
+    ++x;
+
+  return x;
+}


More information about the Gcc-cvs mailing list