aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2008-08-06 12:03:52 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-08-06 12:03:52 +0200
commite3cb64d4063a6e51c0aaf0d33f3aa4cb388d2610 (patch)
tree97a9ada459ad65b7e914b4170d2d2ca7ee3d4e12 /gcc
parent3c829e3c37712de210300f03fe32c8fb8ff547ba (diff)
downloadgcc-e3cb64d4063a6e51c0aaf0d33f3aa4cb388d2610.zip
gcc-e3cb64d4063a6e51c0aaf0d33f3aa4cb388d2610.tar.gz
gcc-e3cb64d4063a6e51c0aaf0d33f3aa4cb388d2610.tar.bz2
gnat_ugn.texi: Clarify -gnato documentation
2008-08-06 Robert Dewar <dewar@adacore.com> * gnat_ugn.texi: Clarify -gnato documentation From-SVN: r138791
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 b86ed98..3c5d287 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