[Bug ada/52033] New: Compiler assertion, apparently due to incomplete type

2012-01-28 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52033

 Bug #: 52033
   Summary: Compiler assertion, apparently due to incomplete type
Classification: Unclassified
   Product: gcc
   Version: 4.5.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: gary...@comcast.net


Created attachment 26495
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26495
gnatchop file containing the source

This code causes a compiler assertion in GNAT-GCC 4.6.2.

The same code presented to GNAT-GPL 4.5.3 reports:

/home/geb/gnat/try/pl-io.ads:175:14: error: premature usage of
   incomplete type Quick_T defined at line 175

Which isn't really a correct diagnostic.  The type Quick_T isn't what is
incomplete.  Line 175 is where Quick_T would be completed.  Rather the
problem is the Stream field of Quick_T at line 177.  It has an incomplete
type named Stream_T.

Except for the main program (which is a single Text_Io.Put_Line call) all of
the code is a series of Ada specification units.

Gary

--
lapwarmer-256: which gcc
/usr/local/gcc-4.6.2/bin/gcc
--
lapwarmer-257: which gnat
/usr/local/gcc-4.6.2/bin/gnat
--
lapwarmer-258: gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.6.2/libexec/gcc/i686-pc-linux-gnu/4.6.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.6.2/configure --enable-languages=c,c++,ada
--prefix=/usr/local/gcc-4.6.2 --with-local-prefix=/usr/local/gcc-4.6.2
--with-stage1-ldflags=-L/usr/local/gcc-4.6.2/lib
--with-boot-ldflags=-L/usr/local/gcc-4.6.2/lib
--with-cloog=/usr/local/gcc-4.6.2 --with-ppl=/usr/local/gcc-4.6.2
Thread model: posix
gcc version 4.6.2 (GCC) 
--
lapwarmer-259: gnat make -P simple.gpr pb_code_main.adb 
gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 -gnatn -gnato -gnatU
-gnatwa -gnatwe -gnatwi -gnatwj -gnatwK -gnatwl -Wuninitialized -gnatVa
-pass-exit-codes -O -g -I- -gnatA /home/geb/gnat/try/pb_code_main.adb
+===GNAT BUG DETECTED==+
| 4.6.2 (i686-pc-linux-gnu) Assert_Failure sem_ch3.adb:13569   |
| Error detected at pl-io.ads:510:9|
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.|
| Use a subject line meaningful to you and us to track the bug.|
| Include the entire contents of this bug box in the report.   |
| Include the exact gcc or gnatmake command that you entered.  |
| Also include sources listed below in gnatchop format |
| (concatenated together with no headers between files).   |
+==+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

/home/geb/gnat/try/pb_code_main.adb
/home/geb/gnat/try/GNAT-TEMP-01.TMP
/home/geb/gnat/try/GNAT-TEMP-02.TMP
/home/geb/gnat/try/pl.ads
/home/geb/gnat/try/pl-container.ads
/home/geb/gnat/try/pl-convert.ads
/home/geb/gnat/try/pl-types.ads
/home/geb/gnat/try/pl-internal.ads
/home/geb/gnat/try/pl-internal-configuration.ads
/home/geb/gnat/try/pl-dp.ads
/home/geb/gnat/try/pl-container-depr.ads
/home/geb/gnat/try/pl-container-depr-ary.ads
/home/geb/gnat/try/pl-container-depr-interfaces.ads
/home/geb/gnat/try/pl-container-depr-interfaces-abstract_iterators.ads
/home/geb/gnat/try/pl-container-depr-interfaces-item_type.ads
/home/geb/gnat/try/pl-container-depr-ary-interfaces.ads
/home/geb/gnat/try/pl-container-depr-interfaces-item_type-iterators.ads
/home/geb/gnat/try/pl-container-depr-hashfixed.ads
/home/geb/gnat/try/pl-container-depr-hashfixed-ek_items.ads
/home/geb/gnat/try/pl-container-depr-hashfixed-ek_items-interfaces.ads
/home/geb/gnat/try/pl-container-depr-hashfixed-items.ads
/home/geb/gnat/try/pl-container-depr-hashfixed-items-interfaces.ads
/home/geb/gnat/try/pl-container-depr-hashfixed-sk_items.ads
/home/geb/gnat/try/pl-container-depr-interfaces-abstract_iterators_sk.ads
/home/geb/gnat/try/pl-container-depr-hashfixed-sk_items-interfaces.ads
/home/geb/gnat/try/pl-container-depr-hashvaria.ads
/home/geb/gnat/try/pl-container-depr-hashvaria-ek_items.ads
/home/geb/gnat/try/pl-container-depr-hashvaria-ek_items-interfaces.ads
/home/geb/gnat/try/pl-container-depr-hashvaria-items.ads
/home/geb/gnat/try/pl-container-depr-hashvaria-items-interfaces.ads

