public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "demoonlit at panathenaia dot halfmoon.jp" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/65524] gnatbind generates decrementing the unexisting elab-counter into finalize_library
Date: Mon, 23 Mar 2015 17:56:00 -0000	[thread overview]
Message-ID: <bug-65524-4-KRWvpyZY4U@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65524-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65524

--- Comment #2 from yuta tomino <demoonlit at panathenaia dot halfmoon.jp> ---
Created attachment 35115
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35115&action=edit
example

I found the way of reproducing.

A tiny change of a-tags.ads is necessary.
Insert "is null" into Ada.Tags.Register_Tag to suppress the elaboration.
(Is there a pragma or restriction for this purpose?)

Note, Unregister_Tag is unrelated.

And, make a package as Pure or Preelaborate. Add a tagged type.
So the package would have _finalize_spec without _elabs.

(The direct cause of this case is the asymmetry that _elabs is not generated if
Register_Tag is null, against that,
_fialize_spec is always generated even if Unregister_Tag is null.
Register/Unregister_XXX are sometimes suppressed in parts of customized
runtimes.
My customized runtime satisfies the conditions about this time.
However, the way is only example for reproducing.
I think another approach is possibility because Build_Finalizer in exp_ch7.adb
is very complex...)

And then, prepare a main subprogram using the package. Compile and gnatbind.
See b~main.adb.

The log of compiling the attached example:

 % gnatmake -a -gnatp -g main
 gnatbind -x main.ali
 gnatlink main.ali -g
 b~main.adb:31:10: "E81" is undefined (more references follow)
 b~main.adb:34:07: "E05" is undefined (more references follow)
 gnatmake: *** link failed.

By the way, sorry, I realized that my first patch is not proper fix.
For multiple-elaboration, an elaboration-counter should be generated and
incremented in adainit when a _finalize_spec/body is existing, even if _elabs
is not existing.

Thanks.


  parent reply	other threads:[~2015-03-23 17:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23 14:43 [Bug ada/65524] New: " demoonlit at panathenaia dot halfmoon.jp
2015-03-23 15:00 ` [Bug ada/65524] " charlet at gcc dot gnu.org
2015-03-23 17:56 ` demoonlit at panathenaia dot halfmoon.jp [this message]
2015-03-24  9:49 ` charlet at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65524-4-KRWvpyZY4U@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).