From: sbelmont700@gmail.com
Subject: A Gnother Gnasty bug
Date: Fri, 6 Apr 2012 17:44:30 -0700 (PDT)
Date: 2012-04-06T17:44:30-07:00 [thread overview]
Message-ID: <22193583.1528.1333759470339.JavaMail.geo-discussion-forums@vbdn7> (raw)
Hi everyone,
I've stumbled across another dubious GNAT GPL 2011 situation, yet this one is convoluted enough to perhaps be mistaken thinking on my part, so I would be appreciative of any independent tests before I submit it. Additionally, I would like to try to describe it using the rich Ada lexicon, so please check me on that as well:
"When an object of a limited record type containing an object of a non-limited controlled record type which contains an access value to a classwide type is created from a value-returning function whose argument is supplied from another value-returning function whose argument is supplied from a classwide allocator, a constraint error is raised."
It's clearly an edge case, and would not surprise me if it is related to a different bug where allocating a classwide type mangles the dispatch table, but as this behavior is different in that an exception is raised instead of erroneous execution, perhaps it's something else entirely, or maybe even doing what it's supposed to do (in which case please explain it to me).
A small test procedure that demonstrates this behavior is as follows:
with Ada.Finalization;
procedure test is
type I is limited interface;
type I_Ptr is access I'class;
type C is new Ada.Finalization.Limited_Controlled and I with
record
d : integer;
end record;
function F (arg : Integer) return I'class is
begin
return C'(Ada.Finalization.Limited_Controlled with d => arg);
end F;
type K is new Ada.Finalization.Controlled with
record
e : I_Ptr;
end record;
function G (p_i : I_Ptr) return K is
begin
return K'(Ada.Finalization.Controlled with e => p_i);
end G;
type J is limited record
h : K;
end record;
function H (arg : K) return J is
begin
return J'(h => arg);
end H;
x : J := H(arg =>
G(p_i =>
I_Ptr'(new I'class'(F(arg=> 42)))));
begin
null;
end test;
next reply other threads:[~2012-04-07 0:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-07 0:44 sbelmont700 [this message]
2012-04-07 11:09 ` A Gnother Gnasty bug Ludovic Brenta
2012-04-07 12:48 ` sbelmont700
2012-04-07 13:55 ` Robert A Duff
2012-04-09 21:09 ` Adam Beneschan
2012-04-09 21:39 ` Robert A Duff
2012-04-07 11:54 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox