public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>, Cary Coutant <ccoutant@google.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Don't add DW_AT_{main_subprogram,calling_convention} attributes more than once (PR debug/60152)
Date: Wed, 12 Feb 2014 22:20:00 -0000	[thread overview]
Message-ID: <20140212222008.GS20378@tucnak.redhat.com> (raw)

Hi!

gen_subprogram_die is often called more than once for the same decl
(e.g. the first time through force_decl_die etc.), but it always
unconditionally calls add_calling_convention_attribute which thus
may add the attributes several times.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

Alternatively, we could avoid the add_calling_convention_attribute
call in gen_subprogram_die if subr_die == orig_die, i.e. if we have
already processed the decl once, hopefully the calling conventions would be
the same in all cases.

2014-02-12  Jakub Jelinek  <jakub@redhat.com>

	PR debug/60152
	* dwarf2out.c (add_calling_convention_attribute): Don't add
	DW_AT_main_subprogram or DW_AT_calling_convention attributes
	if they are already present.

--- gcc/dwarf2out.c.jj	2014-01-30 20:31:19.000000000 +0100
+++ gcc/dwarf2out.c	2014-02-12 18:26:41.098486306 +0100
@@ -16873,13 +16873,15 @@ add_calling_convention_attribute (dw_die
 	rely on the old way, which we thus keep.  */
       value = DW_CC_program;
 
-      if (dwarf_version >= 4 || !dwarf_strict)
+      if ((dwarf_version >= 4 || !dwarf_strict)
+	  && !get_AT (subr_die, DW_AT_main_subprogram))
 	add_AT_flag (subr_die, DW_AT_main_subprogram, 1);
     }
 
   /* Only add the attribute if the backend requests it, and
      is not DW_CC_normal.  */
-  if (value && (value != DW_CC_normal))
+  if (value && value != DW_CC_normal
+      && !get_AT (subr_die, DW_AT_calling_convention))
     add_AT_unsigned (subr_die, DW_AT_calling_convention, value);
 }
 

	Jakub

             reply	other threads:[~2014-02-12 22:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 22:20 Jakub Jelinek [this message]
2014-02-12 22:58 ` Cary Coutant

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=20140212222008.GS20378@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=ccoutant@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /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).