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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,55f243f32a97dc7e X-Google-Attributes: gid103376,public From: kst@king.cts.com (Keith Thompson) Subject: Re: Elaboration_check For Instantiations Date: 1997/10/28 Message-ID: <878068940.763599@wagasa.cts.com>#1/1 X-Deja-AN: 286282168 Cache-Post-Path: wagasa.cts.com!kst@king.cts.com References: <1997Oct23.205254.25272@nosc.mil> <1997Oct27.223135.2373@nosc.mil> <1997Oct28.192057.29122@nosc.mil> Organization: CTS Network Services Newsgroups: comp.lang.ada Date: 1997-10-28T00:00:00+00:00 List-Id: Charles H. Sampson (csampson@cod.nosc.mil) wrote: [...] > You are right, the GNAT implementation is entirely correct. I > must have mislead you when I said "technically correct". Technically > correct is correct, no doubt about it. All I meant was that GNAT is not > following the programmer's wishes. If Suppress(Elaboration_check) is > written, then the programmer doesn't want the check made; if the check > is not made then Program_error can't be raised. The programmer's wisdom > in making such a request is another discussion. > > Charlie As is the programmer's wisdom in assuming that pragma Suppress means the check won't be made. The intent of pragma Suppress is to improve the efficiency of generated code by inhibiting checks that the programmer knows will not fail. Suppressing a check that would fail if it were not suppressed, as in the following: X : Some_Integer_Subtype := Some_Integer_Subtype'Last; declare pragma Suppress(Range_Check); begin X := X + 1; end; is a misuse of the pragma, and results in erroneous execution (and arbitrarily nasty results). For example, the compiler is entitled to assume that X is in the range of its subtype after the assignment, and to perform optimizations based on that assumption. The more clever the compiler, and the more aggressively it optimizes, the more likely it is to mess things up. References: RM95-11.5(26): If a given check has been suppressed, and the corresponding error situation occurs, the execution of the program is erroneous. RM95-11.5(29) (a note): There is no guarantee that a suppressed check is actually removed; hence a pragma Suppress should be used only for efficience reasons. -- Keith Thompson (The_Other_Keith) kst@cts.com <*> ^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H San Diego, California, USA "Simba, you have forgotten me. I am your father. This is CNN." -- JEJ