comp.lang.ada
 help / color / mirror / Atom feed
* GCC 4.4.0 Postcondition oddity.
@ 2009-07-04 12:27 xorque
  2009-07-06 12:15 ` xorque
  0 siblings, 1 reply; 7+ messages in thread
From: xorque @ 2009-07-04 12:27 UTC (permalink / raw)


Hello.

See the following:

package P is

  procedure X (A : out Natural);
  pragma Postcondition (A >= 10);

end P;

package body P is

  procedure X (A : out Natural) is
  begin
    A := 20;
  end X;

end P;

$ gcc44 -gnatwadleG -gnatVa -gnato -gnata -gnatW8 -gnatiw -
gnaty2aAbdefhiklnprStu -c p.adb
p.ads:4:25: warning: "A" may be referenced before it has a value

Anyone else seeing this (strange) warning?



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

* Re: GCC 4.4.0 Postcondition oddity.
  2009-07-04 12:27 GCC 4.4.0 Postcondition oddity xorque
@ 2009-07-06 12:15 ` xorque
  2009-07-06 12:39   ` Georg Bauhaus
  0 siblings, 1 reply; 7+ messages in thread
From: xorque @ 2009-07-06 12:15 UTC (permalink / raw)


Nobody else seeing this?

Looks like a compiler bug to me.



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

* Re: GCC 4.4.0 Postcondition oddity.
  2009-07-06 12:15 ` xorque
@ 2009-07-06 12:39   ` Georg Bauhaus
  2009-07-06 13:45     ` xorque
  0 siblings, 1 reply; 7+ messages in thread
From: Georg Bauhaus @ 2009-07-06 12:39 UTC (permalink / raw)


xorque schrieb:
> Nobody else seeing this?
> 
> Looks like a compiler bug to me.

$ gcc -gnatv  -gnatwadleG -gnatVa -gnato -gnata -gnatW8 -gnatiw
-gnaty2aAbdefhiklnprStu -c p.adb

GNAT GPL 2009 (20090519)
Copyright 1992-2009, Free Software Foundation, Inc.

Compiling: p.adb (source file time stamp: 2009-07-06 12:35:23)
 8 lines: No errors
$ uname -a
Linux kartoffel 2.6.24-24-server #1 SMP Wed Apr 15 15:41:09 UTC 2009
x86_64 GNU/Linux





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

* Re: GCC 4.4.0 Postcondition oddity.
  2009-07-06 12:39   ` Georg Bauhaus
@ 2009-07-06 13:45     ` xorque
  2009-07-06 15:46       ` Tero Koskinen
  2009-07-06 17:15       ` Samuel Tardieu
  0 siblings, 2 replies; 7+ messages in thread
From: xorque @ 2009-07-06 13:45 UTC (permalink / raw)


> $ gcc -gnatv  -gnatwadleG -gnatVa -gnato -gnata -gnatW8 -gnatiw
> -gnaty2aAbdefhiklnprStu -c p.adb
>
> GNAT GPL 2009 (20090519)
> Copyright 1992-2009, Free Software Foundation, Inc.
>
> Compiling: p.adb (source file time stamp: 2009-07-06 12:35:23)
>  8 lines: No errors
> $ uname -a
> Linux kartoffel 2.6.24-24-server #1 SMP Wed Apr 15 15:41:09 UTC 2009
> x86_64 GNU/Linux

Thanks.

Looks like I'll be filing a bug report...



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

