[Bug ada/42410] New: Illegal Ada 83 program accepted, universal_integer literal where Character expected

2009-12-17 Thread ludovic at ludovic-brenta dot org
pragma ada_83;
with text_io;
procedure test1 is

   type T1 is record
  str: string(1..10);
   end record;

   x1: T1 := (str = (others = 49));  --ERROR: 49 is not a character
begin
   text_io.put_line(x1.str);
end test1;

$ gnatmake test1; ./test1
gcc-4.3 -c test1.adb
gnatbind -x test1.ali
gnatlink test1.ali
11

$ gnatmake test1
gcc-4.4 -c test1.adb
test1.adb:9:33: expected type Standard.Character
test1.adb:9:33: found type universal integer
gnatmake: test1.adb compilation error


-- 
   Summary: Illegal Ada 83 program accepted, universal_integer
literal where Character expected
   Product: gcc
   Version: 4.3.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/42410] Illegal Ada 83 program accepted, universal_integer literal where Character expected

2009-12-17 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-12-17 19:42 
---
Fixed in 4.4; this PR only to document the the issue for users of previous
versions.


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
  Known to fail||4.3.4
 Resolution||FIXED


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



[Bug ada/42411] New: Illegal program accepted, RM 4.1(8), 8.6(27)/2

2009-12-17 Thread ludovic at ludovic-brenta dot org
package pak1 is
   type T1 is new integer;
   type T1_access is access all T1;
   x1: aliased T1;
   x2: T1 := x1'access.all;--ERROR: 4.1(8) (missed)
   x3: T1_access := T1_access(x1'access);  --ERROR: 4.6(6) (detected)
end pak1;


Gnat misses the error involving x1'access.all.
RM 3.10.2(2)/2 says the expected type (for 'access) shall be
a single access type.  But .all doesn't provide a single
access type.  Instead, by RM 4.1(8), the name in a dereference
is expected to be of any access type.

The rule for type_conversions (x3) is similar.  RM 4.6(6) says
The operand of a type_conversion is expected to be of any type.
Gnat does detect this error.

$ gnatmake pak1
gcc-4.3 -c pak1.ads
pak1.ads:6:21: argument of conversion cannot be access
pak1.ads:6:21: use qualified expression instead
gnatmake: pak1.ads compilation error


-- 
   Summary: Illegal program accepted, RM 4.1(8), 8.6(27)/2
   Product: gcc
   Version: 4.3.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/42411] Illegal program accepted, RM 4.1(8), 8.6(27)/2

2009-12-17 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-12-17 19:47 
---
RM 8.6(27)/2 is also relevant:
   When a construct is one that requires that its expected type be a
   single type in a given class, the type of the construct shall be
   determinable solely from the context in which the construct appears,
   excluding the construct itself, but using the requirement that it be in
   the given class. Furthermore, the context shall not be one that expects
   any type in some class that contains types of the given class; in
   particular, the construct shall not be the operand of a
   type_conversion.


-- 


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



[Bug ada/42412] New: Illegal program accepted, RM 8.5.1(3), renames of classwide object

2009-12-17 Thread ludovic at ludovic-brenta dot org
package pak1 is
   type T1 is tagged null record;
   x1: T1;
   x2: T1'class := x1;
   x3: T1'class renames x1;  --ERROR: (detected)  T1'class vs T1
   x4: T1 renames x2;--ERROR: (missed)T1 vs T1'class
end pak1;

$ gnatmake pak1
gcc-4.3 -c pak1.ads
pak1.ads:5:25: expected type T1'class defined at line 2
pak1.ads:5:25: found type T1 defined at line 2
gnatmake: pak1.ads compilation error

RM 8.5.1(3) says The type of the object_name shall resolve to the
type determined by the subtype_mark.  T and T'class are considered
to be different types, and shouldn't match.  There is flexibility in
RM 8.6(23) for T'class to sometimes match T, but only when the rules
provide an expected type.  But this flexibility doesn't apply when
the rules say shall resolve to, as in this case, without giving an
expected type.  This subtle wording distinction can also be seen in
other places in the RM, such as 12.4(4) vs. 12.4(5).


-- 
   Summary: Illegal program accepted, RM 8.5.1(3), renames of
classwide object
   Product: gcc
   Version: 4.3.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/42412] Illegal program accepted, RM 8.5.1(3), renames of classwide object

2009-12-17 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-12-17 19:52 
---
$ gnatmake pak1
gcc-4.4 -c pak1.ads
pak1.ads:5:25: expected type T1'class defined at line 2
pak1.ads:5:25: found type T1 defined at line 2
pak1.ads:6:19: dynamically tagged expression not allowed
gnatmake: pak1.ads compilation error

So the bug is fixed in 4.4.


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
  Known to fail||4.3.4
  Known to work||4.4.2
 Resolution||FIXED


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



[Bug ada/42413] New: Legal tasking program hangs at run time, function returning task that is then passed to a subprogram

2009-12-17 Thread ludovic at ludovic-brenta dot org
with Text_IO;
procedure test1 is
   task type T1 is
  entry E1;
   end T1;

   task body T1 is
   begin
  Text_IO.Put_Line (T1 started);
  accept E1;
  Text_IO.Put_Line (T1 done);
   end T1;

   function f1 return T1 is
   begin
  return R : T1;
   end f1;

   procedure p2 (x1: T1) is
   begin
  Text_IO.Put_Line (begin p2);
  x1.E1;
   end p2;

begin

   declare
 x1: T1 := f1;
   begin
 p2(x1);-- this works
   end;

   declare
 x1: T1 renames f1;
   begin
 p2(x1);-- this works
   end;

   p2(f1);  -- this hangs
end test1;


output:

begin p2
T1 started
T1 done
begin p2
T1 started
T1 done
begin p2
hangs


-- 
   Summary: Legal tasking program hangs at run time, function
returning task that is then passed to a subprogram
   Product: gcc
   Version: 4.3.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/42342] New: Please clarify the rules regarding relationships between project files

2009-12-09 Thread ludovic at ludovic-brenta dot org
(Forwarding and rephrasing http://bugs.debian.org/559447)

The GNAT project manager has the concepts of project files and library
project file; a library project file is one that has the two attributes
Library_Name and Library_Dir; it can also have additional attributes like
Library_ALI_Dir which is what triggered the bug.

The GNAT project manager also has the concepts of project file extensions,
virtual extensions and the with keyword which define two kinds of
relationships between packages (a virtual extension creates extends
relationahips across an entire project tree).

The documentation is unclear about the interactions between the two kinds of
project files and the two kinds of relationships.

application project with application project: OK
application project with library project: OK
application project extends library project: ERROR (1)
application project extends application project: OK
library project with application project: ERROR (2)
library project with library project: OK
library project extends library project: OK (3)
library project extends application project: ERROR (4)

(1) unless the application project recompiles the entire library,
without -fPIC, into the executables, which defeats the purpose of a
library entirely

(2) unless the library project recompiles the application sources, with
-fPIC if dynamic library, into its own Object_Dir and Library_ALI_Dir,
which defeats the purpose of the application project

(3) the extension replaces the parent, i.e. it creates a new library that
includes the object files of both the parent and of the extension; the
extension may replace some of the sources, objects and ALI files of the parent
with its own, as well as add new ones. Consequently, the extension has its own
Library_Name, Library_Dir, Object_Dir and Library_ALI_Dir that are necessarily
different from the ones of the parent.  This is incompatible with extends all
because extends all does not allow redefining these attributes.

(4) unless the library project recompiles all the application's source
files, with -fPIC if dynamic library, into its own Object_Dir, which
defeats the purpose of the application project

I think that GNAT should diagnose the errors (1), (2) and (4) and additionally
the error of applying extends all to a library project as in this example:

project Foo is -- library project
   for Library_Name use foo;
   for Library_Dir use /usr/bin;
   for Library_Kind use dynamic;
   for Source_Dirs use (/usr/share/ada/adainclude/foo);
   for Library_ALI_Dir use /usr/lib/ada/adalib/foo;
   for Externally_Built use true;
end Foo;

with foo;
project Parent is
end Parent;

project Extension extends all parent; -- error (3)
end Extension;

Could someone please comment on the above?

There seems to be another, more trivial, bug in the project manager: the
virtual extension of Foo seems to inherit the Library_Dir but not the
Library_ALI_Dir.  Consequently, GNAT looks for the ALI files in /usr/lib
instead of /usr/lib/ada/adalib/foo and fails.


-- 
   Summary: Please clarify the rules regarding relationships between
project files
   Product: gcc
   Version: 4.4.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/42148] New: Accepts illegal program, RM 10.1.1/14

2009-11-22 Thread ludovic at ludovic-brenta dot org
with ada.text_io;
generic package my_int_io
 renames ada.text_io.integer_io;  --ERROR: not a library unit 10.1.1/14

By RM 10.1.1/14: In a library_unit_renaming_declaration, the (old) name
shall denote a library_item.  But ada.text_io.integer_io is not a
library_item, so this library_unit renaming should be rejected.


-- 
   Summary: Accepts illegal program, RM 10.1.1/14
   Product: gcc
   Version: 4.4.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/42073] [4.4 regression] Infinite loop when parsing a project file, alpha only

2009-11-19 Thread ludovic at ludovic-brenta dot org


--- Comment #7 from ludovic at ludovic-brenta dot org  2009-11-19 18:50 
---
Created an attachment (id=19060)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19060action=view)
Disassembly of prj-part.adb, with sources (objdump -S)


-- 


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



[Bug ada/42073] [4.4 regression] Infinite loop when parsing a project file, alpha only

2009-11-18 Thread ludovic at ludovic-brenta dot org


--- Comment #6 from ludovic at ludovic-brenta dot org  2009-11-18 22:09 
---
With a stock GCC 4.4.2 bootstrapped with the default options (-g -O2, I think)
on alpha the symptoms are the same.  Here is a backtrace:

(gdb) run -vP2 -Pp
Starting program: /home/lbrenta/gcc-obj/gcc/gnatmake -vP2 -Pp
GPR_PROJECT_PATH=.:/home/lbrenta/gcc/lib/gcc/alphaev68-unknown-linux-gnu/4.4.2/../../../gnat
Project_Path_Name_Of (p, /home/lbrenta/);
   Trying /home/lbrenta//p.gpr
Project_Name_From (/home/lbrenta/p.gpr)
^C
Program received signal SIGINT, Interrupt.
0x0001200f8ed8 in prj.part.parse_single_project (in_tree=0x1205fc3e0,
path_name=value optimized out, extended=value optimized out,
from_extended=value optimized out, in_limited=false,
packages_to_check=..., depth=0, current_dir=...)
at /home/lbrenta/gcc-4.4.2/gcc/ada/prj-part.adb:1104
1104   Tree_Private_Part.Projects_Htable.Get_Next
(In_Tree.Projects_HT);
(gdb) bt
#0  0x0001200f8ed8 in prj.part.parse_single_project (in_tree=0x1205fc3e0,
path_name=value optimized out, extended=value optimized out,
from_extended=value optimized out, in_limited=false,
packages_to_check=..., depth=0, current_dir=...)
at /home/lbrenta/gcc-4.4.2/gcc/ada/prj-part.adb:1104
#1  0x0001200fb020 in prj.part.parse (in_tree=0x1205fc3e0,
project_file_name=value optimized out,
always_errout_finalize=value optimized out, packages_to_check=value
optimized out, store_comments=false, current_directory=...)
at /home/lbrenta/gcc-4.4.2/gcc/ada/prj-part.adb:525
#2  0x0001200f4878 in prj.pars.parse (in_tree=value optimized out,
project_file_name=..., packages_to_check=...,
when_no_sources=value optimized out, reset_tree=true) at
/home/lbrenta/gcc-4.4.2/gcc/ada/prj-pars.adb:63
#3  0x0001200858f8 in make.initialize () at
/home/lbrenta/gcc-4.4.2/gcc/ada/make.adb:6993
#4  0x0001200866cc in make.gnatmake () at
/home/lbrenta/gcc-4.4.2/gcc/ada/make.adb:4708
#5  0x000120067708 in gnatmake () at
/home/lbrenta/gcc-4.4.2/gcc/ada/gnatmake.adb:38
(gdb) p In_Tree.Projects_HT
$4 = (access prj.tree.tree_private_part.projects_htable.tab.instance_data) 0x0

