comp.lang.ada
 help / color / mirror / Atom feed
From: seafac@WPAFB-JALCF.ARPA.UUCP
Subject: (none)
Date: Thu, 4-Jun-87 12:21:00 EDT	[thread overview]
Date: Thu Jun  4 12:21:00 1987
Message-ID: <8706041655.AA23291@ucbvax.Berkeley.EDU> (raw)

DEC Ada Problem Report
from:  Mr. Gary Sivak  (513) 255-3586
ASD/ENASF
wright-Patterson Air Force Base, Ohio 45433-6503
     There seems to be a problem with the way the VAX-hosted DEC-Ada
compiler V1.3-24 handles SHORT_INTEGER variables.
     Explanation.  In VAX Ada, the SHORT_INTEGER is defined as a 16-bit
two's complement number with the sign bit, in the left-most position,
set to 1 for negative values.  For example, for 3-bit arithmetic we have:
NUMERIC_VALUE	BIT_REPRESENTATION
-4		100
-3		101
-2		110
-1		111
0		000
1		001
2		010
3		011
     The valid range of two's complement 3-bit numbers is thus -4 through +3.
Similarly, the range of 16-bit two's complement numbers is -32,768 through
+32,767.
     Problem.  One can store the minimum value -32,768 into a
SHORT_INTEGER variable with a GET instantiated for SHORT_INTEGER, but
you cannot do it Via an assignment statement.  The exception
NUMERIC_ERROR is raised when you try. The minimal value an assignment
statement will accept is -32,767. 
     The following simple source code and test results demonstrate the problem:


with TEXT_IO; use TEXT_IO;
with SHORT_INTEGER_TEXT_IO; use SHORT_INTEGER_TEXT_IO;
procedure TEST_READ is
   INPUT_VALUE : SHORT_INTEGER;
begin --TEST_READ
   loop
      PUT("Enter INPUT_VALUE. ");
      GET(INPUT_VALUE);
      NEW_LINE;
      PUT(INPUT_VALUE);
      NEW_LINE;
   end loop;
end TEST_READ;
RUN TEST_READ
Enter INPUT_VALUE. 32767
 32767
Enter INPUT_VALUE. -32767

-32767
Enter INPUT_VALUE. -32768

-32768
Enter INPUT_VALUE. 
*INTERRUPT*

with TEXT_IO; use TEXT_IO;
with SHORT_INTEGER_TEXT_IO; use SHORT_INTEGER_TEXT_IO;

procedure TEST_ASSIGN is
   INPUT_VALUE : SHORT_INTEGER;
begin --TEST_ASSIGN
   INPUT_VALUE := -32768;
   NEW_LINE;
   PUT(INPUT_VALUE);
   NEW_LINE;
end TEST_ASSIGN;
$ RUN TEST_ASSIGN
%ADA-I-NUMERIC_ERROR, NUMERIC_ERROR
%SYSTEM-F-INTDIV, arithmetic trap, integer divide by zero at PC=00000848, 
PSL=03C000A6
%TRACE-E-TRACEBACK, symbolic stack dump follows
module name     routine name                     line       rel PC    abs PC
                                                           0000D1D6  0000D1D6
----- above condition handler called with exception 00000484:
%SYSTEM-F-INTDIV, arithmetic trap, integer divide by zero at PC=00000848, 
PSL=03C000A6
----- end of exception message
TEST_ASSIGN     TEST_ASSIGN                         7      00000012  00000848
ADA$ELAB_TEST_A ADA$ELAB_TEST_ASSIGN                       00000009  00000609
                                                           000008D9  000008D9
                                                           0000CFD2  0000CFD2
ADA$ELAB_TEST_A ADA$ELAB_TEST_ASSIGN                       0000001B  0000061B
                                                           000008B4  000008B4
     if anyone knows why you can get but not assign, please let me know.
                                        gary Sivak

