comp.lang.ada
 help / color / mirror / Atom feed
* Misleading Compiler Warning
@ 2003-02-02 14:58 Volkert
  2003-02-02 19:03 ` Jeffrey Carter
  2003-02-03  6:45 ` Simon Wright
  0 siblings, 2 replies; 7+ messages in thread
From: Volkert @ 2003-02-02 14:58 UTC (permalink / 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 => "__");



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

end of thread, other threads:[~2003-02-09 15:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-02 14:58 Misleading Compiler Warning Volkert
2003-02-02 19:03 ` 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

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