The infinite loop appears to be the loop starting at prj-pars.adb:1048 (frame
#0 in the above backtrace).  I'll attach a disassembly.


-- 


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



[Bug ada/42073] [4.4 regression] Infinite loop when parsing a project file, alpha only

2009-11-17 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-11-17 10:27 
---
The following project file is known to work on alpha-gnu-linux with GCC 4.3.4:

project Build_XMLAda is
   for Source_Dirs use (dom, input_sources, sax, schema, unicode);
   for Library_Name use xmlada;
   for Library_Dir use .;
   for Library_Kind use External (kind);
   for Library_Version use External (soname);
   for Object_Dir use External (obj);
   for Library_ALI_Dir use ali-  External (obj);
   package Compiler is
  for Default_Switches (Ada) use (-g, -O2, -gnatafno, -gnatVa,
-gnatwa);
   end Compiler;
end Build_XMLAda;

Since this project file is not noticeably different from GNADE_Common_Build, I
think the bug is actually a regression in 4.4.


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

  Known to fail||4.4.2
  Known to work||4.3.4
Summary|Infinite loop when parsing a|[4.4 regression] Infinite
   |project file, alpha only|loop when parsing a project
   ||file, alpha only


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



[Bug ada/42073] [4.4 regression] Infinite loop when parsing a project file, alpha only

2009-11-17 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2009-11-17 19:56 
---
Even an empty project file triggers the bug:

$ cat  p.gpr EOF
project p is
end p;
EOF
$ gdb gnatmake
(gdb) run -vP2 -Pp
Starting program: /usr/bin/gnatmake -vP2 -Pp
GPR_PROJECT_PATH=.:/usr/share/ada/adainclude/
Project_Path_Name_Of (p, /home/lbrenta/);
   Trying /home/lbrenta//p.gpr
Project_Name_From (/home/lbrenta/p.gpr)
^C
Program received signal SIGINT, Interrupt.
0x0286f344 in prj__tree__tree_private_part__projects_htable__get_next
() from /usr/lib/libgnatprj.so.4.4
(gdb) bt
#0  0x0286f344 in
prj__tree__tree_private_part__projects_htable__get_next () from
/usr/lib/libgnatprj.so.4.4
#1  0x02853dd8 in ?? () from /usr/lib/libgnatprj.so.4.4
#2  0x02856abc in prj__part__parse () from /usr/lib/libgnatprj.so.4.4
#3  0x0284df7c in prj__pars__parse () from /usr/lib/libgnatprj.so.4.4
#4  0x0001200635d4 in ?? ()
#5  0x0001200450c4 in ?? ()
#6  0x00012000cf60 in ?? ()
#7  0x0001200ad114 in ?? ()
#8  0x02bd650c in __libc_start_main (main=value optimized out,
argc=value optimized out, ubp_av=value optimized out,
init=0x1200ad190, fini=value optimized out, rtld_fini=value optimized
out, stack_end=0x11fcbd730) at libc-start.c:222
#9  0x00012000b958 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Note: this gnatmake is built with -O2 and without -g.

(gdb) disassemble
Dump of assembler code for function
prj__tree__tree_private_part__projects_htable__tab__get_next:
0x0286f290
prj__tree__tree_private_part__projects_htable__tab__get_next+0:ldah   
gp,6(t12)
0x0286f294
prj__tree__tree_private_part__projects_htable__tab__get_next+4:lda
gp,-12016(gp)
0x0286f298
prj__tree__tree_private_part__projects_htable__tab__get_next+8:lda
sp,-32(sp)
0x0286f29c
prj__tree__tree_private_part__projects_htable__tab__get_next+12:   stq
s0,8(sp)
0x0286f2a0
prj__tree__tree_private_part__projects_htable__tab__get_next+16:   mov
a0,s0
0x0286f2a4
prj__tree__tree_private_part__projects_htable__tab__get_next+20:   stq
ra,0(sp)
0x0286f2a8
prj__tree__tree_private_part__projects_htable__tab__get_next+24:   stq
s1,16(sp)
0x0286f2ac
prj__tree__tree_private_part__projects_htable__tab__get_next+28:   bne
a0,0x286f2d0
prj__tree__tree_private_part__projects_htable__tab__get_next+64
0x0286f2b0
prj__tree__tree_private_part__projects_htable__tab__get_next+32:   clr v0
0x0286f2b4
prj__tree__tree_private_part__projects_htable__tab__get_next+36:   ldq
ra,0(sp)
0x0286f2b8
prj__tree__tree_private_part__projects_htable__tab__get_next+40:   ldq
s0,8(sp)
0x0286f2bc
prj__tree__tree_private_part__projects_htable__tab__get_next+44:   ldq
s1,16(sp)
0x0286f2c0
prj__tree__tree_private_part__projects_htable__tab__get_next+48:   lda
sp,32(sp)
0x0286f2c4
prj__tree__tree_private_part__projects_htable__tab__get_next+52:   ret
0x0286f2c8
prj__tree__tree_private_part__projects_htable__tab__get_next+56:   nop
0x0286f2cc
prj__tree__tree_private_part__projects_htable__tab__get_next+60:   unop
0x0286f2d0
prj__tree__tree_private_part__projects_htable__tab__get_next+64:   ldah   
s1,1(a0)
0x0286f2d4
prj__tree__tree_private_part__projects_htable__tab__get_next+68:   ldl
t0,-16312(s1)
0x0286f2d8
prj__tree__tree_private_part__projects_htable__tab__get_next+72:   and
t0,0xff,t0
0x0286f2dc
prj__tree__tree_private_part__projects_htable__tab__get_next+76:   beq
t0,0x286f2b0
prj__tree__tree_private_part__projects_htable__tab__get_next+32
0x0286f2e0
prj__tree__tree_private_part__projects_htable__tab__get_next+80:   ldq
a0,-16320(s1)
0x0286f2e4
prj__tree__tree_private_part__projects_htable__tab__get_next+84:   ldq
t12,-32248(gp)
0x0286f2e8
prj__tree__tree_private_part__projects_htable__tab__get_next+88:   jsr
ra,(t12),0x286f2ec
prj__tree__tree_private_part__projects_htable__tab__get_next+92
0x0286f2ec
prj__tree__tree_private_part__projects_htable__tab__get_next+92:   ldah   
gp,6(ra)
0x0286f2f0
prj__tree__tree_private_part__projects_htable__tab__get_next+96:   mov
s0,a0
0x0286f2f4
prj__tree__tree_private_part__projects_htable__tab__get_next+100:  lda
gp,-12108(gp)
0x0286f2f8
prj__tree__tree_private_part__projects_htable__tab__get_next+104:  stq
v0,-16320(s1)
0x0286f2fc
prj__tree__tree_private_part__projects_htable__tab__get_next+108:  ldq
t12,-28536(gp)
0x0286f300
prj__tree__tree_private_part__projects_htable__tab__get_next+112:  jsr
ra,(t12),0x286f304
prj__tree__tree_private_part__projects_htable__tab__get_next+116
0x0286f304
prj__tree__tree_private_part__projects_htable__tab__get_next+116:  ldah   
gp,6(ra)
0x0286f308

[Bug ada/42073] [4.4 regression] Infinite loop when parsing a project file, alpha only

2009-11-17 Thread ludovic at ludovic-brenta dot org


--- Comment #4 from ludovic at ludovic-brenta dot org  2009-11-17 19:59 
---
Actually the disassembly above was that of Tab.Get_Next. The source for
Tab.Get_Next is:

  function Get_Next (T : Instance) return Elmt_Ptr is
  begin
 if T = null or else not T.Iterator_Started then
return Null_Ptr;
 end if;

 T.Iterator_Ptr := Next (T.Iterator_Ptr);
 return Get_Non_Null (T);
  end Get_Next;


The disassembly of Simple_HTable.Get_Next is:

(gdb) up
#1  0x0286f344 in
prj__tree__tree_private_part__projects_htable__get_next () from
/usr/lib/libgnatprj.so.4.4
(gdb) disassemble
Dump of assembler code for function
prj__tree__tree_private_part__projects_htable__get_next:
0x0286f320 prj__tree__tree_private_part__projects_htable__get_next+0:
ldahgp,6(t12)
0x0286f324 prj__tree__tree_private_part__projects_htable__get_next+4:
lda gp,-12160(gp)
0x0286f328 prj__tree__tree_private_part__projects_htable__get_next+8:
lda sp,-16(sp)
0x0286f32c
prj__tree__tree_private_part__projects_htable__get_next+12:ldq
t12,-27200(gp)
0x0286f330
prj__tree__tree_private_part__projects_htable__get_next+16:stq
s0,8(sp)
0x0286f334
prj__tree__tree_private_part__projects_htable__get_next+20:mov
a0,s0
0x0286f338
prj__tree__tree_private_part__projects_htable__get_next+24:stq
ra,0(sp)
0x0286f33c
prj__tree__tree_private_part__projects_htable__get_next+28:mov
a1,a0
0x0286f340
prj__tree__tree_private_part__projects_htable__get_next+32:jsr
ra,(t12),0x286f344
prj__tree__tree_private_part__projects_htable__get_next+36
0x0286f344
prj__tree__tree_private_part__projects_htable__get_next+36:ldah   
gp,6(ra)
0x0286f348
prj__tree__tree_private_part__projects_htable__get_next+40:lda
gp,-12196(gp)
0x0286f34c
prj__tree__tree_private_part__projects_htable__get_next+44:beq
v0,0x286f390 prj__tree__tree_private_part__projects_htable__get_next+112
0x0286f350
prj__tree__tree_private_part__projects_htable__get_next+48:ldl
t0,16(v0)
0x0286f354
prj__tree__tree_private_part__projects_htable__get_next+52:ldl
t3,4(v0)
0x0286f358
prj__tree__tree_private_part__projects_htable__get_next+56:ldl
t2,8(v0)
0x0286f35c
prj__tree__tree_private_part__projects_htable__get_next+60:ldl
t1,12(v0)
0x0286f360
prj__tree__tree_private_part__projects_htable__get_next+64:stl
t3,0(s0)
0x0286f364
prj__tree__tree_private_part__projects_htable__get_next+68:stl
t2,4(s0)
0x0286f368
prj__tree__tree_private_part__projects_htable__get_next+72:stl
t1,8(s0)
0x0286f36c
prj__tree__tree_private_part__projects_htable__get_next+76:stl
t0,12(s0)
0x0286f370
prj__tree__tree_private_part__projects_htable__get_next+80:mov
s0,v0
0x0286f374
prj__tree__tree_private_part__projects_htable__get_next+84:ldq
ra,0(sp)
0x0286f378
prj__tree__tree_private_part__projects_htable__get_next+88:ldq
s0,8(sp)
0x0286f37c
prj__tree__tree_private_part__projects_htable__get_next+92:lda
sp,16(sp)
0x0286f380
prj__tree__tree_private_part__projects_htable__get_next+96:ret
0x0286f384
prj__tree__tree_private_part__projects_htable__get_next+100:   unop
0x0286f388
prj__tree__tree_private_part__projects_htable__get_next+104:   nop
0x0286f38c
prj__tree__tree_private_part__projects_htable__get_next+108:   unop
0x0286f390
prj__tree__tree_private_part__projects_htable__get_next+112:   ldah   
t1,-4(gp)
0x0286f394
prj__tree__tree_private_part__projects_htable__get_next+116:   lda
t0,20296(t1)
0x0286f398
prj__tree__tree_private_part__projects_htable__get_next+120:   ldl
t3,20296(t1)
0x0286f39c
prj__tree__tree_private_part__projects_htable__get_next+124:   ldl
t2,4(t0)
0x0286f3a0
prj__tree__tree_private_part__projects_htable__get_next+128:   ldl
t1,12(t0)
0x0286f3a4
prj__tree__tree_private_part__projects_htable__get_next+132:   ldl
t0,8(t0)
0x0286f3a8
prj__tree__tree_private_part__projects_htable__get_next+136:   stl
t3,0(s0)
0x0286f3ac
prj__tree__tree_private_part__projects_htable__get_next+140:   stl
t2,4(s0)
0x0286f3b0
prj__tree__tree_private_part__projects_htable__get_next+144:   stl
t0,8(s0)
0x0286f3b4
prj__tree__tree_private_part__projects_htable__get_next+148:   stl
t1,12(s0)
0x0286f3b8
prj__tree__tree_private_part__projects_htable__get_next+152:   mov
s0,v0
0x0286f3bc
prj__tree__tree_private_part__projects_htable__get_next+156:   ldq
ra,0(sp)
0x0286f3c0

