comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Compiler Bug
Date: Tue, 4 Dec 2007 14:54:22 -0800 (PST)
Date: 2007-12-04T14:54:22-08:00	[thread overview]
Message-ID: <24d8f3b3-8406-4bc2-8908-f85c84a4bd69@e10g2000prf.googlegroups.com> (raw)
In-Reply-To: fj4l3o$kjv$1@jacob-sparre.dk

On Dec 4, 2:45 pm, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
> "REH" <spamj...@stny.rr.com> wrote in message
>
> news:97d0825d-ee08-45ef-b736-ca005caf1a81@e23g2000prf.googlegroups.com...
>
>
>
> > No, I can't, sorry.  But the gist of it is:
>
> > function F1 return T1;
> > pragma Inline(F1);
>
> > function F1 return T1 is
> >   R : T1;
> > begin
> >   -- do stuff
> >   return R;
> > end F1;
>
> > function F2 return T2 is
> >   V : T1 := F1;
> >   R : T2;
> > begin
> >   -- do stuff
> >   return R;
> > end F2;
>
> > The compiler and debugger treat the R in F2 as if it is of type T1,
> > not T2.  Exceeding the bounds of T1 cause F2 to raise a
> > constraint_error.  The problem goes away if the pragma inline is
> > removed.
>
> The way you describe it, it sounds like a compiler bug. But without seeing
> the actual code, it is impossible to tell for sure. (It's not unusual for a
> compiler-bug-reporter to see one problem when something totally different is
> going on -- it even happens to me from time-to-time.) Ada's visibility rules
> are complex enough that you could be getting some other kind of conflict
> without realizing it.

Right... but pragma Inline isn't supposed to affect the visibility
rules at all.  So no matter what he's doing, if he's actually seeing a
case where a program with an Inline pragma raises a Constraint_Error,
and removing the pragma (without doing anything else to the program)
causes the Constraint_Error to go away, then I can't think of any way
that this could happen with a correct compiler.  (That's not true in
reverse, by the way... there are legitimate cases when adding an
Inline pragma could make a Constraint_Error go away, if an optimizer
determines that some of the inlined code can be eliminated for a
particular call.  But adding an Inline pragma should never make a
Constraint_Error appear that didn't appear before, I don't think.)

                            -- Adam






  parent reply	other threads:[~2007-12-04 22:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-04 21:58 Compiler Bug REH
2007-12-04 22:25 ` Lucretia
2007-12-04 22:32   ` REH
2007-12-04 22:45     ` Randy Brukardt
2007-12-04 22:49       ` REH
2007-12-04 22:54       ` Adam Beneschan [this message]
2007-12-05  9:46         ` Samuel Tardieu
2007-12-05 16:07           ` Adam Beneschan
2007-12-06  3:30             ` Randy Brukardt
2007-12-06  3:30             ` Randy Brukardt
2007-12-04 22:45     ` Randy Brukardt
2007-12-06  6:51     ` Keith Thompson
2007-12-06 16:48       ` REH
  -- strict thread matches above, loose matches on Subject: below --
2008-04-01 11:52 Compiler bug Maciej Sobczak
2008-04-01 13:00 ` Ludovic Brenta
2008-04-01 20:43   ` Maciej Sobczak
2008-04-02 11:39 ` Alex R. Mosteo
2008-04-02 17:44 ` Per Sandberg
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox