aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/specs
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2017-09-05 09:12:07 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-09-05 09:12:07 +0000
commit1f073c9270d23a01f59b6871f127d99d54bd6670 (patch)
tree4da34380a93f050079a4205f3a11b72d696fe88a /gcc/testsuite/gnat.dg/specs
parent7ed9919dff52443091071203bf93685cf78002a3 (diff)
downloadgcc-1f073c9270d23a01f59b6871f127d99d54bd6670.zip
gcc-1f073c9270d23a01f59b6871f127d99d54bd6670.tar.gz
gcc-1f073c9270d23a01f59b6871f127d99d54bd6670.tar.bz2
utils.c (unchecked_convert): When the result type is a non-biased integral type with size 0...
* gcc-interface/utils.c (unchecked_convert): When the result type is a non-biased integral type with size 0, set the result to 0 directly. From-SVN: r251701
Diffstat (limited to 'gcc/testsuite/gnat.dg/specs')
-rw-r--r--gcc/testsuite/gnat.dg/specs/uc2.ads18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/specs/uc2.ads b/gcc/testsuite/gnat.dg/specs/uc2.ads
new file mode 100644
index 0000000..84d4e04
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/uc2.ads
@@ -0,0 +1,18 @@
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+with Ada.Unchecked_Conversion;
+
+package UC2 is
+
+ subtype Word_Type is Integer range 0 .. 0;
+ type Arr is array (1 .. Word_Type'Size) of Boolean;
+ pragma Pack(Arr);
+
+ function Conv is
+ new Ada.Unchecked_Conversion (Source => Arr, Target => Word_Type);
+
+ A : Arr;
+ W : Word_Type := Conv(A);
+
+end UC2;