[Bug ada/42073] New: Infinite loop when parsing a project file, alpha only

2009-11-16 Thread ludovic at ludovic-brenta dot org
On alpha-linux-gnu, gnatmake enters an infinite loop consuming 100% CPU while
parsing this project file:

project GNADE_Common_Build is

   Soversion := External (soversion);

   type Lib_Type is (static, dynamic);

   Libtype : Lib_Type := external (LIBTYPE);

   for Languages use (Ada);

   --  At install time, Source_Dirs must reflect the build source
   --  directories
   for Source_Dirs use (../support);

   --  Library_Dir must be a single directory containing all the
   --  library files (*.ali, *.a, *.so) for all of the gnade packages.
   for Library_Dir use tmp;

   --  Object_Dir is only used at build time; it must be distinct from
   --  the other package object directories, and from the library
   --  directory.
   for Object_Dir use tmp/common-  Libtype;

   for Library_Name use gnadecommon;
   for Library_Kind use Libtype;

   --  Library_Version is not used when Library_Kind is static
   for Library_Version use libgnadecommon.so.  Soversion;

   package Compiler is
  for Default_Switches (Ada) use
(-g,
 -O2,
 -gnat05,
 -gnatfno,
 -gnatwa,
 -gnatVa,
 -fstack-check);
   end Compiler;

end GNADE_Common_Build;

Steps to reproduce:
$ gnatmake -p -j1 -vP2 -Pdebian/gnade_common_build -XLIBTYPE=static 
-Xsoversion=1 -v
GPR_PROJECT_PATH=.:/usr/share/ada/adainclude/
Project_Path_Name_Of (debian/gnade_common_build,
/home/lbrenta/gnade-1.6.2/);
   Trying /home/lbrenta/gnade-1.6.2//debian/gnade_common_build.gpr
Project_Name_From (/home/lbrenta/gnade-1.6.2/debian/gnade_common_build.gpr)
(infinite loop)

gnatmake works with the same project file on all architectures I tried:
{amd64,hppa,i386,ia64,mips,mipsel,powerpc,s390,sparc}-linux-gnu, so this looks
like a code generation bug that affects gnatmake.

I have access to an alpha-linux-gnu machine, please tell me if I can help
narrow this problem down.


-- 
   Summary: Infinite loop when parsing a project file, alpha only
   Product: gcc
   Version: 4.4.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org
 GCC build triplet: alpha-linux-gnu
  GCC host triplet: alpha-linux-gnu
GCC target triplet: alpha-linux-gnu


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



[Bug middle-end/20548] [4.3/4.4/4.5 regression] ACATS c52103x c52104x c52104y segfault

2009-11-07 Thread ludovic at ludovic-brenta dot org


--- Comment #41 from ludovic at ludovic-brenta dot org  2009-11-07 09:45 
---
As I understand it, there is still a patch pending for i386?

Does anyone plan to backport this patch into gcc-4_4-branch?

I am considering applying this patch (up to r153918) in Debian's
gnat-4.4.  Before I do that, I'd like to know whether this would break
ABI compatibility. Consider the following scenario:

gnat-4.4 uploaded without the patch (this is the present situation)
libfoo.so.1 built with -fstack-check
gnat-4.4 updated with the patch (hypothetical situation)
libbar.so.1 built with -fstack-check, links against libfoo.so.1
frobnicate built with -fstack-check, links against libfoo.so.1
shazaam built with -fstack-check, links against libbar.so.1

Will stack checking work in libbar.so.1, frobnicate and shazaam?
Is it necessary to rebuild libfoo.so.1?
Is it necessary to rebuild anything depending on libfoo.so.1?

Thanks for all the hard work!


-- 


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



[Bug ada/41100] [4.4/4.5 regression] Unchecked_Deallocation causes wrong free errors

2009-09-30 Thread ludovic at ludovic-brenta dot org


--- Comment #19 from ludovic at ludovic-brenta dot org  2009-09-30 17:35 
---
I also applied the patch to GCC 4.4 and confirmed that it fixes this particular
bug.  Barring any other blocking problems, Debian will be able to switch to GCC
4.4 as the default Ada compiler.  Thank you all for this quick resolution!


-- 


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



[Bug ada/41100] [4.4/4.5 regression] Unchecked_Deallocation causes wrong free errors

2009-09-25 Thread ludovic at ludovic-brenta dot org


--- Comment #12 from ludovic at ludovic-brenta dot org  2009-09-25 18:15 
---
Eric, in comment #8, did you mean a workaround inside the compiler, or a
workaround in user code? Because the latter is impractical for Debian which
contains more than 2 million lines of Ada, with 350k more lines (PolyORB, known
to trigger the problem) on the way.

Thanks for all your efforts so far!


-- 


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



[Bug ada/41100] [4.4 regression] Unchecked_Deallocation causes double-free errors

2009-09-05 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-09-05 07:34 
---
Created an attachment (id=18499)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18499action=view)
Diff between gnatmake -gnatDg -Pdoublefree.gpr on 32-bit i486 and 64-bit amd64.


-- 


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



[Bug ada/41100] [4.4 regression] Unchecked_Deallocation causes double-free errors

2009-09-05 Thread ludovic at ludovic-brenta dot org


--- Comment #2 from ludovic at ludovic-brenta dot org  2009-09-05 07:38 
---
Created an attachment (id=18500)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18500action=view)
Object and executable files, plus output of -gnatDg, on 32-bit i486.


-- 


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



[Bug ada/41100] [4.4 regression] Unchecked_Deallocation causes double-free errors

2009-09-05 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2009-09-05 07:39 
---
Created an attachment (id=18501)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18501action=view)
Object and executable files, plus output of -gnatDg, on 64-bit x86-64 (amd64). 


-- 


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



[Bug ada/41122] libada multilib string parsing error

2009-08-20 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-08-20 12:02 
---
At first glance: the makefile seems not to be calling awk at all; the first
word is BEGIN; obviously the command BEGIN is not found.


-- 


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



[Bug ada/41122] libada multilib string parsing error

2009-08-20 Thread ludovic at ludovic-brenta dot org


--- Comment #2 from ludovic at ludovic-brenta dot org  2009-08-20 12:04 
---
Actually, the whole awk program, which is presumably between single quotes in
the makefile, is the command which is not found.  The command should be awk.


-- 


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



[Bug ada/41100] New: [4.4 regression] Unchecked_Deallocation causes double-free errors

2009-08-18 Thread ludovic at ludovic-brenta dot org
(Forwarding Debian Bug#542158)

Unchecked_Deallocation of a record extension containing an Unbounded_String
executes incorrectly. Here is a reproducer:

with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
package Double_Free is
   type Test_Base is tagged null record;
   type Test_Class_Access is access all Test_Base'Class;
   type Test_Extension is new Test_Base with record
  Last_Name : Unbounded_String := Null_Unbounded_String;
   end record;
end Double_Free;

   ---

with Ada.Unchecked_Deallocation;
with Double_Free; use Double_Free;
procedure Main is
   procedure Free is new Ada.Unchecked_Deallocation
 (Object = Test_Base'Class,
  Name   = Test_Class_Access);
   Handle : Test_Class_Access := new Test_Extension;
begin
   Free (Handle);
end Main;

$ gnatmake main.adb
$ ./main
*** glibc detected *** main: double free or corruption errors.

valgrind --leak-check=full --show-reachable=yes --leak-resolution=high ./main

==5772== Memcheck, a memory error detector.
==5772== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==5772== Using LibVEX rev 1884, a library for dynamic binary translation.
==5772== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==5772== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation
framework.
==5772== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==5772== For more details, rerun with: -v
==5772==
==5772== Invalid free() / delete / delete[]
==5772==at 0x4C2261F: free (vg_replace_malloc.c:323)
==5772==by 0x50A8D84: __gnat_free (in /usr/lib/libgnat-4.4.so.1)
==5772==by 0x403FC4: _ada_main (in /home/reet/double-free/obj/main)
==5772==by 0x40327B: main (in /home/reet/double-free/obj/main)
==5772==  Address 0x5b3b040 is 16 bytes inside a block of size 136 alloc'd
==5772==at 0x4C2391E: malloc (vg_replace_malloc.c:207)
==5772==by 0x50A8DC7: __gnat_malloc (in /usr/lib/libgnat-4.4.so.1)
==5772==by 0x403EF0: _ada_main (in /home/reet/double-free/obj/main)
==5772==by 0x40327B: main (in /home/reet/double-free/obj/main)
==5772==
==5772== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 8 from 1)
==5772== malloc/free: in use at exit: 136 bytes in 1 blocks.
==5772== malloc/free: 1 allocs, 1 frees, 136 bytes allocated.
==5772== For counts of detected errors, rerun with: -v
==5772== searching for pointers to 1 not-freed blocks.
==5772== checked 203,328 bytes.
==5772==
==5772==
==5772== 136 bytes in 1 blocks are definitely lost in loss record 1 of 1
==5772==at 0x4C2391E: malloc (vg_replace_malloc.c:207)
==5772==by 0x50A8DC7: __gnat_malloc (in /usr/lib/libgnat-4.4.so.1)
==5772==by 0x403EF0: _ada_main (in /home/reet/double-free/obj/main)
==5772==by 0x40327B: main (in /home/reet/double-free/obj/main)
==5772==
==5772== LEAK SUMMARY:
==5772==definitely lost: 136 bytes in 1 blocks.
==5772==  possibly lost: 0 bytes in 0 blocks.
==5772==still reachable: 0 bytes in 0 blocks.
==5772== suppressed: 0 bytes in 0 blocks.

Freeing memory of a base type object (Test_Base) works without problems.
When the unbounded string field (Name) is removed or replaced (e.g. by
an Integer), freeing also works for the type extension.

The code has been tested with the following compiler / arch
combinations:

i386/gnat-4.3  : works
i386/gnat-4.4  : works
amd64/gnat-4.3 : works
amd64/gnat-4.4 : FAILS

This bug hurts PolyORB and prevents us from migrating all Ada packages in
Debian to gnat-4.4.


-- 
   Summary: [4.4 regression] Unchecked_Deallocation causes double-
free errors
   Product: gcc
   Version: 4.4.1
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org
  GCC host triplet: x86_64-linux-gnu


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



[Bug ada/41041] -fwide-exec-charset defaults to UCS-4/UCS-2, not UTF-32/UTF-16

2009-08-18 Thread ludovic at ludovic-brenta dot org


--- Comment #4 from ludovic at ludovic-brenta dot org  2009-08-18 12:01 
---
Please change the component of this PR from ada to c.


-- 


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



[Bug ada/41040] -fwide-exec-charset defaults to UCS-4/UCS-2, not UTF-32/UTF-16

2009-08-18 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-08-18 12:02 
---
Duplicate of 41041, which has the attachments.
Also, please change the component of this PR from ada to c.


-- 


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



[Bug ada/41096] GNAT run-time missing CFLAGS_FOR_TARGET

2009-08-18 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-08-18 12:04 
---
Does that imply that Ada cross-compilers are broken?


-- 


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



[Bug bootstrap/40578] FOPEN double defined used in ada/adaint.h:58

2009-08-18 Thread ludovic at ludovic-brenta dot org


--- Comment #10 from ludovic at ludovic-brenta dot org  2009-08-18 12:10 
---
Does the fix mean that GNAT does not support large files on any platform?


-- 


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



[Bug ada/40986] New: Assert_Failure sinfo.adb:360, error detected at a-unccon.ads:23:27

2009-08-06 Thread ludovic at ludovic-brenta dot org
(forwarding Debian bug #540174)

-- language.ads:
pragma Source_Reference (01, language.ads);

pragma Extend_System(AUX_DEC);
with System;

package Language is

end Language;

-- test.adb:
with System;
with Language;

procedure Test
is
 use System;
 use Language;
begin
   null;
end;

gcc-4.4 -c -I./ -gnato -gnatwl -gnatwauJF -gnatef -g -fno-strict-aliasing
-gnatwA -I- ./test.adb

+===GNAT BUG DETECTED==+
| 4.4.1 (i486-pc-linux-gnu) Assert_Failure sinfo.adb:360   |
| Error detected at a-unccon.ads:23:27 |


-- 
   Summary: Assert_Failure sinfo.adb:360, error detected at a-
unccon.ads:23:27
   Product: gcc
   Version: 4.4.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/40986] [4.3/4.4 regression] Assert_Failure sinfo.adb:360, error detected at a-unccon.ads:23:27

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-08-06 14:41 
---
These work OK:

 /opt/gcc-3.4.5/bin/gcc -c -I./ -gnato -gnatwl -gnatwauJF -gnatef -g 
 -fno-strict-aliasing -gnatwA -I- ./test.adb
 /opt/gcc-4.1.1/bin/gcc -c -I./ -gnato -gnatwl -gnatwauJF -gnatef -g 
 -fno-strict-aliasing -gnatwA -I- ./test.adb

