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,72010b3539d2f8cb X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!y31g2000prd.googlegroups.com!not-for-mail From: ytomino Newsgroups: comp.lang.ada Subject: Re: gneric package breaks the restriction of No_Elaboration_Code ? Date: Mon, 7 Mar 2011 00:51:56 -0800 (PST) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 220.104.114.10 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1299487931 11202 127.0.0.1 (7 Mar 2011 08:52:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 7 Mar 2011 08:52:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y31g2000prd.googlegroups.com; posting-host=220.104.114.10; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:17936 Date: 2011-03-07T00:51:56-08:00 List-Id: On Feb 28, 9:42=A0pm, Simon Wright wrote: > ytomino writes: > > I think this is gcc's bug. (I tried with gcc-4.5.1/4.5.2) > > Same with 4.6.0 experimental at 20110225. Thanks for confirmation. I reported this to GCC Bugzilla. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D48013 and I made dirty-patch. It tentatively seems correct. I don't know the details of gcc, cannot judge whether this solution is correct or ill... (Most of adainit was decreased with this patch, therefore disused .o were removed on linking. I'm happy a little... Is it good or bad???) Index: gcc/ada/gcc-interface/trans.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/ada/gcc-interface/trans.c (revision 170538) +++ gcc/ada/gcc-interface/trans.c (working copy) @@ -223,6 +223,34 @@ of configurations. */ static const char *extract_encoding (const char *) ATTRIBUTE_UNUSED; static const char *decode_name (const char *) ATTRIBUTE_UNUSED; + +static bool is_empty (tree x); +static bool is_empty (tree x) +{ + if (x){ + switch (TREE_CODE (x)){ + case STATEMENT_LIST: + do { + struct tree_statement_list_node *i =3D STATEMENT_LIST_HEAD(x); + while (i){ + if (! is_empty (i->stmt)){ + return false; + } + i =3D i->next; + } + }while (0); + break; + case STMT_STMT: + if (! is_empty (STMT_STMT_STMT (x))){ /* elm->exp.operands[0] */ + return false; + } + break; + default: + return false; + } + } + return true; +} /* This is the main program of the back-end. It sets up all the table structures and then generates code. */ @@ -644,7 +672,7 @@ gnu_stmts =3D gnu_body; if (TREE_CODE (gnu_stmts) =3D=3D BIND_EXPR) gnu_stmts =3D BIND_EXPR_BODY (gnu_stmts); - if (!gnu_stmts || !STATEMENT_LIST_HEAD (gnu_stmts)) + if (is_empty (gnu_stmts)) Set_Has_No_Elaboration_Code (info->gnat_node, 1); else {