From: Andrew Lynch <lynch@cci.de>
Subject: GNAT DOS vs. GNAT NT: Pragma Suppress?
Date: 1997/03/20
Date: 1997-03-20T00:00:00+00:00 [thread overview]
Message-ID: <33313F49.640E@cci.de> (raw)
We are having problems with a sample program that should show the user
what can happen when the Pragma Suppress is used.
Depending on the user's system we have either GNAT 3.07 for DOS or
GNAT 3.09 for Windows NT. Using the DOS compiler range checks can be
suppressed, but the NT compiler still causes exceptions to be raised.
The LRM 11.5(29) says that suppression of checks is not guaranteed,
but I would expect GNAT to handle this the same on various platforms.
GNAT on a Sun SPARC works the same as the DOS version, so why is the
NT version the odd one out?
Here is a shorter version of the code:
----------------->% snip %<--------------------
with Text_IO;
procedure Supprchk is
N : Natural := 0;
I : Integer := -3;
begin
begin
Text_IO.Put_Line( "Range_Check active");
Text_IO.Put("Natural: ");
N := I; -- exception raised
Text_IO.Put_Line(Natural'Image(N));
exception
when Constraint_Error =>
Text_IO.Put_Line("assignment error");
end;
declare
pragma Suppress (Range_Check);
begin
Text_IO.Put_Line( "Range_Check turned off");
Text_IO.Put("Natural: ");
N := I; -- exception with NT, but not with DOS or SPARC
Text_IO.Put_Line(Natural'Image(N));
exception
when Constraint_Error =>
Text_IO.Put_Line("assignment error");
end;
end Supprchk;
----------------->% snip %<--------------------
Using GNAT for DOS (under NT!) or GNAT for SPARC the output is
Range_Check active
Natural: assignment error
Range_Check turned off
Natural: -3
With GNAT for NT the output is
Range_Check active
Natural: assignment error
Range_Check turned off
Natural: assignment error
Is this deliberately different in the NT version, or should we maybe
file a bug report..? Could other people try this with the Windows NT
version of GNAT 3.09? In case it matters this was on a P120, running
the German Windows NT 4.00.1381
Thanks,
Andrew.
--
+----------------------------------------------------------------------+
| Andrew Lynch, MEng / lynch@cci.de | Run, run, as fast as you |
| CCI GmbH / alynch@iee.org | can. You can't catch me, |
| Lohberg 10 /lynch@ug.cs.york.ac.uk | I'm the gingerbeard man! |
| D-49716 Meppen / Tel. ++49 5931 805-243 | .sig by Anna Gramme |
+----------------------------------------------------------------------+
next reply other threads:[~1997-03-20 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-03-20 0:00 Andrew Lynch [this message]
1997-03-22 0:00 ` GNAT DOS vs. GNAT NT: Pragma Suppress? Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox