diff mbox series

Add testcase from PR103845

Message ID orczjduroz.fsf@lxoliva.fsfla.org
State New
Headers show
Series Add testcase from PR103845 | expand

Commit Message

Alexandre Oliva Feb. 23, 2022, 10:46 p.m. UTC
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.

Regstrapped on x86_64-linux-gnu.  Ok to install?


for  gcc/testsuite/ChangeLog

	PR tree-optimization/103845
	PR tree-optimization/104263
	* gcc.dg/pr103845.c: New.
---
 gcc/testsuite/gcc.dg/pr103845.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr103845.c

Comments

Richard Biener Feb. 24, 2022, 10:33 a.m. UTC | #1
On Wed, Feb 23, 2022 at 11:47 PM Alexandre Oliva via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
>
> 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.
>
> Regstrapped on x86_64-linux-gnu.  Ok to install?

OK.

>
> for  gcc/testsuite/ChangeLog
>
>         PR tree-optimization/103845
>         PR tree-optimization/104263
>         * gcc.dg/pr103845.c: New.
> ---
>  gcc/testsuite/gcc.dg/pr103845.c |   29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.dg/pr103845.c
>
> diff --git a/gcc/testsuite/gcc.dg/pr103845.c b/gcc/testsuite/gcc.dg/pr103845.c
> new file mode 100644
> index 0000000000000..45ab518d07c9a
> --- /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;
> +}
>
> --
> Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
>    Free Software Activist                       GNU Toolchain Engineer
> Disinformation flourishes because many people care deeply about injustice
> but very few check the facts.  Ask me about <https://stallmansupport.org>
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/pr103845.c b/gcc/testsuite/gcc.dg/pr103845.c
new file mode 100644
index 0000000000000..45ab518d07c9a
--- /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;
+}