[Bug ada/52033] Compiler assertion, apparently due to incomplete type

2012-01-28 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52033

--- Comment #1 from Gary Barnes garynot at comcast dot net 2012-01-28 
23:39:32 UTC ---
Created attachment 26496
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26496
the gpr file used in the example


[Bug ada/51940] Ada.Finalization of passed function return value skipped if exception raised in routine

2012-01-23 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51940

--- Comment #4 from Gary Barnes garynot at comcast dot net 2012-01-24 
06:05:59 UTC ---
How do I report it to AdaCore?  Their web site has lots of marketing stuff but
nothing about reporting bugs.  Ditto for the Libre site.

So there are two GNAT's in the world?  Do they ever crosspollenate?  Is the GCC
GNAT more reliable?


[Bug ada/51940] Ada.Finalization of passed function return value skipped if exception raised in routine

2012-01-22 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51940

--- Comment #2 from Gary Barnes garynot at comcast dot net 2012-01-23 
00:23:31 UTC ---
Created attachment 26418
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26418
gcc -v output, gnat make command, copy of the .gpr file


[Bug ada/51940] New: Ada.Finalization of passed function return value skipped if exception raised in routine

2012-01-21 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51940

 Bug #: 51940
   Summary: Ada.Finalization of passed function return value
skipped if exception raised in routine
Classification: Unclassified
   Product: gcc
   Version: 4.5.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: gary...@comcast.net


Created attachment 26409
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26409
Sample failing program.  Very simple code.

When a finalizable value is returned as a function result and passed to a
routine, if that routine terminates with an exception then the Finalization
routine is not called on the function result.  The value thus escapes from
finalization control when it should not.

gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 -gnatn -gnato
-gnatwe -gnatwi -gnatwj -gnatwK -gnatwl -Wuninitialized -gnatVa
-pass-exit-codes -O -g -I- -gnatA /home/geb/foo.gnat.bug4/pb_code_main.adb
gnatbind -E -m50 -Sin -static -we -I- -x
/home/geb/foo.gnat.bug4/pb_code_main.ali
gnatlink /home/geb/foo.gnat.bug4/pb_code_main.ali -g -v -o
/home/geb/foo.gnat.bug4/pb_code_main
./pb_code_main

Initialize 3216937700 0
Value'Address 3216937700 0
---0 0
Adjust 3216937680 0
A'Address 3216937680 1
Finalize 3216937680 1
---1 0
Adjust 3216936828 0
X'Address 3216936828 1
Adjust 134716096 1
Finalize 3216936828 2
Adjust 3216937668 1
Finalize 134716096 2
B'Address 3216937668 1
Finalize 3216937668 1
---2 0
Adjust 3216936828 0
X'Address 3216936828 1
Adjust 134716096 1
Finalize 3216936828 2
Y'Address 134716096 1
**Notice lack of Finalization call on Y**
---3 = 1
Adjust 3216936828 1
X'Address 3216936828 2
Adjust 134716096 2
Finalize 3216936828 3
Y'Address 134716096 2
**Notice lack of Finalization call on Y**
**Notice That both Y's have same address, so Y was deallocated or reused
without Finalization**
---4 = 2
---5 2
Finalize 3216937700 2


[Bug ada/51690] New: Ada.Finalization with pointer field without explicit initialization confuses compiler

2011-12-27 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51690

 Bug #: 51690
   Summary: Ada.Finalization with pointer field without explicit
initialization confuses compiler
Classification: Unclassified
   Product: gcc
   Version: 4.5.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: gary...@comcast.net


Created attachment 26192
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26192
26 line source file, self contained except for Ada.Text_Io which can be
eliminated.

Ada.Finalization plus access type fields that are not explicitly initialized in
the type declaration cause the compiler to complain that it has not seen the
body of its own internally generated support routines.

gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 -gnatn -gnato
-gnatwe -gnatwi -gnatwj -gnatwK -gnatwl -Wuninitialized -gnatVa
-pass-exit-codes -O -g -I- -gnatA /home/geb/foo.gnat.bug3/pb_code_main.adb
/home/geb/foo.gnat.bug3/pb_code_main.adb:10:05: warning: cannot call F207b
before body seen
/home/geb/foo.gnat.bug3/pb_code_main.adb:10:05: warning: Program_Error will be
raised at run time
gnatmake: /home/geb/foo.gnat.bug3/pb_code_main.adb compilation error

The number in F207b varies greatly as one works towards a cut down example. 
The b in F207b is sometimes an s.  But this is always the form of the
complaint.

The attached file is about as minimal as I've been able to make it, 26 lines. 
Compile it with the options above.  Eliminate any type, an field, or change the
access type to something that is not an access type, and the problem goes away.

There is a workaround.  Explicitly initialize the access type field to :=
null;.
In a real program this means explicitly initializing all access type fields to
null but it seems to get the job done.


[Bug ada/50300] New: Error message incomplete and points to the wrong place. premature usage of incomplete type

2011-09-05 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50300

 Bug #: 50300
   Summary: Error message incomplete and points to the wrong
place.  premature usage of  incomplete type
Classification: Unclassified
   Product: gcc
   Version: 4.5.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: gary...@comcast.net


Using the current GNAT GPL from AdaCore
GNAT GPL 2011 (20110419)
Copyright 1996-2011, Free Software Foundation, Inc.


lapwarmer-171: gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/gnat/libexec/gcc/i686-pc-linux-gnu/4.5.3/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../src/configure --prefix=/usr/gnat
--with-libelf=/ter.a/gnatmail/release-gpl/build-ter/libmpfr/install
--with-mpc=/ter.a/gnatmail/release-gpl/build-ter/libmpfr/install
--with-gmp=/ter.a/gnatmail/release-gpl/build-ter/libmpfr/install
--with-mpfr=/ter.a/gnatmail/release-gpl/build-ter/libmpfr/install
--build=i686-pc-linux-gnu --enable-languages=c,ada,c++ --disable-nls
--without-libiconv-prefix --disable-libmudflap --disable-libstdcxx-pch
--disable-libada --enable-checking=release --enable-__cxa_atexit
--enable-threads=posix --with-bugurl=URL:mailto:rep...@adacore.com
--with-build-time-tools=/ter.a/gnatmail/release-gpl/build-ter/obj
Thread model: posix
gcc version 4.5.3 20110419 for GNAT GPL 2011 (20110419) (GCC) 

lapwarmer-172: gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 \
  -gnatn -gnato -gnatU -gnatwa -gnatwe -gnatwi -gnatwj \
  -gnatwK -gnatwl -Wuninitialized -gnatVa \
  -pass-exit-codes -O -g -gnatA -x ada proc.adb

proc.adb:15:09: error: premature usage of incomplete private type P2 defined
at line 8

The actual error is that the completion of P2 is trying to use the
also-incomplete P1 as a field and it is the incompleteness of P1 that is a
problem.  It would also be much better to point to line 10.

The test program is quite small.

with Text_Io;

procedure Proc is

package X is
type P1 is private;
package Y is
type P2 is private;
private
type P2 is
record
Z : P1; -- Actual error is use of P1 before completed.
end record;
end Y;
Q : Y.P2;
private
type P1 is new Integer;
end X;

begin
Text_Io.Put_Line (Hello);
end Proc;


