public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/60815] New: Inconsistent prologue line table location
@ 2014-04-11  0:35 dblaikie at gmail dot com
  2014-04-11  0:44 ` [Bug debug/60815] " dblaikie at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dblaikie at gmail dot com @ 2014-04-11  0:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60815
           Summary: Inconsistent prologue line table location
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dblaikie at gmail dot com
                CC: ccoutant at gcc dot gnu.org, echristo at gmail dot com
              Host: x86_64
            Target: x86_64

Given:

template<typename T>
void func() // prologue
{
}

template void func<int>();

void f2()
{ // prologue
}

struct foo {
  void f3() // GCC prologue
  {
  }
  void f4();
};

void (foo::*x)() = &foo::f3;

void foo::f4()
{ // prologue
}

GCC's line table shows the prologue of both of these functions as the line of
the function name, not the opening '{'. Yet if these functions are
non-templates or out-of-line, the prologue starts at the opening brace, not the
function name.

(backstory: Clang consistently uses the opening brace but fails some GDB tests
that rely on GCC's behavior, even though it's inconsistent (see
gdb.cp/cpexprs.exp for some examples). It'd be great if both GCC and Clang
could agree on this, one way or another, but if not, the GDB tests can of
course be made resilient to the difference by simply putting the '{' on the
same line as the function name)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug debug/60815] Inconsistent prologue line table location
  2014-04-11  0:35 [Bug debug/60815] New: Inconsistent prologue line table location dblaikie at gmail dot com
@ 2014-04-11  0:44 ` dblaikie at gmail dot com
  2014-04-11  9:07 ` [Bug c++/60815] " rguenth at gcc dot gnu.org
  2021-08-27 19:30 ` [Bug c++/60815] prologue line is wrong for templates pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dblaikie at gmail dot com @ 2014-04-11  0:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David Blaikie <dblaikie at gmail dot com> ---
Oh - and if we can confirm the direction you're going with this (if the
decision is that the prologue should start, like Clang, at the opening '{'
always, for example) I'll go ahead and update the GDB test suite to either be
agnostic or to KFAIL those tests under GDB, referencing this bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/60815] Inconsistent prologue line table location
  2014-04-11  0:35 [Bug debug/60815] New: Inconsistent prologue line table location dblaikie at gmail dot com
  2014-04-11  0:44 ` [Bug debug/60815] " dblaikie at gmail dot com
@ 2014-04-11  9:07 ` rguenth at gcc dot gnu.org
  2021-08-27 19:30 ` [Bug c++/60815] prologue line is wrong for templates pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-11  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-debug
          Component|debug                       |c++

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Probably cfun->function_start_locus is inconsistent for them (or not set, in
which case we use DECL_SOURCE_LOCATION).

Sounds like a C++ frontend issue to me:

static tree
cp_parser_init_declarator (cp_parser* parser,
                           cp_decl_specifier_seq *decl_specifiers,
                           vec<deferred_access_check, va_gc> *checks,
                           bool function_definition_allowed_p,
                           bool member_p,
                           int declares_class_or_enum,
                           bool* function_definition_p,
                           tree* maybe_range_for_decl)
{
...
          if (decl != error_mark_node && DECL_STRUCT_FUNCTION (decl))
            {
              /* This is where the prologue starts...  */
              DECL_STRUCT_FUNCTION (decl)->function_start_locus
                = func_brace_location;

but for templates we likely don't have DECL_STRUCT_FUNCTION allocated at this
point.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/60815] prologue line is wrong for templates
  2014-04-11  0:35 [Bug debug/60815] New: Inconsistent prologue line table location dblaikie at gmail dot com
  2014-04-11  0:44 ` [Bug debug/60815] " dblaikie at gmail dot com
  2014-04-11  9:07 ` [Bug c++/60815] " rguenth at gcc dot gnu.org
@ 2021-08-27 19:30 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-27 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
            Summary|Inconsistent prologue line  |prologue line is wrong for
                   |table location              |templates
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-27

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed,
For templates, we should save off func_brace_location (somewhere) and set
DECL_STRUCT_FUNCTION (decl)->function_start_locus when the function gets
instantiated.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-27 19:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-11  0:35 [Bug debug/60815] New: Inconsistent prologue line table location dblaikie at gmail dot com
2014-04-11  0:44 ` [Bug debug/60815] " dblaikie at gmail dot com
2014-04-11  9:07 ` [Bug c++/60815] " rguenth at gcc dot gnu.org
2021-08-27 19:30 ` [Bug c++/60815] prologue line is wrong for templates pinskia at gcc dot gnu.org

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).