summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-06 10:03:52 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-06 10:03:52 +0000
commitd82c64fc050cca5f4b7bceaa0864d1cd4a016ffe (patch)
tree97a9ada459ad65b7e914b4170d2d2ca7ee3d4e12 /gcc
parent23459b95cbc0efc2c4f71d1775c8da56429ffd25 (diff)
downloadppe42-gcc-d82c64fc050cca5f4b7bceaa0864d1cd4a016ffe.tar.gz
ppe42-gcc-d82c64fc050cca5f4b7bceaa0864d1cd4a016ffe.zip
2008-08-06 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: Clarify -gnato documentation git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138791 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/gnat_ugn.texi17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index b86ed98a4ee..3c5d287acef 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -6258,11 +6258,11 @@ the true value of the result of an operation may be outside the base
range of the result type. The following example shows the distinction:
@smallexample @c ada
-X1 : Integer := Integer'Last;
-X2 : Integer range 1 .. 5 := 5;
-X3 : Integer := Integer'Last;
-X4 : Integer range 1 .. 5 := 5;
-F : Float := 2.0E+20;
+X1 : Integer := "Integer'Last";
+X2 : Integer range 1 .. 5 := "5";
+X3 : Integer := "Integer'Last";
+X4 : Integer range 1 .. 5 := "5";
+F : Float := "2.0E+20";
@dots{}
X1 := X1 + 1;
X2 := X2 + 1;
@@ -6271,6 +6271,13 @@ X4 := Integer (F);
@end smallexample
@noindent
+Note that if explicit values are assigned at compile time, the compiler may
+be able to detect overflow at compile time, in which case no run-time check
+is required, and the setting of -gnato is irrelevant. That's why the assigned
+values in the above fragment are in quotes, the meaning is "assign a value
+not known to the compiler that happens to be equal to ...". The remaining
+discussion assumes that the compiler cannot detect the values at compile time.
+
Here the first addition results in a value that is outside the base range
of Integer, and hence requires an overflow check for detection of the
constraint error. Thus the first assignment to @code{X1} raises a
OpenPOWER on IntegriCloud