I don't have any 4.2.x at hand.

This version fails:

 /opt/gcc-4.3.0/bin/gcc -c -I./ -gnato -gnatwl -gnatwauJF -gnatef -g
-fno-strict-aliasing -gnatwA -I- ./test.adb
+===GNAT BUG DETECTED==+
| 4.3.0 (i686-pc-linux-gnu) Assert_Failure sinfo.adb:362   |
| Error detected at a-unccon.ads:23:27 |


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

  Known to fail||4.3.0 4.1.1
  Known to work||3.4.5 4.1.1
Summary|Assert_Failure  |[4.3/4.4 regression]
   |sinfo.adb:360, error|Assert_Failure
   |detected at a-  |sinfo.adb:360, error
   |unccon.ads:23:27|detected at a-
   ||unccon.ads:23:27


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



[Bug ada/15606] Legal program rejected, RM 8.2(22)

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #5 from ludovic at ludovic-brenta dot org  2009-08-06 20:27 
---
Confirmed on 4.4.1.


-- 


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



[Bug ada/15611] Invalid program not detected, RM 3.7(11)

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #5 from ludovic at ludovic-brenta dot org  2009-08-06 20:29 
---
Confirmed on 4.4.1.


-- 


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



[Bug ada/15614] Illegal program not detected, RM 12.1(11)

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2009-08-06 20:30 
---
Confirmed on 4.4.1.


-- 


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



[Bug ada/15615] Legal program rejected, derived tagged type in child package doesn't see parent's element

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2009-08-06 20:31 
---
Confirmed on 4.4.1.


-- 


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



[Bug ada/15798] Bug box in Gigi, code=201, on legal program with tasking

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #5 from ludovic at ludovic-brenta dot org  2009-08-06 20:33 
---
Xavier Grave reports:

+===GNAT BUG DETECTED==+
| 4.4.1 (i486-pc-linux-gnu) GCC error: |
| in get_expr_operands, at tree-ssa-operands.c:2072|
| Error detected around test_41.adb:12 |
...
raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:424
gnatmake: test_41.adb compilation error


-- 


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



[Bug ada/15799] Legal program rejected, using 'Base

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #7 from ludovic at ludovic-brenta dot org  2009-08-06 20:39 
---
Confirmed in 4.4.1.


-- 


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



[Bug ada/15800] SIGSEGV on mutually recursive record type declarations

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #4 from ludovic at ludovic-brenta dot org  2009-08-06 20:40 
---
+===GNAT BUG DETECTED==+
| 4.4.1 (i486-pc-linux-gnu) Storage_Error stack overflow (or erroneous memory
access)|
| Error detected at system.ads:153:5   |


-- 


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



[Bug ada/15840] Illegal program not detected, RM 3.7(14)

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2009-08-06 20:43 
---
Confirmed on 4.4.1.


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

  Known to fail|4.0.0   |4.0.0 4.3.0 4.4.1


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



[Bug ada/15843] Illegal program not detected, RM 3.7.2(2)

2009-08-06 Thread ludovic at ludovic-brenta dot org


--- Comment #4 from ludovic at ludovic-brenta dot org  2009-08-06 20:44 
---
Confirmed on 4.4.1.


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

  Known to fail|4.0.0   |4.0.0 4.3.0 4.4.1


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



[Bug ada/40929] New: Illegal program accepted, RM 10.2.1(15.6/2), access type in pure generic package

2009-08-01 Thread ludovic at ludovic-brenta dot org
The compiler incorrectly accepts the following:

generic
package pak1 is
   pragma Pure;
   type T1 is access integer; --ERROR: named access type not allowed in pure
unit
end pak1;

The bug is triggered by the generic keyword.  The error is not detected in an
instantiation of pak1, either.


-- 
   Summary: Illegal program accepted, RM 10.2.1(15.6/2), access type
in pure generic package
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/40930] New: ICE in legal program, record containing a controlled component

2009-08-01 Thread ludovic at ludovic-brenta dot org
with Ada.Finalization;
package pak1 is

   type T1 is private;

   type T2 is record
  a1: T1;
   end record;

   type T2_Access is access T2;

   type T3 is tagged record
  a2: T2_Access;
   end record;

   type T4 is new T3 with null record;

private

   type T1 is new Ada.Finalization.Controlled with null record;

   X: T2_access := new T2; -- line 22
end pak1;

+===GNAT BUG DETECTED==+
| 4.3.0 (i686-unknown-linux-gnu) Assert_Failure namet.adb:687  |

gnatmake -c pak1.ads
gcc-4.3 -c pak1.ads
+===GNAT BUG DETECTED==+
| 4.3.3 (x86_64-pc-linux-gnu) Assert_Failure namet.adb:687 |
| Error detected at pak1.ads:22:20 |


-- 
   Summary: ICE in legal program, record containing a controlled
component
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/40930] ICE in legal program, record containing a controlled component

2009-08-01 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-08-01 14:03 
---
Fixed in 4.4.1 (I only wanted to document the problem.)


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
  Known to fail||4.3.0 4.3.3
  Known to work||4.4.1
 Resolution||FIXED


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



[Bug ada/40931] New: ICE in legal program, Boolean type with user-defined function True

2009-08-01 Thread ludovic at ludovic-brenta dot org
OK, I admit this one is particularly weird.

package P is
   procedure P2;
end P;

package body P is

   type Booleen is new Boolean;
   for Booleen use (-1, 1);

   function True return Booleen is
   begin
  return False;
   end True;

   type B is array (Booleen range False .. True) of Integer;

   procedure P1 is
  A : B;
   begin
  P2;
   end P1;

   procedure P2 is
  A : B; -- line 20
   begin
  P1;
   end P2;

end P;

+===GNAT BUG DETECTED==+
| 4.3.0 (i686-unknown-linux-gnu) in expand_expr_real_1, at expr.c:7290 |
| Error detected around p.adb:20

gnatmake p
gcc-4.3 -c p.adb
+===GNAT BUG DETECTED==+
| 4.3.3 (x86_64-pc-linux-gnu) in expand_expr_real_1, at expr.c:7312|
| Error detected around p.adb:20   |


-- 
   Summary: ICE in legal program, Boolean type with user-defined
function True
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/40931] ICE in legal program, Boolean type with user-defined function True

2009-08-01 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-08-01 14:10 
---
gcc-4.4 -c p.adb
p.adb:14:07: warning: variable A is never read and never assigned
p.adb:20:07: warning: variable A is never read and never assigned
+===GNAT BUG DETECTED==+
| 4.4.1 (x86_64-pc-linux-gnu) in bitmap_first_set_bit, at bitmap.c:770 |
| Error detected around p.adb:25   |

(line 25 is end P;)

This may be a different bug than in 4.3, though.


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

  Known to fail||4.3.0 4.3.3 4.4.1


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



[Bug ada/40932] New: ICE in illegal program, Assert_Failure atree.adb:3815, RM 4.3.1(17.1/2)

2009-08-01 Thread ludovic at ludovic-brenta dot org
A discriminant_association can only contain an expression (RM 3.7.1(3)); in
contrast, a record_component_association can contain either an expression or a
box  (RM 4.3.1(4/2)); however th box is illegal if the component is a
discriminant without a defaut value; this is consistent with a
discriminant_association.  The following program is therefore illegal:

package pak1 is
   type T1(b: boolean) is null record;

   type T2 is record
  a1: T1(false);
   end record;

   x1: constant T2 := (a1 = ); -- line 8

end pak1;

In line 8, the  is illegal because it is part of a
record_component_association for a discriminant that has no default value.

GCC crashes on this illegal program:

+===GNAT BUG DETECTED==+
| 4.3.0 (i686-unknown-linux-gnu) Assert_Failure atree.adb:3816 |

gcc-4.3 -c pak1.ads
+===GNAT BUG DETECTED==+
| 4.3.3 (x86_64-pc-linux-gnu) Assert_Failure atree.adb:3816|
| Error detected at pak1.ads:8:23  |

gcc-4.4 -c pak1.ads
+===GNAT BUG DETECTED==+
| 4.4.1 (x86_64-pc-linux-gnu) Assert_Failure atree.adb:3815|
| Error detected at pak1.ads:8:23  |


-- 
   Summary: ICE in illegal program, Assert_Failure atree.adb:3815,
RM 4.3.1(17.1/2)
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/40933] New: Illegal program accepted, applying predefined operators of Integer on a derived type

2009-08-01 Thread ludovic at ludovic-brenta dot org
The following calls to predefined operators in Standard are all illegal but the
compiler only rejects 3 of them:

package pak1 is
   type my_Int is new integer;

   x1: my_int;
   x2: my_int := standard.mod (x1, 2);
   x3: my_int := standard.rem (x1, 2);
   x4: my_int := standard.abs (x1);   -- line 7
   x5: my_int := standard.+ (x1, 2);
   x6: my_int := standard.- (x1, 2);
   x7: my_int := standard.* (x1, 2);
   x8: my_int := standard./ (x1, 2);
   x9: my_int := standard.+ (x1); -- line 12
   x10: my_int := standard.- (x1);-- line 13
end pak1;

gcc-4.3 -c pak1.ads
pak1.ads:7:26: abs not declared in Standard
pak1.ads:12:26: + not declared in Standard
pak1.ads:13:27: - not declared in Standard

gcc-4.4 -c pak1.ads
pak1.ads:7:26: abs not declared in Standard
pak1.ads:12:26: + not declared in Standard
pak1.ads:13:27: - not declared in Standard

It seems that, for all operators that take two operands, GCC silently (and
wrongly) converts x1 to its parent type, Integer. This does not happen for
unary operators.


-- 
   Summary: Illegal program accepted, applying predefined operators
of Integer on a derived type
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/40025] gnatmake does not honour project files' Library_Version exactly

2009-08-01 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-08-01 14:50 
---
To aggravate the violation of the Law of Least Astonishment, GCC's misbehavior
is even inconsistent:

libfoo.so.1.2 becomes libfoo.so.1
but
libfoo.so.1.2.3 is honored exactly.


-- 


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



[Bug ada/40932] ICE in legal program, Assert_Failure atree.adb:3815, RM 4.3.1(4/2, 19.1/2)

2009-08-01 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-08-01 14:59 
---
I now think my analysis was wrong; a1 is not a discriminant, so the program is
actually legal and the value of x1 should be:

x1 = (a1 = (b = False))

(this does not change anything to the GCC bug, actually.)


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

Summary|ICE in illegal program, |ICE in legal program,
   |Assert_Failure  |Assert_Failure
   |atree.adb:3815, RM  |atree.adb:3815, RM
   |4.3.1(17.1/2)   |4.3.1(4/2, 19.1/2)


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



[Bug ada/40936] New: Assert_Failure atree.adb:884 on illegal code (mixture of protected object and accept of entry family)

