From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10231 invoked by alias); 27 Sep 2009 21:20:29 -0000 Received: (qmail 10217 invoked by uid 22791); 27 Sep 2009 21:20:28 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mailout11.t-online.de (HELO mailout11.t-online.de) (194.25.134.85) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Sep 2009 21:20:22 +0000 Received: from fwd10.aul.t-online.de by mailout11.t-online.de with smtp id 1Ms1AJ-0005nL-01; Sun, 27 Sep 2009 23:20:19 +0200 Received: from [192.168.178.22] (ECT7cQZOrhhZEQMwyoHGXE8Nh+n49d7gMybs09SCcVWExjFicyPqsNVOQqFuVhZw47@[84.156.202.169]) by fwd10.aul.t-online.de with esmtp id 1Ms1AB-1ZUO240; Sun, 27 Sep 2009 23:20:11 +0200 Subject: Re: [gnat] reuse of ASTs already constructed From: oliver.kellogg@t-online.de (Oliver Kellogg) Reply-To: okellogg@users.sourceforge.net To: gcc@gcc.gnu.org In-Reply-To: <1251308729.4486.25.camel@tidbit.site> References: <1240349826.4554.76.camel@tidbit.site> <49EE4D58.8020404@adacore.com> <1240437226.4554.101.camel@tidbit.site> <49EF9892.1010703@adacore.com> <1246487007.4507.76.camel@tidbit.site> <1251308729.4486.25.camel@tidbit.site> Content-Type: text/plain Date: Sun, 27 Sep 2009 22:48:00 -0000 Message-Id: <1254086973.4569.95.camel@tidbit.site> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00556.txt.bz2 Consider compilation of the following code: function Exception_Id (Self : in Object) return CORBA.String is begin return To_Unbounded_String (Interfaces.C.Strings.Value (Self.C_Str)); end Exception_Id; The interesting part is the call to Interfaces.C.Strings.Value which returns String. If this is in the the first file compiled, there is no problem. However, if this is the second file of a multi file compile job, a GNAT node may have already been built for the entity "value" (i.e. the same function call already appeared in a previous file.) The problem is in gnat_to_gnu_entity (ada/gcc-interface/decl.c:3996ff.) /* If the Mechanism is By_Reference, ensure the return type uses the machine's by-reference mechanism, which may not the same as above (e.g., it might be by passing a fake parameter). */ else if (kind == E_Function && Mechanism (gnat_entity) == By_Reference) { TREE_ADDRESSABLE (gnu_return_type) = 1; .... } Since the entity's Mechanism attribute was changed from Default to By_Reference by a previous compilation (see Set_Mechanism calls in decl.c), the "if" condition here becomes true, and TREE_ADDRESSABLE is set true on the gnu_return_type. But that seems to wreak havoc with the further processing. I'm not sure about how best to address this problem. Perhaps the easy way out would be to buffer the original value of the Mechanism of all entities, and restore those values before compiling the next file? Thanks, Oliver On Wed, 2009-08-26 at 19:45 +0200, Oliver Kellogg wrote: > I've been making progress on the Ada side, the basic usage pattern for > gnat1 and gnatmake is working. > > There are two problems right now: > > 1) Mixing of Ada.Text_IO and Text_IO as described at > http://gcc.gnu.org/ml/gcc-help/2009-08/msg00113.html > > 2) The 'X' lines in the ALI files are not what they should be. > This is due to the fact that Lib.Xref.Generate_(Definition|Reference) is > called during semantic analysis. However, when I discover that a > tree was already built for a main unit by a previous compilation, > Sem is not redone for that tree. Depending on whether > Lib.Xref.Initialize is called per-job or per-file, this leads to either > too much or too little cross ref info. > > Ideas? > > Thanks, > > Oliver > > > On Thu, 2009-07-02 at 00:23 +0200, Oliver Kellogg wrote: > > I am approaching the point where the basic multi-source mechanism > > in the gnat1/gnatmake Ada code is working but I am getting > > lots of crashes in the gigi/gnat_to_gnu triggered core gcc code. > > I will have to learn much more about the GCC internals than > > I know right now so progress will inevitably be slow. > > > > For your information I am appending the current patch that > > I am using, as well as a log of a valgrind session that shows > > some of the current problems. > > > > On Wed, 2009-04-22 at 18:22 -0400, Robert Dewar wrote: > > > Oliver Kellogg wrote: > > > > [...] > > > > One more thing, procedure Initialize crashes with a libc report of > > > > double free() when invoked more than once. (Found this while > > > > working on the gnat1 multi-source compile feature, see > > > > http://gcc.gnu.org/ml/gcc/2009-04/msg00380.html) > > > > FYI I'm attaching the patch that works for me. > > > > > > gnat1 does not have the capability of compiling more than one > > > source file without being loaded, yes there is some preparation > > > for this, but it would require major work to get this working, > > > there are many known problems. > > > > For interest, what are the known problems? > > > > Thanks, > > > > Oliver > >