public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wilson at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/35925] -g1 causes "Error: file number 1 already allocated"
Date: Mon, 14 Apr 2008 23:56:00 -0000	[thread overview]
Message-ID: <20080414235613.4060.qmail@sourceware.org> (raw)
In-Reply-To: <bug-35925-16057@http.gcc.gnu.org/bugzilla/>



------- Comment #1 from wilson at gcc dot gnu dot org  2008-04-14 23:56 -------
There is a conflict between the gcc and gas debug info support here.  This
can't be fixed in gcc.  It will have to be fixed in binutils.

-g1 tells gcc to emit debug info, but not line number info.  We do emit file
and line number info for function definitions.  This involves emitting a .file
1 "tmp.c" directive to add an entry to the dwarf2 file table.

-g tells gas to try to emit debug info.  Gas sees that there is no line number
info, and so tries to generate some itself.  However, gas is allocating entries
from the same dwarf2 file table that gcc is allocating from, leading to
conflicts.  Since gcc runs first, gcc can't avoid the conflicts.

I can make this work for a trivial example if I change gcc to emit the .file
directive for function info earlier.  However, this doesn't solve the problem,
it just delays it.  If I change the testcase so that it includes another source
file, then it fails again, this time complaining that file number 2 is already
used.  This one is impossible to fix in gcc.

Binutils needs to be changed to either not emit line number debug info for a
file compiled with gcc -g1, or else to allocate virtual file numbers for its
debug info, and then only give them physical file numbers when it is finished
parsing the entire file, and hence knows how many file numbers that gcc used.

I suggest filing a bug with the binutils folks pointing back at this bug
report.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35925


  reply	other threads:[~2008-04-14 23:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-13 17:29 [Bug c/35925] New: " mrs at mythic-beasts dot com
2008-04-14 23:56 ` wilson at gcc dot gnu dot org [this message]
2008-04-29 21:03 ` [Bug debug/35925] " mrs at mythic-beasts dot com

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=20080414235613.4060.qmail@sourceware.org \
    --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).