This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] only emit one DIE for external declarations in the local scope


[Jason approved this patch off-line, and I am committing now that tests have successfully run.]

This is a bug I found while investigating early dwarf generation, but that is broken mainline as well.

For the following code:

namespace S
{
  int i=777;
  int
  f()
  {
    int i = 42;
    {
      extern int i;
      return i;
    }
  }
}

...we end up emitting an extern declaration for "i" twice, once in the innermost lexical scope, and one in the namespace. The one in the namespace is unnecessary (and incorrect), although it is really not impacting any testcases since the second one is the one that takes precedence within the innermost scope.

With this patch, we get one less DIE for this scenario on mainline, while fixing other problems in early dwarf. Double yay!

Aldy

Attachment: curr
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]