comp.lang.ada
 help / color / mirror / Atom feed
From: Natasha Kerensikova <lithiumcat@instinctive.eu>
Subject: Re: GNAT stuck, any idea on how to diagnose it?
Date: Sun, 14 Sep 2014 21:47:46 +0000 (UTC)
Date: 2014-09-14T21:47:46+00:00	[thread overview]
Message-ID: <slrnm1c37u.nrc.lithiumcat@nat.rebma.instinctive.eu> (raw)
In-Reply-To: noiRv.148468$Wt5.147264@fx01.iad

Hello,

On 2014-09-14, Brad Moore <brad.moore@shaw.ca> wrote:
> On 2014-09-14 8:49 AM, Dmitry A. Kazakov wrote:
>> On Sun, 14 Sep 2014 09:21:18 +0000 (UTC), Natasha Kerensikova wrote:
> I have on very rare occasion run into a case where the compiler appears 
> to be stuck in an endless loop when encountering some illegal code that 
> it couldn't handle. (More typically, this would involve a compiler crash 
> where at least you get some diagnostic message offering a clue to the 
> problem). In my case, I think it had something to do with a name 
> resolution problem I think. I found the source of the problem by 
> commenting out sections of new code until the
> problem went away, then adding back smaller sections until the program 
> reappears, until I zeroed in on the problematic code. Once I realized my
> mistake, I changed the code to use legal constructs, and the code 
> compiled right away.

It turns out your message was the largest contributor to my diagnostic,
except I don't see any mistake in my code (though thinking about it now,
I seem to remember people advising against expression functions
returning unconstrained values).

The presumably-endless loop was triggered by the following expression:

   (if Ref.Is_Empty then To_Atom (Fallback) else Ref.Query.Data.all);

It was originally in an expression function, but turning it into a
normal function whose body is only a return statement with the
expression above leads to the same symptoms.

However, turning it into an if statement in the normal function below
sloves the problem:

   if Ref.Is_Empty then
      return To_Atom (Fallback);
   else
      return Ref.Query.Data.all;
   end if;

In case anyone is interested, the full code is published there
https://github.com/faelys/natools/blob/trunk/src/natools-s_expressions-templates-generic_integers.adb#L291

Now a secondary question would be, how long is it reasonable to let GNAT
run before assuming it won't terminate ever?
My 41h here was probably extremely conservative...


Thank you all for your help,
Natasha


  reply	other threads:[~2014-09-14 21:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-14  9:21 GNAT stuck, any idea on how to diagnose it? Natasha Kerensikova
2014-09-14 11:59 ` Georg Bauhaus
2014-09-14 14:49 ` Dmitry A. Kazakov
2014-09-14 15:21   ` Brad Moore
2014-09-14 21:47     ` Natasha Kerensikova [this message]
2014-09-14 22:56       ` Anh Vo
2014-09-15  7:15         ` Dmitry A. Kazakov
2014-09-14 21:45   ` anon
2014-09-15  7:25     ` Dmitry A. Kazakov
2014-09-15  9:56       ` anon
2014-09-15  7:16   ` Natasha Kerensikova
2014-09-15  7:26     ` Jeffrey Carter
2014-09-14 17:45 ` Robert A Duff
replies disabled

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