[Bug ada/50292] New: compiler bug box - pl-io.ads

2011-09-04 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50292

 Bug #: 50292
   Summary: compiler bug box - pl-io.ads
Classification: Unclassified
   Product: gcc
   Version: 4.5.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: gary...@comcast.net


[Bug ada/50292] compiler bug box - pl-io.ads

2011-09-04 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50292

--- Comment #1 from Gary Barnes garynot at comcast dot net 2011-09-05 
04:09:32 UTC ---
Created attachment 25192
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25192
gnatchop file containing the source

gnatchop format file with the source code causing the bug box.

gcc \
-c \
-gnata \
-gnatE \
-fstack-check \
-gnatef \
-gnatf \
-gnatm50 \
-gnatn \
-gnato \
-gnatU \
-gnatwa \
-gnatwe \
-gnatwi \
-gnatwj \
-gnatwK \
-gnatwl \
-Wuninitialized \
-gnatVa \
-pass-exit-codes \
-O \
-g \
-gnatA \
./pb_code_main.adb
+===GNAT BUG DETECTED==+
| 4.5.1 20100924 (Red Hat 4.5.1-4) (i686-redhat-linux-gnu) Assert_Failure
sem_ch3.adb:12928|
| Error detected at pl-io.ads:510:9|
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.|
| Use a subject line meaningful to you and us to track the bug.|
| Include the entire contents of this bug box in the report.   |
| Include the exact gcc or gnatmake command that you entered.  |
| Also include sources listed below in gnatchop format |
| (concatenated together with no headers between files).   |
+==+


[Bug ada/50292] compiler bug box - pl-io.ads

2011-09-04 Thread garynot at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50292

--- Comment #2 from Gary Barnes garynot at comcast dot net 2011-09-05 
04:10:32 UTC ---
gcc \
-c \
-gnata \
-gnatE \
-fstack-check \
-gnatef \
-gnatf \
-gnatm50 \
-gnatn \
-gnato \
-gnatU \
-gnatwa \
-gnatwe \
-gnatwi \
-gnatwj \
-gnatwK \
-gnatwl \
-Wuninitialized \
-gnatVa \
-pass-exit-codes \
-O \
-g \
-gnatA \
./pb_code_main.adb
+===GNAT BUG DETECTED==+
| 4.5.1 20100924 (Red Hat 4.5.1-4) (i686-redhat-linux-gnu) Assert_Failure
sem_ch3.adb:12928|
| Error detected at pl-io.ads:510:9|
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.|
| Use a subject line meaningful to you and us to track the bug.|
| Include the entire contents of this bug box in the report.   |
| Include the exact gcc or gnatmake command that you entered.  |
| Also include sources listed below in gnatchop format |
| (concatenated together with no headers between files).   |
+==+


[Bug ada/23389] New: subtype declared in generic child can't be used, same subtype elsewhere works

2005-08-14 Thread garynot at comcast dot net
   
-d,   -- reference parent types for deriveds
-f);
end Finder;

package gnatls is
for Switches use (-a, -- do everything, not just locals
  -v  -- verbose information
 );
end gnatls;

package Linker is
for Default_Switches (Ada)
   use (
-- not on Cygwin -f,   -- put list of files into a file
-g   -- we want debugging
---v,   -- be very verbose
---v
   );
end Linker;

package Naming is   
for Casing  use lowercase;
for Dot_Replacement use .;
for Spec_Suffix (Ada) use .1.ada;   
for Body_Suffix (Ada) use .2.ada;   
for Separate_Suffix use .3.ada;
end Naming;

end Common; 

-- Local Variables:
-- mode: adp-mode
-- End: 

--
one.1.ada
--
generic
type Int_T is range ;
package One is

type Type_T () is tagged private;

function Init return Type_T;

private

type Type_T (A : Int_T) is tagged
   record
   B : Int_T;
   end record;

end One;
--
one.2.ada
--
package body One is

function Init return Type_T is
begin
return (A=1,B=2);
end Init;

end One;
--
one.two.1.ada
--
generic
I : Integer;
package One.Two is

