From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3b322104ceea062d,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.190.247.MISMATCH!news-out.readnews.com!news-xxxfer.readnews.com!not-for-mail Newsgroups: comp.lang.ada Subject: What does -gnato do? From: "Peter C. Chapin" Organization: Kelsey Mountain Software Message-ID: User-Agent: Xnews/5.04.25 Date: 26 Aug 2006 22:52:09 GMT NNTP-Posting-Host: c09f44d6.news.sover.net X-Trace: DXC=Y8=31BTk1bO<G0KMK6_LM2JZB_CAa9;]i>XbNO3?@`i3kGa5K``CNgIl3nBGXaDCeS4:R@D X-Complaints-To: abuse@sover.net Xref: g2news2.google.com comp.lang.ada:6403 Date: 2006-08-26T22:52:09+00:00 List-Id: I'm using GNAT GPL 2006. In the User's Guide there is a description of the -gnato option. This description includes the following example: ---> begin quote <--- X1 : Integer := Integer'Last; X2 : Integer range 1 .. 5 := 5; ... X1 := X1 + 1; X2 := X2 + 1; 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 X1 raises a Constraint_Error exception only if `-gnato' is set. ---> end quote <--- Now consider the following program: ---> begin program <--- with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Check is X : Integer := Integer'Last; begin X := X + 1; Put(X); end Check; ---> end program <--- When I build this program *without* the -gnato option I get the following warning: C:\home\Languages\Ada>gnatmake check.adb gcc -c check.adb check.adb:6:11: warning: value not in range of type "Standard.Integer" check.adb:6:11: warning: "Constraint_Error" will be raised at run time gnatbind -x check.ali gnatlink check.ali And when I run the result I get C:\home\Languages\Ada>check raised CONSTRAINT_ERROR : check.adb:6 overflow check failed So it seems that overflow checking is enabled even without -gnato despite the fact that this contradicts the documentation. I conclude that the default has changed and the documentation is out of date. Is that true or am I misunderstanding something? Note that when I include the -gnato option in the compilation of my sample program the effect is the same. The -gnato option doesn't change anything in this case. Peter