------

             reply	other threads:[~1987-06-04 16:21 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-06-04 16:21 seafac [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-07-23  0:00 <None> **
1993-09-01  7:24 (none) N.B. Hedd
1993-01-27 23:32 <none> xim
1993-01-27 23:09 <none> xim
1993-01-27 16:39 <none> xim
1993-01-27 16:29 <none> slava
1993-01-26 23:13 <none> xim
1992-12-04  4:03 (none) Michael Feldman
1992-12-03 16:57 (none) dog.ee.lbl.gov!overload.lbl.gov!agate!linus!linus.mitre.org!news!emery
1992-12-03 15:59 (none) Tuck er Taft
1992-12-03 14:43 (none) dog.ee.lbl.gov!overload.lbl.gov!agate!usenet.ins.cwru.edu!magnus.acs.ohio
1992-04-03 15:57 <none> David Emery
1991-09-20 18:58 <None> cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!usen
1991-06-20 13:18 (none) Eric E. Mays 52202
1991-06-20 13:18 (none) Eric E. Mays 52202
1991-05-27  8:20 (none) Giorgio del rio
1991-05-14 13:35 <None> Ace Stewart
1991-03-26 20:38 (none) Eric E. Mays 52202
1991-02-28 17:50 (none) Giorgio del rio
1991-01-10 16:38 (none) GS-09 Ken McCook;SCDD
1990-09-20 18:21 (none) "John P. Solomond, Director, AJPO"
1990-09-24  8:52 ` (none) Richard A. O'Keefe
1990-08-08 21:12 (none) Jose_Duarte
1990-05-07 18:37 (none) Ken McCook;SCDQ;
1990-02-14 16:43 (none) Dave Williamson
1989-09-02 22:13 (none) cdonalds
1989-09-04  1:43 ` (none) Richard O'Keefe
1989-04-14 11:43 (none) jrovert
1989-04-03 13:23 (none) Norman Cohen
1989-03-09 22:07 (none) Norman Cohen
1989-03-08 13:59 (none) Norman Cohen
1989-03-06 19:20 (none) TSIGLER
1989-03-06 14:49 (none) Javier Romanach / GMV
1989-02-24  0:46 (none) Marie T. Minogue
1989-02-16 17:05 (none) Richard.S.D'Ippolito
1989-01-13 17:11 (none) NCOHEN
1988-11-21 22:34 (none) Mark Nelson
1988-11-07 12:52 (none) gita R. Rajan
1988-10-20 18:40 (none) sdl
1988-09-16  9:51 (none) TVOVERBE
1988-06-03 12:08 (none) Greg Gicca
1988-04-07 20:15 (none) sdl
1988-03-17  1:24 (none) sdl
1988-03-12  2:48 (none) sdl
1988-03-09  3:18 (none) sdl
1988-03-07 15:16 (none) amb
1987-12-23 10:54 (none) CARNAL
1987-09-15 19:39 (none) Alex Blakemore
1987-08-28 15:31 (none) LOUBOUTIN
1987-08-25 16:58 (none) LOUBOUTIN
1987-08-25 16:58 (none) LOUBOUTIN
1987-06-09 17:17 (none) SARX
1987-05-29  4:57 (none) postmaster
1987-05-27  3:03 (none) jklemens
1987-03-14  1:22 (none) CONTR47
1987-01-16 16:24 (none) FRASER
1986-12-21 23:16 (none) diby
1986-09-22 16:36 (none) "Pat Rogers, High Tech Lab"
1986-09-22 16:36 (none) "Pat Rogers, High Tech Lab"
1986-06-05 19:39 (none) info-ada-request
1986-06-05 12:15 (none) info-ada-request
1986-04-08 14:54 (none) Stephen.Hutchinson
1986-03-16 18:52 (none) info-ada-request
1986-02-03 19:07 (none) GAUSTIN
1985-12-05 21:42 (none) , , 
1985-12-05 20:54 (none) , 
1985-12-05 20:50 (none) info-ada
1985-12-05 17:45 (none) info-ada
1985-12-08 21:08 ` (none) Jay R. Ashworth
1985-12-05 15:46 (none) info-ada
1985-12-05  6:09 (none) info-ada
1985-12-06  1:04 ` (none) info-ada
1985-12-06  1:37 ` (none) info-ada
1985-12-06  1:47 ` (none) info-ada
1985-12-04 18:34 (none) RCONN
1985-12-06  1:02 ` (none) info-ada
1985-12-06  1:32 ` (none) info-ada
1985-12-06  1:46 ` (none) info-ada
1985-12-04 16:41 (none) RCONN
1985-12-06  0:59 ` (none) info-ada
1985-12-06  1:29 ` (none) info-ada
1985-12-06  1:46 ` (none) info-ada
1985-12-04  7:50 (none) , 
1985-12-06  0:47 ` (none) info-ada
1985-12-06  1:13 ` (none) info-ada
1985-12-06  1:44 ` (none) info-ada
1985-12-03 22:07 (none) , 
1985-12-06  0:47 ` (none) info-ada
1985-12-06  1:10 ` (none) info-ada
1985-12-06  1:42 ` (none) info-ada
1985-12-03 11:13 (none) , 
1985-12-06  0:42 ` (none) info-ada
1985-12-06  1:08 ` (none) info-ada
1985-12-06  1:41 ` (none) info-ada
1985-12-03  4:24 (none) info-ada
1985-12-06  0:41 ` (none) info-ada
1985-12-06  1:06 ` (none) info-ada
1985-12-06  1:40 ` (none) info-ada
1985-12-06  1:48 ` (none) info-ada
1985-12-12 22:22   ` (none) info-ada
1985-12-02 20:44 (none) Stachour.CSC_RP
1985-12-06  0:41 ` (none) info-ada
1985-11-29 14:35 Ada Professionalism Document Edward V. Berard
1985-12-04  9:09 ` (none) , 
1985-12-06  0:49   ` (none) info-ada
1985-12-10 11:32     ` (none) info-ada
1985-12-06  1:15   ` (none) info-ada
1985-12-06  1:45   ` (none) info-ada
1985-12-06  5:04   ` (none)??? Dick Dunn
replies disabled

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