2009-08-01 Thread ludovic at ludovic-brenta dot org
(Debian bug #339356, which I realize was never forwarded upstream until now)

procedure gnat_bug is

   type voie is range 1..10;

   protected carrefour is
  entry entree_carrefour (voie);
   end carrefour;

   protected body carrefour is
  entry entree_carrefour (for v in voie)
  when true is
  begin
 accept entree_carrefour(v); -- remove this and you have a valid
program
  end entree_carrefour;
   end carrefour;

begin
   null;
end gnat_bug;

$ gnatmake gnat_bug.adb
gnatgcc -c gnat_bug.adb
+===GNAT BUG DETECTED==+
| 3.15p (Debian 3.15p-16) (i486-pc-linux-gnu) Assert_Failure atree.adb:678 |
| Error detected at gnat_bug.adb:13:10 |

+===GNAT BUG DETECTED==+
| 4.1.2 20061115 (prerelease) (Debian 4.1.1-22) (i486-pc-linux-gnu)|
| Assert_Failure atree.adb:812 |
| Error detected at gnat_bug.adb:13:10 |

gcc-4.3 -c gnat_bug.adb
+===GNAT BUG DETECTED==+
| 4.3.2 (i486-pc-linux-gnu) Assert_Failure atree.adb:886   |
| Error detected at gnat_bug.adb:13:10 |

gcc-4.4 -c gnat_bug.adb
+===GNAT BUG DETECTED==+
| 4.4.1 (i486-pc-linux-gnu) Assert_Failure atree.adb:884   |
| Error detected at gnat_bug.adb:13:10 |


-- 
   Summary: Assert_Failure atree.adb:884 on illegal code (mixture of
protected object and accept of entry family)
   Product: gcc
   Version: 3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/40936] Assert_Failure atree.adb:884 on illegal code (mixture of protected object and accept of entry family)

2009-08-01 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-08-01 22:49 
---
GNAT 3.15p used GCC 2.8.1 as its backend; the bug is that old :)


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

  Known to fail||4.1.2 4.3.3 4.4.1


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



[Bug ada/40185] Segmentation fault on legal program

2009-05-19 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2009-05-19 06:30 
---
There was a typo in the original program that I mistakenly corrected.  This
typo is the trigger for the bug:

with Ada.Unchecked_Conversion;
package Essai is
   type Attributed_Chararcter is record -- line 3
  I : Integer;
   end record;
   type Video_Array is array (Integer range 0 .. 1) of Attributed_Character;
   type Video_Access is access Video_Array;
   function To_VA is new Ada.Unchecked_Conversion (Integer, Video_Access);
   Video : Video_Access := To_VA (0); -- line 9
end Essai;

So, either correcting the typo at line 3 or removing line 9 prevents the
segmentation fault:

gnatmake essai.ads
gcc-4.3 -c essai.ads
gcc-4.3: Internal error: Segmentation fault (program gnat1)
Please submit a full bug report.
See file:///usr/share/doc/gcc-4.3/README.Bugs for instructions.
gnatmake: essai.ads compilation error

Now comment out line 9:
gnatmake essai.ads
gcc-4.3 -c essai.ads
essai.ads:6:56: Attributed_Character is undefined
essai.ads:6:56: possible misspelling of Attributed_Chararcter
gnatmake: essai.ads compilation error

Now restore line 9 and correct the typo at line 3:
gcc-4.3 -c essai.ads
essai.ads:8:04: warning: types for unchecked conversion have different sizes


-- 


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



[Bug ada/40185] New: Segmentation fault on legal program

2009-05-18 Thread ludovic at ludovic-brenta dot org
(Debian bug #519336)

The following illegal program causes gnat1 to crash with a segmentation fault:

with Ada.Unchecked_Conversion;
package Essai is
   type Attributed_Character is record
  I : Integer;
   end record;
   type Video_Array is array (Integer range 0 .. 1) of Attributed_Character;
   type Video_Access is access Video_Array;
   function To_VA is new Ada.Unchecked_Conversion (Integer, Video_Access);
   Video : Video_Access := To_VA (0); -- line 9
end Essai;

/usr/lib/gcc/x86_64-linux-gnu/4.3.3/gnat1 -quiet -dumpbase essai.ads
- -mtune=generic essai.ads -o  tutu.s
segmentation fault

Removing line 9 causes GNAT not to segfault.

Also confirmed on GNAT GPL 2008 on x86_64-linux-gnu and with GCC 4.3.3 on
powerpc-linux-gnu.


-- 
   Summary: Segmentation fault on legal program
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/40025] New: gnatmake does not honour project files' Library_Version exactly

2009-05-05 Thread ludovic at ludovic-brenta dot org
The change introduced in [1] is most annoying; it means that gnatmake now
thinks it knows better than I do what soname my libraries should have. This is
wrong.  As the maintainer of multiple libraries in Debian over multiple
versions and many years, I know better and I insist that gnat honour *exactly*
the soname that I specify in project files (and comply with the Law of Least
Astonishment in the process).

[1] http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01091.html

To aggravate the problem, the behavior depends on the platform, which means
that a project file will produce libraries with different sonames on different
platforms! This makes it very difficult to maintain libraries on multiple
platforms and ensure the sonames change whenever we want them to.

Also, the documentation in 4.4 does not mention the change in behaviour; the
documentation is therefore misleading (hence the severity minor instead of
enhancement).

I am going to patch Debian's gnat-4.4 to revert to the old behaviour.

I am curious to know your rationale behind the change because right now I can
see no good reason for it.  If this rationale is convincing, perhaps the best
would be to make the behaviour controllable from within the project file, i.e.

project Lib is
   package Linker is
  for Library_Major_Minor_Id_Supported use False;
   end Linker;
end Lib;

Please consider this last part a request for enhancement.


-- 
   Summary: gnatmake does not honour project files' Library_Version
exactly
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org
 GCC build triplet: pc=linux-gnu
  GCC host triplet: pc-linux-gnu
GCC target triplet: pc-linux-gnu


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



[Bug ada/15798] Bug box in Gigi, code=201, on legal program with tasking

2008-12-30 Thread ludovic at ludovic-brenta dot org


--- Comment #4 from ludovic at ludovic-brenta dot org  2008-12-30 10:42 
---
Jörgen Tegnér reports:

gnatmake test_41.adb 
gcc-4.3 -c test_41.adb
+===GNAT BUG DETECTED==+
| 4.3.2 (i486-pc-linux-gnu) in gimplify_expr, at gimplify.c:6314   |
| Error detected around test_41.adb:6  |


-- 


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



[Bug ada/38327] New: Rejects legal program involving T'Class'Read

2008-11-30 Thread ludovic at ludovic-brenta dot org
with Ada.Streams;
package pak1 is
   type T3 is abstract new Ada.Streams.Root_Stream_Type with null record;
   type T3_access is access T3;
end pak1;

with pak1;
procedure test is

   type T1 is tagged null record;
   type T2 is new T1 with null record;

   x1: pak1.T3_access;
   x2: T2;
begin
   T1'Class'Read( x1, x2 ); -- line 10
end;

test.adb:10:23: expected type T1 defined at line 4
test.adb:10:23: found type T2 defined at line 5

T1'Class'Read is supposed to dispatch on the tag of x2 because x2 belongs to
T1'Class.  The compiler should accept this program.


-- 
   Summary: Rejects legal program involving T'Class'Read
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/38329] New: Illegal program not detected, private with in a generic package

2008-11-30 Thread ludovic at ludovic-brenta dot org
package pak1 is
end pak1;

package pak1.pak2 is
   x1: integer;
end pak1.pak2;

private with pak1.pak2;
generic
package pak1.pak3 is
   x2 : integer := pak1.pak2.x1;   -- ERROR: pak2 is not visible
   x3 : integer := pak2.x1;-- ERROR: pak2 is not visible
end pak1.pak3;

In Pak1.Pak3, Pak2 should be visible only in the private part, therefore
invisible in the public part. Thus the two declarations (x2 and x3) are
illegal.


-- 
   Summary: Illegal program not detected, private with in a
generic package
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/38330] New: Illegal program not detected, RM 4.3.1(16/2)

2008-11-30 Thread ludovic at ludovic-brenta dot org
generic
  type T1 is tagged private;
   package pak1 is
  type T2 is new T1 with
 record
i,j: integer;
 end record;

  x1: T2 := T2'(2,3);-- ERROR:
  x2: T2 := T2'(T1 with 2,3);-- OK
   end pak1;

The declaration of x1 is illegal because the record_aggregate does not include
all components of x1, violating 4.3.1(16/2).  In this particular case, since
the components inherited from T1 are unknown, the only legal kind of aggregate
is a record_extension_aggregate, as done for x2.

The compiler accepts this illegal program.


-- 
   Summary: Illegal program not detected, RM 4.3.1(16/2)
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/38331] New: Illegal program not detected, = not predefined for class-wide types, ARM 4.5.2(6) and AI05-71

2008-11-30 Thread ludovic at ludovic-brenta dot org
generic
   type Item () is private;
   with function = (L, R : Item) return Boolean is ;
package pak1 is
end pak1;


with pak1;
package pak2 is
   type T is tagged null record;
   package new_pak1a is new pak1 (Item = T'Class);--OK by AI05-71
   package new_pak1b is new pak1 (Item = T'Class, = = =);   --ERROR:
   package new_pak1c is new pak1 (Item = T'Class, = = pak2.=);  --ERROR:
end pak2;

The compiler accepts this program; it should reject new_pak1b and new_pak1c
because function = (L, R : T'Class) does not exist.  The equality operator is
defined only for specific type T that is not limited, and not an anonymous
access type (ARM 4.5.2(6)); class-wide types are not specific per ARM
3.9(3).

The reason why new_pak1a is legal is because of the special rule in AI05-71
which only applies when _not_ specifying an actual for the generic formal =.


-- 
   Summary: Illegal program not detected, = not predefined for
class-wide types, ARM 4.5.2(6) and AI05-71
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/38331] Illegal program not detected, = not predefined for class-wide types, ARM 4.5.2(6) and AI05-71

2008-11-30 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2008-11-30 15:16 
---


*** This bug has been marked as a duplicate of 16094 ***


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||DUPLICATE


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



[Bug ada/16094] Illegal program not detected, RM 3.4.1(5)

2008-11-30 Thread ludovic at ludovic-brenta dot org


--- Comment #2 from ludovic at ludovic-brenta dot org  2008-11-30 15:16 
---
*** Bug 38331 has been marked as a duplicate of this bug. ***


-- 


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



[Bug ada/38332] New: Program fails to raise Constraint_Error as mandated by ARM 4.7(4)

2008-11-30 Thread ludovic at ludovic-brenta dot org
with Text_io; use Text_io;
procedure test1 is
   type Root (K : boolean) is tagged null record;

   type Root_Access is access Root'Class;

   type Child is new Root (K = True) with null record;

   Var : Root_Access;
begin
   begin
  Var := new Child'(K = False);
  put_line(FAILED   Boolean'Image(Var.K));
   exception
  when Constraint_Error = Put_line(PASSED);
   end;
end;

Per ARM 3.7(26), type Root is unconstrained because it has a
known_discriminant_part.  Per 3.4(6), Child is unconstrained because its parent
is unconstrained.  However, its parent_subtype_indication does specify a
constraint.  The allocator new Child'(K = False) uses a qualified_expression
that violates this constraint; therefore its evaluation should raise
Constraint_Error at run time, per 4.7(4).

The program should print PASSED but instead prints FAILED FALSE.

As a quality of implementation issue, it would be nice if GNAT would warn at
compile time of this constraint violation.


-- 
   Summary: Program fails to raise Constraint_Error as mandated by
ARM 4.7(4)
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/38333] New: Illegal program not detected, ARM 6.1(20): pragma Import illegal for abstract subprograms

2008-11-30 Thread ludovic at ludovic-brenta dot org
package pak1 is
   type T1 is abstract tagged null record;
   procedure p1(X : T1) is abstract;
   pragma Import (Ada, p1);--ERROR: can't complete an abstract subprogram
end pak1;

B.1(22) says that an Import pragma must be the completion of a
declaration, and 6.1(20) says that a completion is not allowed for an
abstract subprogram declaration.

The compiler accepts this program.


-- 
   Summary: Illegal program not detected, ARM 6.1(20): pragma Import
illegal for abstract subprograms
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/16095] Illegal program not detected, X'Access of wrong type

2008-11-17 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2008-11-17 22:32 
---
The bug was open at a time when the default mode of GCC was Ada 95; gcc -gnat95
still shows the error messages for line 11 if it is uncommented.

I think the bug is legitimate in Ada 95 mode (and probably in Ada 83 mode,
too).  The example violates 3.10.2(28) because the accessibility level of Y is
deeper than that of the anonymous access type of X.

Looking at the new rules for Ada 2005, I see that 3.10.2(28) has not changed. 
The AARM even says: 28.b/2 {AI95-00230-01} If A is an anonymous
access-to-object type of an access parameter access type, then the view can
never have a deeper accessibility level than A. In the present case, A is the
anonymous type of X and the view is Y, which does have a deeper accessibility
level than A.

Maybe I've missed an implicit type conversion rule, new to Ada 2005, that
permits converting Y'Access to the anonymous access type of X, thereby making
the program legal in -gnat05 mode.  But in -gnat95 mode, I'm pretty confident
the program is illegal.  The error messages for line 11 could be improved quite
a lot, though.

Anyway, I can't think of a situation where X = Y'Access (short of address
representation clauses or pragma Import/Export, where all bets are off anyway),
so I believe that even if the program is legal in Ada 2005, perhaps the
compiler should warn that = will always return False.


-- 


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



[Bug target/37396] bootstrap broken on hppa-linux-gnu trunk with ada (20080906)

2008-10-17 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2008-10-17 13:06 
---
This is a duplicate of PR ada/37034.


-- 


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



[Bug ada/37245] New: GDB reports No definition of var1 in current context. for an existing variable

2008-08-26 Thread ludovic at ludovic-brenta dot org
Initially reported as a GDB bug:
http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-traildatabase=gdbpr=2512

but changing the compiler to GCC 4.2 eliminates the problem, so this is a GCC
bug.  Bug description reproduced here for convenience:

Steps to reproduce:
1) Save the attached file gdb_bug_2.adb
2) gnatmake -ggdb3 -O0 gdb_bug_2
3) gdb ./gdb_bug_2
4) break breakpoint
5) run
6) print var1
7) print var2