* Re: GCC 4.4.0 Postcondition oddity.
  2009-07-06 13:45     ` xorque
@ 2009-07-06 15:46       ` Tero Koskinen
  2009-07-06 17:15       ` Samuel Tardieu
  1 sibling, 0 replies; 7+ messages in thread
From: Tero Koskinen @ 2009-07-06 15:46 UTC (permalink / raw)


On Mon, 6 Jul 2009 06:45:17 -0700 (PDT) xorque wrote:

> > $ gcc -gnatv  -gnatwadleG -gnatVa -gnato -gnata -gnatW8 -gnatiw
> > -gnaty2aAbdefhiklnprStu -c p.adb
> >
> > GNAT GPL 2009 (20090519)
> > Copyright 1992-2009, Free Software Foundation, Inc.
> >
> > Compiling: p.adb (source file time stamp: 2009-07-06 12:35:23)
> >  8 lines: No errors
> > $ uname -a
> > Linux kartoffel 2.6.24-24-server #1 SMP Wed Apr 15 15:41:09 UTC 2009
> > x86_64 GNU/Linux
> 
> Thanks.
> 
> Looks like I'll be filing a bug report...

I think the error is already fixed in FSF gcc -trunk:

$ gcc -gnatv  -gnatwadleG -gnatVa -gnato -gnata -gnatW8 -gnatiw -gnaty2aAbdefhiklnprStu -c p.adb

GNAT 4.5.0 20090416 (experimental)
Copyright 1992-2009, Free Software Foundation, Inc.

Compiling: p.adb (source file time stamp: 2009-07-06 15:43:53)
 9 lines: No errors
$ 

-- 
Tero Koskinen - http://iki.fi/tero.koskinen/



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

* Re: GCC 4.4.0 Postcondition oddity.
  2009-07-06 13:45     ` xorque
  2009-07-06 15:46       ` Tero Koskinen
@ 2009-07-06 17:15       ` Samuel Tardieu
  2009-07-06 21:25         ` xorque
  1 sibling, 1 reply; 7+ messages in thread
From: Samuel Tardieu @ 2009-07-06 17:15 UTC (permalink / raw)


>>>>> "xorque" == xorque  <xorquewasp@googlemail.com> writes:

xorque> Looks like I'll be filing a bug report...

Out of curiosity, what does the output of "gcc -gnatadg" look like?

Here, it is: (with a recent FSF GCC)

% gcc -c -gnatadg p.adb
with system.system__assertions;

package body p is

   procedure p__x (a : out natural) is

      procedure p__x___postconditions is
      begin
         if not (a >= 10) then
            $system__assertions__raise_assert_failure (
              "Postcondition failed at p.ads:4");
         end if;
         return;
      end p__x___postconditions;
   begin
      a := 20;
      p__x___postconditions;
      return;
   end p__x;
begin
   null;
end p;



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

* Re: GCC 4.4.0 Postcondition oddity.
  2009-07-06 17:15       ` Samuel Tardieu
@ 2009-07-06 21:25         ` xorque
  0 siblings, 0 replies; 7+ messages in thread
From: xorque @ 2009-07-06 21:25 UTC (permalink / raw)




Samuel Tardieu wrote:
> >>>>> "xorque" == xorque  <xorquewasp@googlemail.com> writes:
>
> xorque> Looks like I'll be filing a bug report...
>
> Out of curiosity, what does the output of "gcc -gnatadg" look like?
>
> Here, it is: (with a recent FSF GCC)
>
> % gcc -c -gnatadg p.adb
> with system.system__assertions;
>
> package body p is
>
>    procedure p__x (a : out natural) is
>
>       procedure p__x___postconditions is
>       begin
>          if not (a >= 10) then
>             $system__assertions__raise_assert_failure (
>               "Postcondition failed at p.ads:4");
>          end if;
>          return;
>       end p__x___postconditions;
>    begin
>       a := 20;
>       p__x___postconditions;
>       return;
>    end p__x;
> begin
>    null;
> end p;

On my system:

       a := 20;
       p__x___postconditions;
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      return;

Is missing. I'll try compiling trunk!

Thanks.



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

end of thread, other threads:[~2009-07-06 21:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-04 12:27 GCC 4.4.0 Postcondition oddity xorque
2009-07-06 12:15 ` xorque
2009-07-06 12:39   ` Georg Bauhaus
2009-07-06 13:45     ` xorque
2009-07-06 15:46       ` Tero Koskinen
2009-07-06 17:15       ` Samuel Tardieu
2009-07-06 21:25         ` xorque

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