comp.lang.ada
 help / color / mirror / Atom feed
* Re: language problem
@ 1987-04-01 23:58 ms8k#
  1987-04-03  0:52 ` deller
  0 siblings, 1 reply; 12+ messages in thread
From: ms8k# @ 1987-04-01 23:58 UTC (permalink / raw)
  To: outnews#ext.nn.comp.lang.ada



In article <8703261730.AA28726@taurus> amiram@TAURUS.BITNET.UUCP writes:
>A colleague of mine, Yossi Veler of AITECH has come up with the following
>program in Ada, which seems to create a serious problem.
>
>procedure boolsub is
>   subtype bool is boolean range true..true;
>   type arr is array(1..10) of bool;
>   a : arr := (1..10 => true); -- this seems like the only legal value
>begin
>   a := not a;
>-- Here a(1)=a(2)=...=a(10)= FALSE !!!! No exception occurs etc.
>   a := (1..10 => false);
>-- This does cause an exception
>end boolsub;
>
>The program seems legal : we inspected the LRM and also the implementers
>guide, and we ran it on both the DDC and VERDIX compilers. It seems that
>a combination of innocent features in Ada produces a result that seems to
>contradict with the basic philosophy of the language, that is an object
>posseses a value which is not in the appropriate type.

Verdix Ada v1.5 is completely bogus. Don't be amazed by problems like this.
Another example is

    type BYTE is range 0 .. 255;
    for BYTE'SIZE use 8;

Verdix compiler says that the size is too small.

    type BYTE is new POSITIVE range 0 .. 255;
    for BYTE'SIZE use 8;

same thing! 0 as a POSITIVE does not disturb it. The bit sign is still there.

    type BYTE is range -128 .. 127
    for BYTE'SIZE use 8;

is ok (at last), but is not really what was wanted. Another solution may be
an enumaration of 256 items, a little painful. 

____________________________________________________________
Marc A. Scheurer

Arpanet, Bitnet: ms8k@andrew.cmu.edu
UUCP           : seismo!andrew.cmu.edu!ms8k
____________________________________________________________



 

^ permalink raw reply	[flat|nested] 12+ messages in thread
* language problem
@ 1987-04-08 18:08 drw
  0 siblings, 0 replies; 12+ messages in thread
From: drw @ 1987-04-08 18:08 UTC (permalink / raw)


keith@telesoft.UUCP (Keith Shillington @prodigal) writes:
> Dale Worley at Cullinet Software writes:
> > Is the following program required to raise CONSTRAINT_ERROR (or whatever)?
> > 
> > procedure y is
> >   subtype x is range 0..100;
> >   a : x := 100;
> > begin
> >   a := a + 1;
> > end y;
> > 
> [keith replaces "subtype" with "type" so the code will compile.]
> 
> So, making that suggested modification results in correct compilation
> with the runtime result:
> 
> >>> Unhandled exception: CONSTRAINT_ERROR  (Range Check)
>     Raised in   Y.Y at line 5
> 
> So, yes, absolutely, constraint_error should be raised. [...]

But I am neither asking whether you thing that it should be raised,
nor whether your favorite implementation raises it, I am asking
whether the LRM *requires* that it be raised, or is an implementation
allowed to not raise it?

Sheesh!  Don't people understand what *standards* are?

Dale
-- 
Dale Worley		Cullinet Software
UUCP: ...!seismo!harvard!mit-eddie!cullvax!drw
ARPA: cullvax!drw@eddie.mit.edu
Un*x (a generic name for a class of OS's) != Unix (AT&T's brand of such)

^ permalink raw reply	[flat|nested] 12+ messages in thread
* language problem
@ 1987-04-07  5:53 drw
  1987-04-08  1:11 ` keith
  0 siblings, 1 reply; 12+ messages in thread
From: drw @ 1987-04-07  5:53 UTC (permalink / raw)


Is the following program required to raise CONSTRAINT_ERROR (or whatever)?

procedure y is
  subtype x is range 0..100;
  a : x := 100;
begin
  a := a + 1;
end y;

This has a major bearing on the "boolean range true..true" program.

Dale
-- 
Dale Worley		Cullinet Software
UUCP: ...!seismo!harvard!mit-eddie!cullvax!drw
ARPA: cullvax!drw@eddie.mit.edu
Un*x (a generic name for a class of OS's) != Unix (AT&T's brand of such)

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: language problem
@ 1987-04-03 10:35 ms8k#
  0 siblings, 0 replies; 12+ messages in thread
From: ms8k# @ 1987-04-03 10:35 UTC (permalink / raw)
  To: info-Ada, outnews#ext.nn.comp.lang.ada


vrdxhq!deller@seismo.css.gov  (Steven Deller) writes:

> Verdix has never had a v1.5 compiler...

Right. I was thinking of

     Verdix Ada Compiler, Copyright 1984
     Version 4.06 - ACVC 1.5

on VAX/Ultrix. 

> ... Why a site might choose not to purchase maintenance is their business,
but 
> that decision should not then be a reason to spuriously castigate Verdix in

> such a wide forum as Usenet.

Right again. I apologize for the inaccuracy. 
____________________________________________________________
Marc A. Scheurer

Arpanet, Bitnet: ms8k@andrew.cmu.edu
UUCP           : seismo!andrew.cmu.edu!ms8k
____________________________________________________________



                                              

^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <12291366595.33.BRYAN@Sierra.Stanford.EDU>]
* language problem
@ 1987-03-26 17:30 amiram
  1987-04-01 15:05 ` joe
  0 siblings, 1 reply; 12+ messages in thread
From: amiram @ 1987-03-26 17:30 UTC (permalink / raw)


A colleague of mine, Yossi Veler of AITECH has come up with the following
program in Ada, which seems to create a serious problem.

procedure boolsub is
   subtype bool is boolean range true..true;
   type arr is array(1..10) of bool;
   a : arr := (1..10 => true); -- this seems like the only legal value
begin
   a := not a;
-- Here a(1)=a(2)=...=a(10)= FALSE !!!! No exception occurs etc.
   a := (1..10 => false);
-- This does cause an exception
end boolsub;

The program seems legal : we inspected the LRM and also the implementers
guide, and we ran it on both the DDC and VERDIX compilers. It seems that
a combination of innocent features in Ada produces a result that seems to
contradict with the basic philosophy of the language, that is an object
posseses a value which is not in the appropriate type.

It seems that several features interact to produce this undesirable situation:
1) Boolean is an enumerated type, and one can take a subtype of it.
2) Boolean array operations, which are the only ones operating on all elements
of an array.
3) At run time, array assignements are not checked element by element ( I
believe in all but this case this check is indeed not required ).

Has anyone noticed this before? Is there a way out of it?

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1987-04-08 18:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1987-04-01 23:58 language problem ms8k#
1987-04-03  0:52 ` deller
  -- strict thread matches above, loose matches on Subject: below --
1987-04-08 18:08 drw
1987-04-07  5:53 drw
1987-04-08  1:11 ` keith
1987-04-03 10:35 ms8k#
     [not found] <12291366595.33.BRYAN@Sierra.Stanford.EDU>
1987-04-02 20:22 ` ROSENBLUM
1987-04-03 14:49   ` dday
1987-04-06 13:26     ` eric
1987-03-26 17:30 amiram
1987-04-01 15:05 ` joe
1987-04-01 20:12   ` cjh

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