Expected results:
6) gdb prints 42 as the value of var1
7) gdb prints 43 as the value of var2

Actual results
6) gdb prints No definition of var1 in current context.
7) gdb prints 43 as the value of var2

More info:
1) Fun2 is not called at all. However, if I remove fun2 from the program gdb is
able to print the value of var1 correctly.
2) Fitg5 does not use its arguments. However, if I change the type of argument
from real_vector to natural gdb is again able to print the value of var1
correctly.
3) Versions of relevant debian packages are

ii  gcc-4.3   4.3.1-9   The GNU
C compiler
ii  gdb   6.8-3 The GNU
Debugger
ii  gnat-4.3  4.3.1-2   The GNU
Ada compiler

4) Please let me know if you can't reproduce the problem, I am happy to provide
more info!


From: Rod Kay [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc:  
Subject: Re: ada/2512: can not find definition of an ada variable with gdb
Date: Tue, 26 Aug 2008 14:02:42 +1000

 Results on Ubuntu 'Hardy' (up-to-date):

 - Linux orth 2.6.24-19-generic #1 SMP Fri Jul 11 23:41:49 UTC 2008 i686 
 GNU/Linux
 - gcc version 4.1.3 20080522 for GNAT GPL 2008 (20080521)
 - GNU gdb 6.6 for GNAT GPL 2008 (20080521) [rev:131253]


 (gdb) print var1
 $1 = 42
  (gdb) print var2
 $2 = 43



Hope this helps ...


 cheers,
 Charlie.

From: Timo Juhani Lindfors [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc:  
Subject: Re: ada/2512: can not find definition of an ada variable with gdb
Date: Tue, 26 Aug 2008 09:42:25 +0300

 ubuntu hardy
 ii  gcc-4.2  4.2.3-2ubuntu7  
The GNU C compiler
 ii  gdb  6.8-1ubuntu2
The GNU Debugger
 ii  gnat 4.2.3-1ubuntu6  
The GNU Ada compiler

 = $1 = 42

 ubuntu hardy
 ii  gcc-4.1  4.1.2-21ubuntu1 
The GNU C compiler
 ii  gdb  6.8-1ubuntu2
The GNU Debugger
 ii  gnat-4.1 4.1.2-16ubuntu3 
The GNU Ada compiler

 = $1 = 1

 debian unstable
 ii  gcc-4.1  4.1.2-23
The GNU C compiler
 ii  gdb  6.8-3   
The GNU Debugger
 ii  gnat-4.1 4.1.2-20
The GNU Ada compiler

 = $1 = 1

 debian unstable
 ii  gcc-snapshot 20080802-1  
A SNAPSHOT of the GNU Compiler Collection

 = No definition of var1 in current context.


-- 
   Summary: GDB reports No definition of var1 in current
context. for an existing variable
   Product: gcc
   Version: 4.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/37245] GDB reports No definition of var1 in current context. for an existing variable

2008-08-26 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2008-08-26 17:43 
---
Created an attachment (id=16151)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16151action=view)
Source file that reproduces the problem


-- 


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



[Bug ada/37245] GDB reports No definition of var1 in current context. for an existing variable

2008-08-26 Thread ludovic at ludovic-brenta dot org


--- Comment #2 from ludovic at ludovic-brenta dot org  2008-08-26 17:49 
---
Note that 4.1.2 fails in a different way than 4.3.1 and trunk.


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

  Known to fail||4.1.2 4.3.1 4.4.0
  Known to work||4.2.3


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



[Bug ada/37110] New: Assert_Failure at atree.adb:886 caused by legal prefixed notation

2008-08-13 Thread ludovic at ludovic-brenta dot org
Subversion revision 127471 in GPS (http://libre.adacore.com/gps) introduced an
internal compiler error in codefix-text_manager.adb:

gcc-4.3 -c -g -O2 -gnatafno -gnatVa -I- -gnatA
/home/lbrenta/src/debian/ram/gnat-gps-4.3~2008.08.09/codefix/src/codefix-text_manager.adb
+===GNAT BUG DETECTED==+
| 4.3.1 (x86_64-pc-linux-gnu) Assert_Failure atree.adb:886 |
| Error detected at codefix-text_manager.adb:4145:34   |

The source line in question is marked below:

   procedure Execute
 (This : Add_Line_Cmd;
  Current_Text : in out Text_Navigator_Abstr'Class;
  Success  : in out Boolean)
   is
  Cursor : constant File_Cursor'Class :=
Current_Text.Get_Current_Cursor (This.Position.all);
   begin
  Success := True;
  Current_Text.Get_File
(This.Position.File_Name).Add_Line (Cursor, This.Line.all); -- line
4145
   end Execute;

Removing the prefixed notation as follows avoids the ICE:

  Get_File
(Current_Text, This.Position.File_Name).Add_Line (Cursor,
This.Line.all);


-- 
   Summary: Assert_Failure at atree.adb:886 caused by legal prefixed
notation
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/31808] cross-built gnattools installs vxaddr2line regardless of target triplet

2008-05-13 Thread ludovic at ludovic-brenta dot org


--- Comment #5 from ludovic at ludovic-brenta dot org  2008-05-13 08:29 
---
Could someone please set the target milestone for this bug? Thanks.


-- 


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



[Bug ada/31808] cross-built gnattools installs vxaddr2line regardless of target triplet

2008-05-13 Thread ludovic at ludovic-brenta dot org


--- Comment #6 from ludovic at ludovic-brenta dot org  2008-05-13 08:30 
---
Also the bug should not remain tagged as INVALID.


-- 


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



[Bug ada/32181] Legal program executes incorrectly, RM 3.4(27)

2008-04-24 Thread ludovic at ludovic-brenta dot org


--- Comment #6 from ludovic at ludovic-brenta dot org  2008-04-24 09:55 
---
(In reply to comment #4)

Anh Vo, you are perfectly right up to a point: Pak1.Eq returns True and Pak2.Eq
returns False, therefore comparing the two results yields False.  Where you are
wrong is where you think Pak2.Eq is correct in returning False.  This is the
bug.  Pak2.Eq should return True.

To explain another way: ARM 3.4(27) defines precisely the behaviour of a call
to an inherited subprogram. Pak2.Eq is inherited and not overridden, so 3.4(27)
applies. Per ARM 3.4(27), calling

Pak2.Eq (Z1, Z2)

is by definition equivalent to calling

Pak1.Eq (Pak1.T1 (Z1), Pak1.T1 (Z2))

Therefore the two calls must yield the same result (i.e. True).

The test case shows clearly that this is not the case, i.e. GNAT has a bug.


-- 


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



[Bug ada/32181] Legal program executes incorrectly, RM 3.4(27)

2008-04-23 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2008-04-23 23:47 
---
Exactly. The quoted portion of the ARM says that Pak2.Eq (Z1, Z2) should
implicitly convert Z1 and Z2 to type T1, then call Pak1.Eq, then return True. 
Instead, it returns False as though GNAT synthesised a new

function Eq (X, Y : T2) return Boolean renames =;

inside of Pak2, where = is the predefined equality operator for T2.  This
synthetic function overrides Pak1.Eq without the programmer's consent.


-- 


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



[Bug ada/35984] New: Illegal program not detected, RM 4.6(24/2)

2008-04-20 Thread ludovic at ludovic-brenta dot org
package pak1 is
   type T1 is interface;
   type T2 is tagged null record;
   x1: access T1'Class;
   x2: T2 := T2(T2'class(x1.all));  --OK
   x3: T2 := T2(x1.all);--ERROR: not a valid type conversion
end pak1;

The declaration of x2 is a legal type conversion, because x1.all
and T2'class both have class-wide types, so RM 4.6(21/2) applies.

But the declaration of x3 isn't a legal type conversion because
T2 isn't classwide, so RM 4.6(24/2) applies instead, which doesn't
offer any reason for this to be legal.

GCC 4.3 fails to diagnose the violation of 4.6(24/2), instead
warning about null access values:

gcc-4.3 -c -gnat05 pak1.ads
pak1.ads:5:26: warning: null value not allowed here
pak1.ads:5:26: warning: Constraint_Error will be raised at run time
pak1.ads:6:17: warning: null value not allowed here
pak1.ads:6:17: warning: Constraint_Error will be raised at run time

Here, gcc seems to propagate x1's null value even before considering
whether the type conversions are legal.


-- 
   Summary: Illegal program not detected, RM 4.6(24/2)
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error

2008-04-09 Thread ludovic at ludovic-brenta dot org


--- Comment #6 from ludovic at ludovic-brenta dot org  2008-04-09 20:10 
---
Reduced test case:

package Observers is
  type Observer is tagged null record;
  type Observer_Access is access all Observers.Observer'Class;
end Observers;

limited with Observers;
with Ada.Containers.Doubly_Linked_Lists;
package Subjects is
  function Equals(Left, Right : access Observers.Observer) return Boolean;
  package Observer_Lists is new
Ada.Containers.Doubly_Linked_Lists(Observers.Observer_Access, Equals);
end Subjects;

with Observers; -- this line triggers the bug
package body Subjects is
   function Equals(Left, Right : access Observers.Observer) return Boolean is
   begin
  return False;
   end Equals;
end Subjects;

With the line that triggers the bug:

gcc-4.1 -c -gnat05 subjects.adb
+===GNAT BUG DETECTED==+
| 4.1.3 20070518 (prerelease) (Debian 4.1.2-8) (x86_64-pc-linux-gnu)   |
| Assert_Failure atree.adb:812 |
| Error detected at subjects.ads:8:3   |

gcc-4.3 -c -gnat05 subjects.adb
+===GNAT BUG DETECTED==+
| 4.3.1 20080401 (prerelease) (x86_64-pc-linux-gnu) Assert_Failure
atree.adb:886|
| Error detected at subjects.ads:8:3   |


Without the line that triggers the bug:

gcc-4.1 -c -gnat05 subjects.adb
subjects.ads:9:49: premature use of incomplete type
subjects.ads:9:49: instantiation abandoned

gcc-4.3 -c -gnat05 subjects.adb
subjects.ads:9:49: premature use of incomplete type
subjects.ads:9:49: instantiation abandoned


-- 


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



[Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error

2008-04-09 Thread ludovic at ludovic-brenta dot org


--- Comment #7 from ludovic at ludovic-brenta dot org  2008-04-09 20:25 
---
Further reduced test case: replace observers.ads with:

package Observers is
   type Observer is new Integer;
   type Observer_Access is access Observer;
end Observers;

and the bug is still there.


-- 


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



[Bug ada/35829] Please add support for mips and mipsel in gnat

2008-04-04 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2008-04-04 23:44 
---
This is the same patch that Aurelien Jarno submitted here:

http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00026.html

I suggest closing this bug, as the patch has been committed to trunk.  (I don't
have permission to do so myself).


-- 


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



[Bug ada/35792] New: Illegal program not detected, RM 3.10.1(4/2)

2008-04-01 Thread ludovic at ludovic-brenta dot org
If an incomplete_type_declaration includes the reserved word tagged,
then a full_type_declaration that completes it shall declare a tagged
type.

The error for T3 is detected, but not T1 or T2.

package pak1 is
   type T1 is tagged;
   type T2 is tagged;
   type T3 is tagged;
   protected type T1 is end T1;
   task type T2;
   type T3 is null record;
end pak1;

gnatmake -gnat05 pak1
gcc-4.1 -c -gnat05 pak1.ads
pak1.ads:4:09: full declaration of type T3 defined at line 7 must be tagged

gnatmake -gnat05 pak1
gcc-4.3 -c -gnat05 pak1.ads
pak1.ads:4:09: full declaration of type T3 defined at line 7 must be tagged


-- 
   Summary: Illegal program not detected, RM 3.10.1(4/2)
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/35793] New: Illegal program not detected, RM 3.8(12)

2008-04-01 Thread ludovic at ludovic-brenta dot org
RM 3.8(12):
If the discriminant is used to define the constraint of a component, ...
then its name shall appear alone as a direct_name (not as part of ...
an expanded name).

The error for x3 is detected, but not x1.

package pak1 is
   type T1(n: natural) is null record;

   type T2(n: natural) is record
x1: string (1 .. T2.n);
x2: string (1 .. n);
x3: T1(T2.n);
x4: T1(n);
end record;
end pak1;

gcc-4.1 -c -gnat05 pak1.ads
pak1.ads:7:18: discriminant must appear alone as a direct name

gcc-4.3 -c -gnat05 pak1.ads
pak1.ads:7:18: discriminant must appear alone as a direct name


-- 
   Summary: Illegal program not detected, RM 3.8(12)
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/35794] New: Illegal program not detected, RM 4.1.3(9.2/2)

2008-04-01 Thread ludovic at ludovic-brenta dot org
-- RM 4.1.3(9.2/2):
-- The selector_name shall resolve to denote a view of a subprogram
-- declared immediately within the declarative region in which an
-- ancestor of the type T is declared.

package pak1 is

   package pak2 is
  type T1 is tagged private;
   private
  type T1 is tagged null record;
  function f1(x: T1) return integer;
   end pak2;

   x1: pak2.T1;
   x2: integer := x1.f1;   -- ERROR: f1 not declared in visible part of pak2
end pak1;

gcc-4.1 -c -gnat05 pak1.ads
cannot generate code for file pak1.ads (package spec)
to check package spec for errors, use -gnatc


-- 
   Summary: Illegal program not detected, RM 4.1.3(9.2/2)
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/35794] Illegal program not detected, RM 4.1.3(9.2/2)

