20081112-1.c: New test.
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 12 Nov 2008 21:48:59 +0000 (21:48 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 12 Nov 2008 21:48:59 +0000 (21:48 +0000)
* gcc.c-torture/execute/20081112-1.c: New test.
* gnat.dg/concat1.adb: Likewise.
* gnat.dg/concat1_pkg.ad[sb]: New helper.

From-SVN: r141806

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20081112-1.c [new file with mode: 0644]
gcc/testsuite/gnat.dg/concat1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/concat1_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/concat1_pkg.ads [new file with mode: 0644]

index a14100fe312b9b60849d5ad33c5108a13443a85c..783b08fbc5183bfee5c35282bf859172d104df4b 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-12  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc.c-torture/execute/20081112-1.c: New test.
+       * gnat.dg/concat1.adb: Likewise.
+       * gnat.dg/concat1_pkg.ad[sb]: New helper.
+
 2008-11-12  Jason Merrill  <jason@redhat.com>
 
        PR c++/38007
diff --git a/gcc/testsuite/gcc.c-torture/execute/20081112-1.c b/gcc/testsuite/gcc.c-torture/execute/20081112-1.c
new file mode 100644 (file)
index 0000000..1efe016
--- /dev/null
@@ -0,0 +1,17 @@
+#include <limits.h>
+
+extern void abort (void);
+
+static __attribute__((noinline)) void foo (int a)
+{
+  int b = (a - 1) + INT_MIN;
+
+  if (b != INT_MIN)
+    abort ();
+}
+
+int main (void)
+{
+  foo (1);
+  return 0;
+}
diff --git a/gcc/testsuite/gnat.dg/concat1.adb b/gcc/testsuite/gnat.dg/concat1.adb
new file mode 100644 (file)
index 0000000..16b8543
--- /dev/null
@@ -0,0 +1,21 @@
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with Concat1_Pkg; use Concat1_Pkg;
+
+procedure Concat1 is
+
+  Ident_1 : Integer := Ident (1);
+  Ident_2 : Integer := Ident (2);
+  Ident_5 : Integer := Ident (5);
+
+  type Arr is array (Integer range <>) of Integer;
+  A : Arr (1..10);
+
+begin
+  A := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+  A := 0 & A(Ident_1..Ident_2) & A(Ident_1..Ident_2) & A(Ident_1..Ident_5);
+  if A /= (0, 1, 2, 1, 2, 1, 2, 3, 4, 5) then
+    raise Program_Error;
+  end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/concat1_pkg.adb b/gcc/testsuite/gnat.dg/concat1_pkg.adb
new file mode 100644 (file)
index 0000000..4e50e61
--- /dev/null
@@ -0,0 +1,5 @@
+package body Concat1_Pkg is
+
+  function Ident (I : Integer) return Integer is begin return I; end;
+
+end Concat1_Pkg;
diff --git a/gcc/testsuite/gnat.dg/concat1_pkg.ads b/gcc/testsuite/gnat.dg/concat1_pkg.ads
new file mode 100644 (file)
index 0000000..8690ba2
--- /dev/null
@@ -0,0 +1,5 @@
+package Concat1_Pkg is
+
+  function Ident (I : Integer) return Integer;
+
+end Concat1_Pkg;