comp.lang.ada
 help / color / mirror / Atom feed
From: volkert@nivoba.de (Volkert)
Subject: Misleading Compiler Warning
Date: 2 Feb 2003 06:58:56 -0800
Date: 2003-02-02T14:58:56+00:00	[thread overview]
Message-ID: <d37844cb.0302020658.44064e1e@posting.google.com> (raw)

The snippet is reproduced from a large application we currenty
bringing from DEC Ada 83 to GNAT (OpenVMS).... the GNAT 3.16w 
gives a Compiler-Warning whereas the DEC Compiler keeps silent. 

% gnat make wmain.adc
gcc -c -x ada wmain.adc
gcc -c -x ada pack.adc
pack.adc:9:03: warning: in instantiation at Gen.adc:4
pack.adc:9:03: warning: value not in range of type "Standard.Integer"
pack.adc:9:03: warning: "Constraint_Error" will be raised at run time
gnatbind -x wmain.ali
gnatlink wmain.ali

The example runs on both compilers without raising a Constraint_Error.

Is it just a misleading warning message ... if so, i send a bug-report to act.

Volkert

PS: ObjectAda 7.2.1 compiles also with no warnings

----

with Pack;

procedure WMain is

  type T is range 0 .. 100;

  package P is new Pack(T=>T);

begin
 
  P.Do_It;

end;

----

generic
  type T is range <>;
package Pack is

  procedure Do_It;

end Pack;

----
with Gen;

package body Pack is

  package My_Gen is 
    new Gen(s => Float);

  package Inner_Gen_My_Gen is 
    new My_Gen.Inner_Gen(T => T);

  procedure Do_It is
  begin
     Inner_Gen_My_Gen.Do_It;
  end;

end Pack;

---

generic
   type S is private;
package Gen is

   generic
      type T is range <>;
   package Inner_Gen is
      procedure Do_It;
   end Inner_Gen;

end Gen;

---

package body Gen is
   
   package body Inner_Gen is
      type B is array(T) of Boolean;
      pragma Pack(B);
      type C is array (0 .. 100) of B;

      procedure Do_It is
        O : C;
      begin
        O(1)(0) := False;
      end;
   
   end;

end Gen;

----
gnat.adc

pragma Source_File_Name (
  Spec_File_Name  => "*_.adc",
  Casing          => MixedCase,
  Dot_Replacement => "__");

pragma Source_File_Name (
  Body_File_Name  => "*.adc",
  Casing          => MixedCase,
  Dot_Replacement => "__");



             reply	other threads:[~2003-02-02 14:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-02 14:58 Volkert [this message]
2003-02-02 19:03 ` Misleading Compiler Warning Jeffrey Carter
2003-02-03  6:04   ` Volkert
2003-02-03 16:54     ` Jeffrey Carter
2003-02-03  6:45 ` Simon Wright
2003-02-09  3:14   ` Robert I. Eachus
2003-02-09 15:31     ` Volkert
replies disabled

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