comp.lang.ada
 help / color / mirror / Atom feed
From: cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland. reston.ans.net!usc!cs.utexas.edu!not-for-mail@ucbvax.Berkeley.EDU  (Franco Mazz
Subject: Re: Bug in AdaEd???
Date: 22 Sep 93 14:10:13 GMT	[thread overview]
Message-ID: <9309221412.AA02787@ieipisa.iei.pi.cnr.it> (raw)

>From: eachus@spectre.mitre.org (Robert I. Eachus)
>Subject: Re: Bug in AdaEd???
>
>Let me drag the logic out into plain (ugly) sight.
> 
      ...
>   2) Therefore an optimizing compiler can eliminate any assignments
>      to A.
>
>   3) If the compiler eliminates the assignment, it can also (see
>      11.6) eliminate the check.
>

I do not see anything in the Ada83 Reference Manual or ARG resolutions allowing
 
this.

>   When Ada 83 was being defined, the principle reason for the
>constraint checks on assignments was to prevent objects from having
>invalid values.  In the tradeoffs between speed and correctness, the
>compromise was that initial values need not be checked (the raw bits
>in memory allocated to the object, not the initial value expression)
>for objects other than access types, but all subsequent assignments
>would be.  The case of assignments which were eliminated by
>optimization was discussed, and 11.6(7) was the result.  If you don't
>do the assignment, you don't need to do the check.

Paragraph 11.6(7) deals with predefined operators, but the assignment, or
the check to be performed before an assignment are not predefined operators
but "basic" operations (see Ref. Man 3.3.1).

I am not surprised if some compilers, at some optimization levels do something
illegal.  Again, I cannot see in the Reference Manual anything allowing this 
interpretation.  A confirmation of this also comes from the discussion of 
AI-00535/03 where it is clearly explained that:

" No problem arises when operating on scalar values:
 
          declare
              type NB is new BOOLEAN range TRUE .. TRUE;
              A, B : NB := TRUE;
          begin
              if (not A) or (A xor B) then     -- no exception is raised
                  A := not A;                  -- CONSTRAINT_ERROR
              end if;
          end;
 
  No  exception  is raised for NOT A or A XOR B since the NOT and XOR operators
  for type NB are the predefined operators, which return  values  of  the  base
  type. "

By the way, for a more precise picture it is possible to retrieve AI-00535/03
from host ajpo.sei.cmu.edu, directory public/ada-comment, file ai-00535-bi.wa.

- - - - - - - - - - - - - - - - - - - - - - - - - -
   Dr. Franco Mazzanti
   Istituto di Elaborazione della Informazione
   Via S.Maria 46, 56126 Pisa, ITALY
   Tel: 050-593447/593400, Fax: 050-554342
   e-mail: mazzanti@iei.pi.cnr.it
- - - - - - - - - - - - - - - - - - - - - - - - - -

             reply	other threads:[~1993-09-22 14:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-22 14:10 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland.reston.ans.net!usc!cs.utexas.edu!not-for-mail [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-23 20:55 Bug in AdaEd??? Tucker Taft
1993-09-23 18:46 Tucker Taft
1993-09-22 22:28 Robert I. Eachus
1993-09-22 21:07 Robert I. Eachus
1993-09-22 14:22 Norm an H. Cohen
1993-09-22 13:36 cis.ohio-state.edu!news.sei.cmu.edu!firth
1993-09-22 11:45 Wes Groleau x1240 C73-8
1993-09-22  0:21 Robert I. Eachus
1993-09-21  4:19 Gene Ouye
1993-09-07  3:20 Robert Dewar
1993-09-06 14:06 Gene Ouye
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox