From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: GNAT stuck, any idea on how to diagnose it? Date: Sun, 14 Sep 2014 21:47:46 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Sun, 14 Sep 2014 21:47:46 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="76a49b86bc3e16725b7cfca3d85cb4c8"; logging-data="19545"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/CQEJnyhCwqif8B+plZc/V" User-Agent: slrn/1.0.1 (FreeBSD) Cancel-Lock: sha1:BAsNhPB2KIeBOuXsDUOZA8lDc9E= Xref: number.nntp.dca.giganews.com comp.lang.ada:189005 Date: 2014-09-14T21:47:46+00:00 List-Id: Hello, On 2014-09-14, Brad Moore 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