2008-04-01 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2008-04-01 21:26 
---
gcc-4.3 -c -gnat05 pak1.ads
pak1.ads:11:21: no selector f1 for private type T1 defined at line 4


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
  Known to fail||4.1.2
  Known to work||4.3.0
 Resolution||FIXED


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



[Bug ada/35645] New: ICE in gimplify_expr, at gimplify.c:6120

2008-03-19 Thread ludovic at ludovic-brenta dot org
Not sure the declaration below is legal, but it ICEs anyway.

package pak1 is
   type T1(x1: integer) is record
  x2: integer := T1.x1;
   end record;
end pak1;

gcc-4.1 -c pak1.ads
+===GNAT BUG DETECTED==+
| 4.1.3 20070518 (prerelease) (Debian 4.1.2-8) (x86_64-pc-linux-gnu) GCC
error:|
| in gimplify_expr, at gimplify.c:4519 |
| No source file position information available|

+===GNAT BUG DETECTED==+
| 4.2.2 (i686-unknown-linux-gnu) in gimplify_expr, at gimplify.c:5888  |
| No source file position information available|

gcc-4.3 -c pak1.ads
+===GNAT BUG DETECTED==+
| 4.3.1 20080309 (prerelease) (x86_64-pc-linux-gnu) GCC error: |
| in gimplify_expr, at gimplify.c:6120 |
| Error detected around pak1.ads:3 |


-- 
   Summary: ICE in gimplify_expr, at gimplify.c:6120
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/34496] [4.2/4.3 Regression] prefixed notation allows changing the value of a constant

2008-03-19 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2008-03-20 01:01 
---
Still present in 4.3.0:

$ gnatmake -gnat05 test1
gcc-4.3 -c -gnat05 test1.adb
gnatbind -x test1.ali
gnatlink test1.ali

$ ./test1
 3

raised STORAGE_ERROR : stack overflow (or erroneous memory access)

I am not concerned about the stack overflow because the program is illegal
anyway.


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

 Status|WAITING |UNCONFIRMED
  Known to fail||4.2.2 4.3.0
Summary|[4.2 Regression] prefixed   |[4.2/4.3 Regression]
   |notation allows changing the|prefixed notation allows
   |value of a constant |changing the value of a
   ||constant


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



[Bug ada/35464] New: warning: condition is always False not issued inside generics

2008-03-04 Thread ludovic at ludovic-brenta dot org
With -gnatwa, GNAT emits very useful warnings; one of them is condition is
always False.  However, GNAT does not emit this warning when it applies inside
a generic, or a generic instantiation.  The following test case demonstrates
the problem.

procedure Condition_Is_Always_False is

   type T is range 3 .. 4;

   function F return T is
   begin
  return T'First;
   end F;

   procedure OK is
  C : constant T := F;
   begin
  if C = 1 then -- warning: condition is always False
 null;
  end if;
   end OK;

   generic
   procedure NOK_G;

   procedure NOK_G is
  C : constant T := F; -- T'First instead of F gives the warning
   begin
  if C = 1 then -- no warning
 null;
  end if;
   end NOK_G;

   procedure NOK is new NOK_G;

begin -- Condition_Is_Always_False
   OK;
   NOK;
end  Condition_Is_Always_False;

gcc-4.1 -c -gnatwa condition_is_always_false.adb
condition_is_always_false.adb:13:12: warning: condition is always False
gnatbind -x condition_is_always_false.ali
gnatlink condition_is_always_false.ali

If, however, C is initialized directly with T'First (a static value) instead of
the result of F (a static function), GNAT gives the warning even inside the
generic.


-- 
   Summary: warning: condition is always False not issued inside
generics
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/33420] [Ada] crash passing SomeFunctionReturningPointer.all as function argument

2008-02-06 Thread ludovic at ludovic-brenta dot org


--- Comment #5 from ludovic at ludovic-brenta dot org  2008-02-06 13:42 
---
Since the test case uses only Ada 95 features, what does the compiler say with
-gnat95?


-- 


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



[Bug ada/15610] Invalid program not detected, generic formal parameter hides declared item

2008-01-12 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2008-01-12 13:52 
---
By adding one line to the test case, we can see the bug reappears:

procedure Test_244942 is
   function f1 return integer is begin return 1; end f1;

   generic
  with function foo return integer;
   package pak1 is
  type color is (foo);
  type color2 is (foo);  -- this line was added
   end pak1;

   package new_pak1 is new pak1(f1);
   i: integer := new_pak1.foo;   -- ERROR: integer vs. color
begin
   null;
end Test_244942;

gnatmake test_244942
gcc-4.1 -c test_244942.adb
gnatbind -x test_244942.ali
gnatlink test_244942.ali

gcc-4.2 -c test_244942.adb
gnatbind -x test_244942.ali
gnatlink test_244942.ali


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
  Known to fail||3.4.0 4.1.2 4.2.2
 Resolution|FIXED   |


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



[Bug ada/34508] Legal program rejected, RM 3.7(26)

2007-12-18 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2007-12-18 12:10 
---
Actually, the declaration of x2 is illegal; GNAT is correct in rejecting it. 
The declaration of T3 is legal and incorrectly rejected.  The error messages
are:

gnatmake -gnat05 pak1-pak3.ads
gcc-4.1 -c -gnat05 pak1-pak3.ads
pak1-pak3.ads:3:15: invalid constraint: type has no discriminant
pak1-pak3.ads:4:14: no value supplied for discriminant D

(see also PR ada/34507).


-- 


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



[Bug ada/34504] New: Legal program runs incorrectly, dynamic dispatching with interfaces, RM 3.9.2(5/2, 20/2), 3.9.4(1/2)

2007-12-17 Thread ludovic at ludovic-brenta dot org
--   Newsgroups: comp.lang.ada
--   From: Peter C. Chapin [EMAIL PROTECTED]
--   Date: Thu, 13 Dec 2007 07:20:46 -0500
--   Subject: Q about finalization and interfaces.
--
--   I'm trying to understand the interaction between controlled types,
--   interfaces, and class-wide dispatching. Accordingly I wrote the
--   following program, which I will present in sections. First the package
--   specification:

   with Ada.Finalization;
   package Check_Package is

  type B is interface;
  procedure Do_Stuff( Thing : in B ) is abstract;

  type D is new Ada.Finalization.Controlled and B with
 record
X : Integer := 0;
 end record;

  overriding procedure Do_Stuff( Thing : in D );
  overriding procedure Finalize( Thing : in out D );

   end Check_Package;

--   The idea is that I want to build a derivation class rooted on the B
--   interface with some of the types in that class (such as D) being
--   controlled. The corresponding body prints out a few messages to help
--   track what is happening. Note that I use the X component as a kind of
--   object ID number.

   with Ada.Text_IO; use Ada.Text_IO;
   with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
   package body Check_Package is

  procedure Do_Stuff( Thing : in D ) is
  begin
 Put(Do_Stuff( Thing : in D ) = );
 Put(Thing.X);
 New_Line;
  end Do_Stuff;

  procedure Finalize( Thing : in out D ) is
  begin
 Put(Finalize( Thing : in out D ) = );
 Put(Thing.X);
 New_Line;
  end Finalize;

   end Check_Package;

--   Now the test program that exercises the above code looks like this:

   with Check_Package; use Check_Package;
   procedure Check is
  Object : D;
  Some_Thing : B'Class := Object;
   begin
  Object.X := -1;
  Do_Stuff(Some_Thing);
   end Check;

--   Using GNAT GPL 2007 I get the following output:
--
--   Finalize( Thing : in out D ) =   0
--   Finalize( Thing : in out D ) =  -1
--
--   My interpretation is that Object is copied (with the default ID value
--   of zero) when Some_Thing is initialized; Object's ID is then modified.
--   Both Object and its copy are finalized when the program ends. But...
--   what happened to my call to Do_Stuff?? I expected that call to dispatch
--   on Some_Thing and invoke the Do_Stuff for type D. What am I
--   misunderstanding?
--
--   Thanks in advance!
--
--   Peter


-- 
   Summary: Legal program runs incorrectly, dynamic dispatching with
interfaces, RM 3.9.2(5/2, 20/2), 3.9.4(1/2)
   Product: gcc
   Version: 4.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/34504] Legal program runs incorrectly, dynamic dispatching with interfaces, RM 3.9.2(5/2, 20/2), 3.9.4(1/2)

2007-12-17 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2007-12-17 09:19 
---
Confirmed on GCC 4.1.2 and 4.2.2.


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

  Known to fail||4.1.2 4.2.2


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



[Bug ada/34507] New: Bug box, Assert_Failure einfo.adb:814 on illegal Ada 2005 program

2007-12-17 Thread ludovic at ludovic-brenta dot org
package pak1 is
   type T1() is tagged limited private;
private
   type T1(D: integer) is tagged limited null record;
end pak1;

with pak1;
package pak2 is
   type T2 is new pak1.T1 with null record;   -- ERROR: invalid constraint
   x1: T2 := (pak1.T1 with null record); -- line 5
end pak2;

package pak1.pak3 is
   type T3 is new pak1.T1 with null record;   -- ERROR: invalid constraint
   x2: T3 := (pak1.T1 with null record);
end pak1.pak3;

GCC 4.1:

gnatmake -gnat05 pak2
gcc-4.1 -c -gnat05 pak2.ads
+===GNAT BUG DETECTED==+
| 4.1.3 20070518 (prerelease) (Debian 4.1.2-8) (x86_64-pc-linux-gnu)   |
| Assert_Failure einfo.adb:813 |
| Error detected at pak2.ads:5:4   |

gnatmake -gnat05 pak1-pak3.ads
gcc-4.1 -c -gnat05 pak1-pak3.ads
pak1-pak3.ads:3:15: invalid constraint: type has no discriminant
pak1-pak3.ads:4:14: no value supplied for discriminant D

GCC 4.2:

% gcc -c pak2.ads
+===GNAT BUG DETECTED==+
| 4.2.2 (i686-unknown-linux-gnu) Assert_Failure einfo.adb:814  |
| Error detected at pak2.ads:5:4   |

