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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9fb8e2af320d5b3e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!postnews.google.com!z28g2000prd.googlegroups.com!not-for-mail From: Anh Vo Newsgroups: comp.lang.ada Subject: Re: Bus error Date: Wed, 27 Jun 2007 20:02:25 -0000 Organization: http://groups.google.com Message-ID: <1182974545.047564.236590@z28g2000prd.googlegroups.com> References: <1182954233.788124.17920@c77g2000hse.googlegroups.com> NNTP-Posting-Host: 209.225.225.89 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1182974545 10691 127.0.0.1 (27 Jun 2007 20:02:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 27 Jun 2007 20:02:25 +0000 (UTC) In-Reply-To: <1182954233.788124.17920@c77g2000hse.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; InfoPath.1),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: z28g2000prd.googlegroups.com; posting-host=209.225.225.89; posting-account=JVr7Xg0AAAAI3MbuARxMmvWLmA7qdJMx Xref: g2news1.google.com comp.lang.ada:16323 Date: 2007-06-27T20:02:25+00:00 List-Id: On Jun 27, 7:23 am, Maciej Sobczak wrote: > I have found a problem with my compiler: > > -- a.ads > with Ada.Finalization; > package A is > > type T is tagged limited private; > > function Make return T; > > private > > type T is new Ada.Finalization.Limited_Controlled with > record > X : Integer; > end record; > > overriding procedure Finalize(V : in out T); > > end A; > > -- a.adb > with Ada.Text_IO; > package body A is > > function Make return T is > begin > return (Ada.Finalization.Limited_Controlled with 7); > end Make; > > procedure Finalize(V : in out T) is > begin > Ada.Text_IO.Put("Finalizing T"); > end; > > end A; > > -- hello.adb > with A; > procedure Hello is > Y : A.T := A.Make; > begin > null; > end Hello; > > $ gnatmake hello > gcc -c hello.adb > gcc -c a.adb > gnatbind -x hello.ali > gnatlink hello.ali > $ ./hello > Bus error > $ > > GNAT version: 4.3.0 20070527 (experimental) > > BTW - is the code correct at all? I'm worried about A.Make in > particular. > > -- > Maciej Sobczakhttp://www.msobczak.com/ With the lattest snapshot gcc-4.3-20070622 a bug box resulted as shown below bash-2.05b$ gnatmake hello.adb gcc -c hello.adb gcc -c a.adb +===========================GNAT BUG DETECTED==============================+ | 4.3.0 20070615 (experimental) (i686-pc-linux-gnu) Assert_Failure namet.adb:687| | Error detected at a.adb: 10:7 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Use a subject line meaningful to you and us to track the bug. | | Include the entire contents of this bug box in the report. | | Include the exact gcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +========================================================================== + Please include these source files with error report Note that list may not be accurate in some cases, so please double check that the problem can still be reproduced with the set of files listed. a.adb a.ads compilation abandoned gnatmake: "a.adb" compilation error When compiled with GNAT-GPL-2007, an error is detected gcc -c hello.adb gcc -c a.adb a.adb:10:07: "" is undefined a.adb:10:07: actual for "From" must be a variable gnatmake: "a.adb" compilation error However, if the return statement is fully qualified as below, it works fine on all versions $$$ return T'(Ada.Finalization.Limited_Controlled with 7); AV