(From the Debian BTS): -- fails in 3.15p, 3.4, and 4.0 -- RM 6.4.1(13) -- RM 9.5.1(3) -- RM 9.5.3(8) with text_io; use text_io; procedure Test_306834 is type intp is access all integer; i: aliased integer := 3; x1: intp;
procedure p1(x: out intp) is begin null; end; protected type T1 is entry e1 (x: out intp); procedure p2(x: out intp); end T1; protected body T1 is entry e1 (x: out intp) when true is begin null; end e1; procedure p2(x: out intp) is begin null; end; end T1; task type T2 is entry e1 (x: out intp); end T2; task body T2 is begin for i in 1..2 loop accept e1 (x: out intp) do begin null; end; end e1; end loop; end T2; pt: T1; tt: T2; procedure doit(x2: intp) is procedure check is begin if x1 = x2 then put_line("PASSED"); else put_line("FAILED"); end if; x1 := x2; end; begin x1 := x2; p1(x1); check; pt.p2(x1); check; pt.e1(x1); check; tt.e1(x1); check; end; begin doit(null); doit(i'access); end Test_306834; The program should print "PASSED" 8 times, but instead prints "PASSED" 6 times and then "FAILED" two times. -- Ludovic Brenta. -- Summary: Wrong code generated with -O -fPIC Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ludovic dot brenta at insalien dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21489