% gcc -c pak1-pak3.ads
pak1-pak3.ads:3:15: invalid constraint: type has no discriminant
pak1-pak3.ads:4:14: no value supplied for discriminant D

As can be seen, Pak1.Pak3 and Pak2 are identical but only Pak2 triggers the
bug.


-- 
   Summary: Bug box, Assert_Failure einfo.adb:814 on illegal Ada
2005 program
   Product: gcc
   Version: 4.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/34507] Bug box, Assert_Failure einfo.adb:814 on illegal Ada 2005 program

2007-12-17 Thread ludovic at ludovic-brenta dot org


--- Comment #1 from ludovic at ludovic-brenta dot org  2007-12-17 09:30 
---
The initial test case was incorrect regarding the lines marked ERROR.
Here's a corrected version:

package pak1 is
   type T1() is tagged limited private;
private
   type T1(D: integer) is tagged limited null record;
end pak1;

with pak1;
package pak2 is
   type T2 is new pak1.T1 with null record;   -- legal
   x1: T2 := (pak1.T1 with null record);  -- ERROR, but accepted
end pak2;

package pak1.pak3 is
   type T3 is new pak1.T1 with null record;   -- legal, but rejected
   x2: T3 := (pak1.T1 with null record);  -- legal, but rejected
end pak1.pak3;

So in fact, Pak1.Pak3 also triggers a bug, albeit a different one from Pak2. 
I'll file it separately.


-- 


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



[Bug ada/34508] New: Legal program rejected, RM 3.7(26)

2007-12-17 Thread ludovic at ludovic-brenta dot org
package pak1 is
   type T1() is tagged limited private;
private
   type T1(D: integer) is tagged limited null record;
end pak1;

package pak1.pak3 is
   type T3 is new pak1.T1 with null record;   -- legal, but rejected
   x2: T3 := (pak1.T1 with null record);  -- legal, but rejected
end pak1.pak3;

RM 3.7(26) states: A type declared without a discriminant part has no
discriminants, unless it is a derived type; if derived, such a type has the
same sort of discriminants (known, unknown, or none) as its parent (or
ancestor) type.  Therefore, the declaration of T3 is legal and T3 has unknown
discriminants.


-- 
   Summary: Legal program rejected, RM 3.7(26)
   Product: gcc
   Version: 4.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/34509] New: Bug box in expand_expr_real_1, at expr.c:6711 on legal program

2007-12-17 Thread ludovic at ludovic-brenta dot org
package pak1 is
   pragma elaborate_body;

   subtype myint is integer range 1..10;

   type T1(n: myint) is
   record
  s: string(1..n);
   end record;

   max: constant myint;
   pragma import(C, max);

   subtype T2 is T1 (max);

end pak1;

package body pak1 is

   function f1 return T2 is
  x1: T2;
   begin
  return x1;
   end f1;

   function f2 return T2 is
  x2: T2;
   begin
  return x2;
   end f2;

end pak1;


gnatmake -gnat05 pak1
gcc-4.1 -c -gnat05 pak1.adb
+===GNAT BUG DETECTED==+
| 4.1.3 20070518 (prerelease) (Debian 4.1.2-8) (x86_64-pc-linux-gnu) GCC
error:|
| in expand_expr_real_1, at expr.c:6711|
| Error detected at s-secsta.ads:64:14 |

+===GNAT BUG DETECTED==+
| 4.2.2 (i686-unknown-linux-gnu) in expand_expr_real_1, at expr.c:6930 |
| Error detected at s-secsta.ads:64:14 |


-- 
   Summary: Bug box in expand_expr_real_1, at expr.c:6711 on legal
program
   Product: gcc
   Version: 4.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/34510] New: Legal program rejected, explicit type conversion between two unrelated class-wide types, RM 4.6(21/2,23.1/2)

2007-12-17 Thread ludovic at ludovic-brenta dot org
-- RM 4.6(21,23.1):
--
--If there is a type that is an ancestor of both the target type and the
--operand type, or both types are class-wide types, then at least one of
--the following rules shall apply:
--
--...
--
---- The operand and target types shall both be class-wide types and
--   the specific type associated with at least one of them shall be
--   an interface type.

with ada.finalization;
package pak1 is
   pragma elaborate_body;
   type T1 is interface;

   type T2 is new ada.finalization.Controlled with null record;
end pak1;

package body pak1 is
   procedure p1(x1: T1'Class) is
   x2: T2'class := T2'class(x1);
   begin
   null;
   end p1;
end pak1;

gnatmake -gnat05 pak1
gcc-4.1 -c -gnat05 pak1.adb
pak1.adb:4:22: invalid tagged conversion, not compatible with type T1'class
defined at pak1.ads:16

See also 4.6(23.c/2) in the AARM. A run-time check is needed at this point.


-- 
   Summary: Legal program rejected, explicit type conversion between
two unrelated class-wide types, RM 4.6(21/2,23.1/2)
   Product: gcc
   Version: 4.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/34511] New: Legal program rejected, RM 12.6(10): generic formal subprogram with implicit default

2007-12-17 Thread ludovic at ludovic-brenta dot org
-- RM 12.6(10):
-- If a generic unit has a subprogram_default specified by a box, and
-- the corresponding actual parameter is omitted, then it is
-- equivalent to an explicit actual parameter that is a usage name
-- identical to the defining name of the formal.

package pak1 is
   procedure p1;
end pak1;

package body pak1 is

   procedure p1 is
   begin
  null;
   end p1;

end pak1;

generic
   with procedure p1 is ;
package pak1.pak2 is
end pak1.pak2;

with pak1.pak2;
package pak1.pak2a is new pak1.pak2; -- OK, but Gnat rejects

with pak1.pak2;
package pak1.pak2b is new pak1.pak2(p1); -- Gnat allows

gnatmake pak1-pak2a
gcc-4.1 -c pak1-pak2a.ads
pak1-pak2a.ads:3:01: p1 is not visible
pak1-pak2a.ads:3:01: non-visible declaration at pak1-pak2.ads:3
pak1-pak2a.ads:3:01: non-visible declaration at pak1.ads:8

Same in 4.2.2.


-- 
   Summary: Legal program rejected, RM 12.6(10): generic formal
subprogram with implicit default
   Product: gcc
   Version: 4.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug middle-end/34400] [4.3 regression] bad interaction between DF and SJLJ exceptions

2007-12-17 Thread ludovic at ludovic-brenta dot org


--- Comment #30 from ludovic at ludovic-brenta dot org  2007-12-17 10:52 
---
(In reply to comment #28)
 Created an attachment (id=14778)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14778action=view) [edit]
 Change worklist solver to double queue algorithm

I would like to try this patch: does it invalidate the patch from comment #17,
or should I apply both?


-- 


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



[Bug middle-end/34400] [4.3 regression] bad interaction between DF and SJLJ exceptions

2007-12-17 Thread ludovic at ludovic-brenta dot org


--- Comment #35 from ludovic at ludovic-brenta dot org  2007-12-17 16:16 
---
Created an attachment (id=14784)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14784action=view)
Results of gnat1 -ftime-report [...] g-catiio.adb with SJLJ exceptions

$ time ../../gnat1 -ftime-report -dumpbase g-catiio.adb -O2 -W -Wall -g -gnatpg
-mtune=generic -gnatO g-catiio.o g-catiio.adb  /tmp/pr34400-time-report.txt
21

real0m54.039s
user0m53.647s
sys 0m0.332s

With df_hack2, df_hack3 and df_double_queue_worklist applied.


-- 


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



[Bug ada/34496] New: [4.2 regression] prefixed notation allows changing the value of a constant

2007-12-16 Thread ludovic at ludovic-brenta dot org
with text_io;
procedure test1 is
   package pak3 is

  type T1 is tagged record
 x0: integer;
  end record;

  procedure p1 (x1: access T1; val: integer);

  x2: aliased constant T1 := (x0 = 3);
  x3: access constant T1 := x2'access;

   end pak3;

   package body pak3 is
  procedure p1 (x1: access T1; val: integer) is
  begin
 x1.x0 := val;
  end p1;
   end pak3;

begin
   text_io.put_line(integer'image(pak3.x2.x0));
   pak3.x2.p1(5); -- line 25
   text_io.put_line(integer'image(pak3.x2.x0));
   pak3.x3.all.p1(7); -- line 27
-- pak3.x3.p1(7);   -- this one is detected
   text_io.put_line(integer'image(pak3.x2.x0));
end test1;

GCC 4.1.2:

$ gnatmake -gnat05 test1
gcc-4.1 -c -gnat05 test1.adb
test1.adb:25:08: expected an access type with designated type T1 defined at
line 5
test1.adb:25:08: found type T1 defined at line 5
test1.adb:27:12: expected an access type with designated type T1 defined at
line 5
test1.adb:27:12: found type T1 defined at line 5

The error messages are not very good (they should say something like found
type constant T1) but the program is indeed illegal.

GCC 4.2.2:

$ gnatmake -gnat05 test1
gcc-4.2 -c -gnat05 test1.adb
gnatbind -x test1.ali
gnatlink test1.ali
$ ./test1
 3
 5
 7


-- 
   Summary: [4.2 regression] prefixed notation allows changing the
value of a constant
   Product: gcc
   Version: 4.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



[Bug ada/15605] invalid program not detected, RM 8.3(22)

2007-12-16 Thread ludovic at ludovic-brenta dot org


--- Comment #4 from ludovic at ludovic-brenta dot org  2007-12-16 14:04 
---
As of 4.2.2, only the first of the two errors is detected.  Reopening.  The
second error violates 8.5.4(6): A name that denotes a formal parameter of the
subprogram_specification is not allowed within the callable_entity_name. and
is not diagnosed.

GCC 4.1.2:

gnatmake -gnat05 pak1
gcc-4.1 -c -gnat05 pak1.ads
pak1.ads:8:15: formal parameter list cannot be used before end of
specification

GCC 4.2.2:

gnatmake -gnat05 pak1
gcc-4.2 -c -gnat05 pak1.ads
pak1.ads:8:15: formal parameter list cannot be used before end of
specification


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


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



[Bug middle-end/34400] [4.3 regression] gnat1 takes too long to compile g-catiio.adb with SJLJ exceptions

2007-12-09 Thread ludovic at ludovic-brenta dot org


--- Comment #4 from ludovic at ludovic-brenta dot org  2007-12-09 20:48 
---
First, read http://gcc.gnu.org/ml/gcc/2006-10/msg00303.html for a
little background information on ZCX and SJLJ in Ada.

Steps to reproduce:

- bootstrap with ada enabled (i.e. ../gcc/configure
  --enable-languages=ada)

$ rm gcc/ada/rts/g-catiio.{ali,o}
$ cd gcc/ada/rts
$ time ../../gnat1 -quiet -dumpbase g-catiio.adb -O2 -W -Wall -g -gnatpg
-mtune=generic -gnatO g-catiio.o g-catiio.adb

This will show you a reference time building the ZCX version.  

In my case (2.0 Ghz AMD Turion 64):
real0m4.238s
user0m3.664s
sys 0m0.060s

Now, edit gcc/ada/rts/system.ads; change ZCX_By_Default from True to
False.  This switches the run-time library to SJLJ.  Then, compile
again:

$ rm gcc/ada/rts/g-catiio.{ali,o}
$ cd gcc/ada/rts
$ time ../../gnat1 -quiet -dumpbase g-catiio.adb -O2 -W -Wall -g -gnatpg
-mtune=generic -gnatO g-catiio.o g-catiio.adb

In my case:
real275m44.310s
user271m41.839s
sys 0m9.585s


-- 

ludovic at ludovic-brenta dot org changed:

   What|Removed |Added

 Status|WAITING |UNCONFIRMED


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



[Bug ada/34400] New: [4.3 regression] gnat1 takes too long to compile g-catiio.adb with SJLJ exceptions

2007-12-08 Thread ludovic at ludovic-brenta dot org
The thread starts here: http://gcc.gnu.org/ml/gcc/2007-11/msg00791.html

In addition, I observe the same behaviour when building a native, SJLJ version
of libgnat on x86_64.

Krister Walfridsson says: The problem was introduced by revision 125624 (the
dataflow merge)..


-- 
   Summary: [4.3 regression] gnat1 takes too long to compile g-
catiio.adb with SJLJ exceptions
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org


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



  1   2   >