public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/25988]  New: visibility problem with generic child package
@ 2006-01-27  4:03 koch at math dot utexas dot edu
  2006-01-28 21:57 ` [Bug ada/25988] Ada: " laurent at guerby dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: koch at math dot utexas dot edu @ 2006-01-27  4:03 UTC (permalink / raw)
  To: gcc-bugs

Compiling test.adb results in

  test.adb:7:04: instantiation error at foo.adb:10
  test.adb:7:04: "S_Two" is not visible
  test.adb:7:04: instantiation error at foo.adb:10
  test.adb:7:04: non-visible declaration at xy-z.ads:4
  test.adb:7:04: instantiation error at foo.adb:10
  test.adb:7:04: non-visible declaration at s_x-z.ads:6

even though S_Two should be perfectly visible.
Uncommenting the indicated line in foo.adb "fixes" the problem.
This error occurs with various versions of gnat and gcc.
Anyhow:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-shared
--with-system-zlib --libexecdir=/usr/lib --enable-nls
--without-included-gettext --enable-threads=posix --program-suffix=-4.0
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre
--enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)

command line: gcc-4.0 -c test.adb

And here the files:

--------------- x.ads

package X is

  type XX is new Integer;

  procedure One(N: in out XX);

end X;

--------------- x.adb

package body X is

  procedure One(N: in out XX) is
  begin
    N := 1;
  end One;

end X;

--------------- x-z.ads

package X.Z is

  procedure Two(N: in out XX);

end X.Z;

--------------- x-z.adb

package body X.Z is

  procedure Two(N: in out XX) is
  begin
    N := 2;
  end Two;

end X.Z;

--------------- s_x.ads

with X;
use X;

package S_X is

  subtype XX is X.XX;

  procedure S_One(N: in out XX) renames One;

end S_X;

--------------- s_x-z.ads

with X.Z;
use X.Z;

package S_X.Z is

  procedure S_Two(N: in out XX) renames Two;

end S_X.Z;

--------------- xy.ads

generic

  type Number is private;

  with procedure S_One(N: in out Number) is <>;

package XY is

  procedure One(N: in out Number) renames S_One;

end XY;

--------------- xy-z.ads

generic

  with procedure S_Two(N: in out Number) is <>;

package XY.Z is

  procedure Two(N: in out Number) renames S_Two;

end XY.Z;

--------------- foo.ads

generic

  M: in Integer;

package Foo is

  procedure Three(K: in out Integer);

end Foo;

--------------- foo.adb

with S_X, S_X.Z, XY, XY.Z;
use S_X, S_X.Z;

package body Foo is
--  use S_X.Z;  -- uncommenting this "fixes" the problem

  package Numbers is new XY (Number => XX);
  use Numbers;
  package Numbers_Z is new Numbers.Z;

  procedure Three(K: in out Integer) is
  begin
    K := 3;
  end Three;

end Foo;

--------------- test.adb

with Ada.Text_IO;
use Ada.Text_IO;
with Foo;

procedure Test is

   package F is new Foo (M => 10);

begin

   Put("hi");

end Test;


-- 
           Summary: visibility problem with generic child package
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: koch at math dot utexas dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25988


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

* [Bug ada/25988] Ada: visibility problem with generic child package
  2006-01-27  4:03 [Bug ada/25988] New: visibility problem with generic child package koch at math dot utexas dot edu
@ 2006-01-28 21:57 ` laurent at guerby dot net
  2006-01-29  5:25 ` koch at math dot utexas dot edu
  2006-01-29 10:50 ` laurent at guerby dot net
  2 siblings, 0 replies; 4+ messages in thread
From: laurent at guerby dot net @ 2006-01-28 21:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from laurent at guerby dot net  2006-01-28 21:56 -------
Confirmed present on 4.0.2 (release), 
4.1.0 20060126 (prerelease)
4.2.0 20060126 (experimental)

Another way to make it work is to be explicit in foo.adb:
  package Numbers_Z is new Numbers.Z (S_X.Z.S_Two);


-- 

laurent at guerby dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
 GCC target triplet|i686-pc-linux-gnu           |
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2006-01-28 21:56:57
               date|                            |
            Summary|visibility problem with     |Ada: visibility problem with
                   |generic child package       |generic child package


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25988


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

* [Bug ada/25988] Ada: visibility problem with generic child package
  2006-01-27  4:03 [Bug ada/25988] New: visibility problem with generic child package koch at math dot utexas dot edu
  2006-01-28 21:57 ` [Bug ada/25988] Ada: " laurent at guerby dot net
@ 2006-01-29  5:25 ` koch at math dot utexas dot edu
  2006-01-29 10:50 ` laurent at guerby dot net
  2 siblings, 0 replies; 4+ messages in thread
From: koch at math dot utexas dot edu @ 2006-01-29  5:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from koch at math dot utexas dot edu  2006-01-29 05:25 -------
(In reply to comment #1)
> Confirmed present on 4.0.2 (release), 
> 4.1.0 20060126 (prerelease)
> 4.2.0 20060126 (experimental)
> 
> Another way to make it work is to be explicit in foo.adb:
>   package Numbers_Z is new Numbers.Z (S_X.Z.S_Two);
> 

I agree, this is another possible workaround -
more cumbersome than the one I mentioned,
in cases where there are large numbers of arguments
(as in the program where I originally encountered this problem).
My posting was mostly intended to draw attention
to a possible compiler bug. Maybe it helps
making a great compiler even better.


-- 

koch at math dot utexas dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25988


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

* [Bug ada/25988] Ada: visibility problem with generic child package
  2006-01-27  4:03 [Bug ada/25988] New: visibility problem with generic child package koch at math dot utexas dot edu
  2006-01-28 21:57 ` [Bug ada/25988] Ada: " laurent at guerby dot net
  2006-01-29  5:25 ` koch at math dot utexas dot edu
@ 2006-01-29 10:50 ` laurent at guerby dot net
  2 siblings, 0 replies; 4+ messages in thread
From: laurent at guerby dot net @ 2006-01-29 10:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from laurent at guerby dot net  2006-01-29 10:50 -------
Hi Hans, I confirmed your bug and set the state as NEW: that means may be a
volunteer developper will look at it and fix it, but there are of course no
guarantee that it will happen quickly.

WAITING means that developpers are waiting from the bug reporter some
additional input, here it's not the case, you provided a complete bug report
(thanks!) so the ball is in GCC developper camp, setting NEW again.


-- 

laurent at guerby dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
   Last reconfirmed|2006-01-28 21:56:57         |2006-01-29 10:50:16
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25988


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

end of thread, other threads:[~2006-01-29 10:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-27  4:03 [Bug ada/25988] New: visibility problem with generic child package koch at math dot utexas dot edu
2006-01-28 21:57 ` [Bug ada/25988] Ada: " laurent at guerby dot net
2006-01-29  5:25 ` koch at math dot utexas dot edu
2006-01-29 10:50 ` laurent at guerby dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).