J : constant Integer := I;
subtype Subtype_T is One.Type_T;
function Init return Subtype_T renames One.Init;

end One.Two;
--
three.2.ada
--
with One.Two;
with Ada.Text_Io;
procedure Three is
package Onee is new One (Integer);
package Twoo is new Onee.Two (3);
begin

Ada.Text_Io.Put_Line (Start);
declare
I1 : Onee.Type_T := Onee.Init;
begin
Ada.Text_Io.Put_Line (I1  Integer'Image(I1'Size));
end;
declare
I2a : Twoo.Subtype_T := Twoo.Init;
I2b : Onee.Type_T := Twoo.Init;
begin
Ada.Text_Io.Put_Line (I2a  Integer'Image(I2a'Size));
Ada.Text_Io.Put_Line (I2b  Integer'Image(I2b'Size));
end;
Ada.Text_Io.Put_Line (Finish);

end Three;
--

-- 
   Summary: subtype declared in generic child can't be used, same
subtype elsewhere works
   Product: gcc
   Version: 4.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: garynot at comcast dot net
CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet:  i686-pc-cygwin


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


[Bug ada/23390] New: abstract function in private part not overloading previous function is not allowed

2005-08-14 Thread garynot at comcast dot net
 (-a,   -- do everything, not just locals   
-d,   -- reference parent types for deriveds
-f);
end Finder;

package gnatls is
for Switches use (-a, -- do everything, not just locals
  -v  -- verbose information
 );
end gnatls;

package Linker is
for Default_Switches (Ada)
   use (
-- not on Cygwin -f,   -- put list of files into a file
-g   -- we want debugging
---v,   -- be very verbose
---v
   );
end Linker;

package Naming is   
for Casing  use lowercase;
for Dot_Replacement use .;
for Spec_Suffix (Ada) use .1.ada;   
for Body_Suffix (Ada) use .2.ada;   
for Separate_Suffix use .3.ada;
end Naming;

end Common; 

-- Local Variables:
-- mode: adp-mode
-- End: 

--
one.1.ada
--
generic
type Int_T is range ;
package One is

type Type_T () is abstract tagged private;

function Init return Type_T is abstract;

private

function Func (X : in Type_T) return Type_T is abstract;
--  3.9.3(10) - The declaration above is illegal.
--
--  10 For an abstract type declared in a visible part, an abstract
--  primitive subprogram shall not be declared in the private part, unless
--  it is overriding an abstract subprogram implicitly declared in the
--  visible part. For a tagged type declared in a visible part, a primitive
--  function with a controlling result shall not be declared in the private
--  part, unless it is overriding a function implicitly declared in the
--  visible part.

type Type_T (A : Int_T) is abstract tagged
   record
   B : Int_T;
   end record;

end One;
--
one.two.1.ada
--
generic
I : Integer;
package One.Two is

type Type2_T is new One.Type_T with private;

J : constant Integer := I;

function Init return Type2_T;
function Func (X : in Type2_T) return Type2_T;

private

type Type2_T is new One.Type_T with record Q : Natural := 0; end record;
end One.Two;
--
one.two.2.ada
--
package body One.Two is

function Init return Type2_T is
begin
return (A=1,B=2,Q=3);
end Init;

function Func (X : in Type2_T) return Type2_T is
begin
return X;
end Func;

end One.Two;
--
three.2.ada
--
with One.Two;
with Ada.Text_Io;
procedure Three is
package Onee is new One (Integer);
package Twoo is new Onee.Two (3);
begin

Ada.Text_Io.Put_Line (Start);
declare
I1 : Twoo.Type2_T := Twoo.Init;
I2 : Twoo.Type2_T := Twoo.Func (I1);
begin
Ada.Text_Io.Put_Line (I1  Integer'Image(I1'Size));
Ada.Text_Io.Put_Line (I2  Integer'Image(I2'Size));
end;
Ada.Text_Io.Put_Line (Finish);

end Three;
--

-- 
   Summary: abstract function in private part not overloading
previous function is not allowed
   Product: gcc
   Version: 4.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: garynot at comcast dot net
CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin


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