mbox series

[0/3] Fix PR debug/105089

Message ID 20220330233135.1762317-1-indu.bhagat@oracle.com
Headers show
Series Fix PR debug/105089 | expand

Message

Indu Bhagat March 30, 2022, 11:31 p.m. UTC
Hello,

This patch set fixes PR debug/105089.

[PS: The first patch in the series "ctfc: get rid of the static variable in
ctf_list_add_ctf_vars" is unrelated to the PR and is combined here only for
ease of review.]

As noted in the PR debug/105089, gcc is emitting two CTF variable records
where it sees an extern variable with declaration and definition in the same
compilation unit.

The CTF format format does not distinguish between the non-defining decl vs.
the defining decl, so the correct behaviour wrt the compiler generating the
type for such extern variables is to simply emit the type of the defining 
declaration.

Testing Notes:
-- bootstrapped and reg tested on x86_64 and aarch64
-- built binutils package with -gctf (with CTF-capable linker) on x86_64, no
   CTF errors reported.

Thanks,

Indu Bhagat (3):
  ctfc: get rid of the static variable in ctf_list_add_ctf_vars ()
  CTF for extern variable fix [PR105089]
  Refactor and update CTF testcases [PR105089]

 gcc/ctfc.cc                                   | 62 ++++++++++++++++++-
 gcc/ctfc.h                                    |  8 ++-
 gcc/ctfout.cc                                 | 28 ++++++---
 gcc/dwarf2ctf.cc                              | 18 +++++-
 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c  | 22 +++----
 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c  | 17 +++++
 .../gcc.dg/debug/ctf/ctf-variables-3.c        | 22 +++++++
 7 files changed, 147 insertions(+), 30 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c

Comments

Indu Bhagat April 7, 2022, 8:04 p.m. UTC | #1
ping

On 3/30/22 4:31 PM, Indu Bhagat wrote:
> Hello,
> 
> This patch set fixes PR debug/105089.
> 
> [PS: The first patch in the series "ctfc: get rid of the static variable in
> ctf_list_add_ctf_vars" is unrelated to the PR and is combined here only for
> ease of review.]
> 
> As noted in the PR debug/105089, gcc is emitting two CTF variable records
> where it sees an extern variable with declaration and definition in the same
> compilation unit.
> 
> The CTF format format does not distinguish between the non-defining decl vs.
> the defining decl, so the correct behaviour wrt the compiler generating the
> type for such extern variables is to simply emit the type of the defining
> declaration.
> 
> Testing Notes:
> -- bootstrapped and reg tested on x86_64 and aarch64
> -- built binutils package with -gctf (with CTF-capable linker) on x86_64, no
>     CTF errors reported.
> 
> Thanks,
> 
> Indu Bhagat (3):
>    ctfc: get rid of the static variable in ctf_list_add_ctf_vars ()
>    CTF for extern variable fix [PR105089]
>    Refactor and update CTF testcases [PR105089]
> 
>   gcc/ctfc.cc                                   | 62 ++++++++++++++++++-
>   gcc/ctfc.h                                    |  8 ++-
>   gcc/ctfout.cc                                 | 28 ++++++---
>   gcc/dwarf2ctf.cc                              | 18 +++++-
>   gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c  | 22 +++----
>   gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c  | 17 +++++
>   .../gcc.dg/debug/ctf/ctf-variables-3.c        | 22 +++++++
>   7 files changed, 147 insertions(+), 30 deletions(-)
>   create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c
>   create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c
>
Richard Biener April 8, 2022, 6:37 a.m. UTC | #2
On Thu, Apr 7, 2022 at 9:42 PM Indu Bhagat via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> ping

The series is OK

> On 3/30/22 4:31 PM, Indu Bhagat wrote:
> > Hello,
> >
> > This patch set fixes PR debug/105089.
> >
> > [PS: The first patch in the series "ctfc: get rid of the static variable in
> > ctf_list_add_ctf_vars" is unrelated to the PR and is combined here only for
> > ease of review.]
> >
> > As noted in the PR debug/105089, gcc is emitting two CTF variable records
> > where it sees an extern variable with declaration and definition in the same
> > compilation unit.
> >
> > The CTF format format does not distinguish between the non-defining decl vs.
> > the defining decl, so the correct behaviour wrt the compiler generating the
> > type for such extern variables is to simply emit the type of the defining
> > declaration.
> >
> > Testing Notes:
> > -- bootstrapped and reg tested on x86_64 and aarch64
> > -- built binutils package with -gctf (with CTF-capable linker) on x86_64, no
> >     CTF errors reported.
> >
> > Thanks,
> >
> > Indu Bhagat (3):
> >    ctfc: get rid of the static variable in ctf_list_add_ctf_vars ()
> >    CTF for extern variable fix [PR105089]
> >    Refactor and update CTF testcases [PR105089]
> >
> >   gcc/ctfc.cc                                   | 62 ++++++++++++++++++-
> >   gcc/ctfc.h                                    |  8 ++-
> >   gcc/ctfout.cc                                 | 28 ++++++---
> >   gcc/dwarf2ctf.cc                              | 18 +++++-
> >   gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c  | 22 +++----
> >   gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c  | 17 +++++
> >   .../gcc.dg/debug/ctf/ctf-variables-3.c        | 22 +++++++
> >   7 files changed, 147 insertions(+), 30 deletions(-)
> >   create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c
> >   create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c
> >
>