public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7058] Add optmization testcase for incorrect optimization in Ada
@ 2022-02-04 16:45 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2022-02-04 16:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1f722e35ab3805de6eeace770508a9085944e93e

commit r12-7058-g1f722e35ab3805de6eeace770508a9085944e93e
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Feb 4 17:41:55 2022 +0100

    Add optmization testcase for incorrect optimization in Ada
    
    gcc/testsuite/
            PR tree-optimization/104356
            * gnat.dg/opt97.adb: New test.

Diff:
---
 gcc/testsuite/gnat.dg/opt97.adb | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gcc/testsuite/gnat.dg/opt97.adb b/gcc/testsuite/gnat.dg/opt97.adb
new file mode 100644
index 00000000000..1bf6a750d75
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt97.adb
@@ -0,0 +1,25 @@
+-- { dg-do compile }
+-- { dg-options "-O2 -fdump-tree-optimized" }
+
+with System.Unsigned_Types; use System.Unsigned_Types;
+
+function Opt97 (X, Y : Unsigned) return Unsigned is
+
+  pragma Suppress (All_Checks);
+
+  Z : Unsigned;
+
+begin
+  if X >= 2 then
+    return 0;
+  end if;
+
+  Z := Y;
+  if X = 1 then
+    Z := Y + 4;
+  end if;
+
+  return Z / X;
+end;
+
+-- { dg-final { scan-tree-dump "/" "optimized" } }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-04 16:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04 16:45 [gcc r12-7058] Add optmization testcase for incorrect optimization in Ada Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).