aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/a-except.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2019-08-19 08:37:09 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-19 08:37:09 +0000
commit382b0e9771d77d482f6765454ec884936b62b15b (patch)
tree93eccc1c8fb26b09314c52d73d3b9b33a56dea82 /gcc/ada/libgnat/a-except.adb
parent27ebda1930cef2ac484abcca124a4d6230feee08 (diff)
downloadgcc-382b0e9771d77d482f6765454ec884936b62b15b.zip
gcc-382b0e9771d77d482f6765454ec884936b62b15b.tar.gz
gcc-382b0e9771d77d482f6765454ec884936b62b15b.tar.bz2
[Ada] Incorrect code for -gnateV switch
This patch corrects the code generated by the -gnateV switch in the case of a private type whose full type is a modular type, removing spurious run-time failures. In addition, this corrects the initialization of exception occurrences in exception handlers to avoid leaving data uninitialized, which caused -gnateV to raise spurious errors. 2019-08-19 Bob Duff <duff@adacore.com> gcc/ada/ * exp_attr.adb (Attribute_Valid): Correct the handling of private types where the full type is modular. System.Address is an example. Otherwise, we convert uncheckedly to a signed type, so we get an incorrect range 0 .. -1, for which all values will fail. The 'Valid attribute is illegal for such types, but we generate such illegal attribute_references for 'Valid_Scalars, and we generate 'Valid_Scalars when the -gnateV switch is used. Rename Btyp --> PBtyp to avoid hiding the outer Btyp, which was confusing. * libgnat/a-except.adb: Set the Exception_Raised component. Otherwise, we have incorrect reads of invalid data. gcc/testsuite/ * gnat.dg/valid_scalars2.adb: New testcase. From-SVN: r274660
Diffstat (limited to 'gcc/ada/libgnat/a-except.adb')
-rw-r--r--gcc/ada/libgnat/a-except.adb1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/ada/libgnat/a-except.adb b/gcc/ada/libgnat/a-except.adb
index ebb76a7..8b0a31c 100644
--- a/gcc/ada/libgnat/a-except.adb
+++ b/gcc/ada/libgnat/a-except.adb
@@ -1624,6 +1624,7 @@ package body Ada.Exceptions is
Target.Machine_Occurrence := System.Null_Address;
Target.Msg_Length := Source.Msg_Length;
Target.Num_Tracebacks := Source.Num_Tracebacks;
+ Target.Exception_Raised := Source.Exception_Raised;
Target.Pid := Source.Pid;
Target.Msg (1 .. Target.Msg_Length) :=