debug: make -feliminate-unused-debug-symbols the default [PR debug/86964]

Message ID 20190516092100.11157-1-patrickdepinguin@gmail.com
State New
Headers show
Series
  • debug: make -feliminate-unused-debug-symbols the default [PR debug/86964]
Related show

Commit Message

Thomas De Schampheleire May 16, 2019, 9:21 a.m.
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>


In addition to making -feliminate-unused-debug-symbols work for the DWARF
format (see [1]), make this option the default. This behavior was the case
before, e.g. under gcc 4.9.x.
[1] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=269925

gcc/ChangeLog:

2019-05-16  Thomas De Schampheleire  <thomas.de_schampheleire@nokia.com>

	PR debug/86964
	* common.opt (feliminate-unused-debug-symbols): Enable by default.
	* doc/invoke.texi (Debugging Options): Document new default of
	-feliminate-unused-debug-symbols and remove restriction to 'stabs'.
---
 gcc/common.opt      | 2 +-
 gcc/doc/invoke.texi | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

-- 
2.21.0

Comments

Richard Biener May 16, 2019, 12:41 p.m. | #1
On Thu, May 16, 2019 at 11:20 AM Thomas De Schampheleire
<patrickdepinguin@gmail.com> wrote:
>

> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

>

> In addition to making -feliminate-unused-debug-symbols work for the DWARF

> format (see [1]), make this option the default. This behavior was the case

> before, e.g. under gcc 4.9.x.

> [1] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=269925


I have tested this patch and it causes a few FAILs, eventually hinting
at implementation issues:

                === g++ tests ===


Running target unix
FAIL: g++.dg/debug/enum-2.C -gstabs -O2  scan-assembler JTI_MAX
FAIL: g++.dg/debug/enum-2.C -gstabs -O3  scan-assembler JTI_MAX
FAIL: g++.dg/debug/enum-2.C -gstabs+ -O2  scan-assembler JTI_MAX
FAIL: g++.dg/debug/enum-2.C -gstabs+ -O3  scan-assembler JTI_MAX
FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O2  scan-assembler JTI_MAX
FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O3  scan-assembler JTI_MAX
FAIL: g++.dg/debug/enum-2.C -gstabs3 -O2  scan-assembler JTI_MAX
FAIL: g++.dg/debug/enum-2.C -gstabs3 -O3  scan-assembler JTI_MAX

maybe expected (stabs....)

FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or
dy_defn_fld_head.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or
dy_defn_ptr_head.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or
dy_defn_ref_head.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or
dy_defn_var_head_fld.*DW_AT_name
... more ...
FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14  scan-assembler gstruct_
head_ordy_defn_var_head.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14  scan-assembler gstruct_
head_tmpl_defn_var_head<int>.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17  scan-assembler gstruct_
head_ordy_defn_var_head.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17  scan-assembler gstruct_
head_tmpl_defn_var_head<int>.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98  scan-assembler gstruct_
head_ordy_defn_var_head.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98
scan-assembler gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler
gstruct_head_ordy_defn_var_head.*DW_AT_name
FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler
gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name
... more fesd-* testcases FAIL ...
FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17
scan-assembler-times  DW_AT_[^\\n\\r]*linkage_name 7
FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17
scan-assembler-times  DW_AT_specification 6
FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17
scan-assembler-times 0x3[^\\n\\r]* DW_AT_inline 6

C variants of the fesd-* testcases also FAIL.  Those testcases are
huge, a quick look didn't
reveal whether those are expected FAILs or not.

Richard.

> gcc/ChangeLog:

>

> 2019-05-16  Thomas De Schampheleire  <thomas.de_schampheleire@nokia.com>

>

>         PR debug/86964

>         * common.opt (feliminate-unused-debug-symbols): Enable by default.

>         * doc/invoke.texi (Debugging Options): Document new default of

>         -feliminate-unused-debug-symbols and remove restriction to 'stabs'.

> ---

>  gcc/common.opt      | 2 +-

>  gcc/doc/invoke.texi | 9 +++++----

>  2 files changed, 6 insertions(+), 5 deletions(-)

>

> diff --git a/gcc/common.opt b/gcc/common.opt

> index d342c4f3749..0e72fd08ec4 100644

> --- a/gcc/common.opt

> +++ b/gcc/common.opt

> @@ -1379,7 +1379,7 @@ Common Report Var(flag_ipa_sra) Init(0) Optimization

>  Perform interprocedural reduction of aggregates.

>

>  feliminate-unused-debug-symbols

> -Common Report Var(flag_debug_only_used_symbols)

> +Common Report Var(flag_debug_only_used_symbols) Init(1)

>  Perform unused symbol elimination in debug info.

>

>  feliminate-unused-debug-types

> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi

> index 5e3e8873d35..06c8c60f19e 100644

> --- a/gcc/doc/invoke.texi

> +++ b/gcc/doc/invoke.texi

> @@ -388,7 +388,7 @@ Objective-C and Objective-C++ Dialects}.

>  -fno-eliminate-unused-debug-types @gol

>  -femit-struct-debug-baseonly  -femit-struct-debug-reduced @gol

>  -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol

> --feliminate-unused-debug-symbols  -femit-class-debug-always @gol

> +-fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol

>  -fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol

>  -fvar-tracking  -fvar-tracking-assignments}

>

> @@ -7827,10 +7827,11 @@ confusion with @option{-gdwarf-@var{level}}.

>  Instead use an additional @option{-g@var{level}} option to change the

>  debug level for DWARF.

>

> -@item -feliminate-unused-debug-symbols

> +@item -fno-eliminate-unused-debug-symbols

>  @opindex feliminate-unused-debug-symbols

> -Produce debugging information in stabs format (if that is supported),

> -for only symbols that are actually used.

> +@opindex fno-eliminate-unused-debug-symbols

> +By default, no debug information is produced for symbols that are not actually

> +used. Use this option if you want debug information for all symbols.

>

>  @item -femit-class-debug-always

>  @opindex femit-class-debug-always

> --

> 2.21.0

>
Thomas De Schampheleire May 17, 2019, 7:44 a.m. | #2
Hi Richard,

El jue., 16 may. 2019 a las 14:41, Richard Biener
(<richard.guenther@gmail.com>) escribió:
>

> On Thu, May 16, 2019 at 11:20 AM Thomas De Schampheleire

> <patrickdepinguin@gmail.com> wrote:

> >

> > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

> >

> > In addition to making -feliminate-unused-debug-symbols work for the DWARF

> > format (see [1]), make this option the default. This behavior was the case

> > before, e.g. under gcc 4.9.x.

> > [1] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=269925

>

> I have tested this patch and it causes a few FAILs, eventually hinting

> at implementation issues:

>

>                 === g++ tests ===

>

>

> Running target unix

> FAIL: g++.dg/debug/enum-2.C -gstabs -O2  scan-assembler JTI_MAX

> FAIL: g++.dg/debug/enum-2.C -gstabs -O3  scan-assembler JTI_MAX

> FAIL: g++.dg/debug/enum-2.C -gstabs+ -O2  scan-assembler JTI_MAX

> FAIL: g++.dg/debug/enum-2.C -gstabs+ -O3  scan-assembler JTI_MAX

> FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O2  scan-assembler JTI_MAX

> FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O3  scan-assembler JTI_MAX

> FAIL: g++.dg/debug/enum-2.C -gstabs3 -O2  scan-assembler JTI_MAX

> FAIL: g++.dg/debug/enum-2.C -gstabs3 -O3  scan-assembler JTI_MAX

>

> maybe expected (stabs....)

>

> FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

> dy_defn_fld_head.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

> dy_defn_ptr_head.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

> dy_defn_ref_head.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

> dy_defn_var_head_fld.*DW_AT_name

> ... more ...

> FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14  scan-assembler gstruct_

> head_ordy_defn_var_head.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14  scan-assembler gstruct_

> head_tmpl_defn_var_head<int>.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17  scan-assembler gstruct_

> head_ordy_defn_var_head.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17  scan-assembler gstruct_

> head_tmpl_defn_var_head<int>.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98  scan-assembler gstruct_

> head_ordy_defn_var_head.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98

> scan-assembler gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler

> gstruct_head_ordy_defn_var_head.*DW_AT_name

> FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler

> gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name

> ... more fesd-* testcases FAIL ...

> FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

> scan-assembler-times  DW_AT_[^\\n\\r]*linkage_name 7

> FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

> scan-assembler-times  DW_AT_specification 6

> FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

> scan-assembler-times 0x3[^\\n\\r]* DW_AT_inline 6

>

> C variants of the fesd-* testcases also FAIL.  Those testcases are

> huge, a quick look didn't

> reveal whether those are expected FAILs or not.



I tried reproducing these failures, using 'make bootstrap && make
check', but I see many many test failures:

        === gcc Summary ===

# of expected passes        144268
# of unexpected failures    113
# of unexpected successes    28
# of expected failures        593
# of unresolved testcases    2
# of unsupported tests        2279

        === g++ Summary ===

# of expected passes        134673
# of unexpected failures    137
# of expected failures        527
# of unsupported tests        5944

/home/tdescham/repo/contrib/gcc/host-x86_64-pc-linux-gnu/gcc/xgcc
version 10.0.0 20190516 (experimental) (GCC)


Is it expected that 'master' (gcc 10) has such failures? Should I test
on another branch, if so which?
And is there a way to run only specific tests, e.g. the ones that you
pointed out?

Thanks,
Thomas
Richard Biener May 17, 2019, 9:57 a.m. | #3
On Fri, May 17, 2019 at 9:42 AM Thomas De Schampheleire
<patrickdepinguin@gmail.com> wrote:
>

> Hi Richard,

>

> El jue., 16 may. 2019 a las 14:41, Richard Biener

> (<richard.guenther@gmail.com>) escribió:

> >

> > On Thu, May 16, 2019 at 11:20 AM Thomas De Schampheleire

> > <patrickdepinguin@gmail.com> wrote:

> > >

> > > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

> > >

> > > In addition to making -feliminate-unused-debug-symbols work for the DWARF

> > > format (see [1]), make this option the default. This behavior was the case

> > > before, e.g. under gcc 4.9.x.

> > > [1] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=269925

> >

> > I have tested this patch and it causes a few FAILs, eventually hinting

> > at implementation issues:

> >

> >                 === g++ tests ===

> >

> >

> > Running target unix

> > FAIL: g++.dg/debug/enum-2.C -gstabs -O2  scan-assembler JTI_MAX

> > FAIL: g++.dg/debug/enum-2.C -gstabs -O3  scan-assembler JTI_MAX

> > FAIL: g++.dg/debug/enum-2.C -gstabs+ -O2  scan-assembler JTI_MAX

> > FAIL: g++.dg/debug/enum-2.C -gstabs+ -O3  scan-assembler JTI_MAX

> > FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O2  scan-assembler JTI_MAX

> > FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O3  scan-assembler JTI_MAX

> > FAIL: g++.dg/debug/enum-2.C -gstabs3 -O2  scan-assembler JTI_MAX

> > FAIL: g++.dg/debug/enum-2.C -gstabs3 -O3  scan-assembler JTI_MAX

> >

> > maybe expected (stabs....)

> >

> > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

> > dy_defn_fld_head.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

> > dy_defn_ptr_head.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

> > dy_defn_ref_head.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

> > dy_defn_var_head_fld.*DW_AT_name

> > ... more ...

> > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14  scan-assembler gstruct_

> > head_ordy_defn_var_head.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14  scan-assembler gstruct_

> > head_tmpl_defn_var_head<int>.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17  scan-assembler gstruct_

> > head_ordy_defn_var_head.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17  scan-assembler gstruct_

> > head_tmpl_defn_var_head<int>.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98  scan-assembler gstruct_

> > head_ordy_defn_var_head.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98

> > scan-assembler gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler

> > gstruct_head_ordy_defn_var_head.*DW_AT_name

> > FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler

> > gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name

> > ... more fesd-* testcases FAIL ...

> > FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

> > scan-assembler-times  DW_AT_[^\\n\\r]*linkage_name 7

> > FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

> > scan-assembler-times  DW_AT_specification 6

> > FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

> > scan-assembler-times 0x3[^\\n\\r]* DW_AT_inline 6

> >

> > C variants of the fesd-* testcases also FAIL.  Those testcases are

> > huge, a quick look didn't

> > reveal whether those are expected FAILs or not.

>

>

> I tried reproducing these failures, using 'make bootstrap && make

> check', but I see many many test failures:

>

>         === gcc Summary ===

>

> # of expected passes        144268

> # of unexpected failures    113

> # of unexpected successes    28

> # of expected failures        593

> # of unresolved testcases    2

> # of unsupported tests        2279

>

>         === g++ Summary ===

>

> # of expected passes        134673

> # of unexpected failures    137

> # of expected failures        527

> # of unsupported tests        5944

>

> /home/tdescham/repo/contrib/gcc/host-x86_64-pc-linux-gnu/gcc/xgcc

> version 10.0.0 20190516 (experimental) (GCC)

>

>

> Is it expected that 'master' (gcc 10) has such failures? Should I test

> on another branch, if so which?


The guality ones are probably the most "disturbing", but yes, there
are quite a number of FAILs, my last result shows

                === gcc Summary ===

# of expected passes            144773
# of unexpected failures        102
# of unexpected successes       28
# of expected failures          602
# of unresolved testcases       2
# of unsupported tests          2297

                === g++ Summary ===

# of expected passes            134956
# of unexpected failures        1
# of expected failures          527
# of unsupported tests          5946

so esp. the C suite has quite a lot (guality, that is...)

> And is there a way to run only specific tests, e.g. the ones that you

> pointed out?


Yes, from inside gcc/ (in the build tree) do

make check-g++ RUNTESTFLAGS="debug.exp=enum-2.C"

to run a single testcase.  Omit the '=enum-2.C' to run all tests
where debug.exp resides.  For the dwarf testcases use
dwarf2.exp in place of debug.exp.  For the C testcases
use the check-gcc make target.

Richard.

>

> Thanks,

> Thomas
Thomas De Schampheleire May 17, 2019, 10:07 a.m. | #4
On Fri, May 17, 2019, 11:57 Richard Biener <richard.guenther@gmail.com>
wrote:

> On Fri, May 17, 2019 at 9:42 AM Thomas De Schampheleire

> <patrickdepinguin@gmail.com> wrote:

> >

> > Hi Richard,

> >

> > El jue., 16 may. 2019 a las 14:41, Richard Biener

> > (<richard.guenther@gmail.com>) escribió:

> > >

> > > On Thu, May 16, 2019 at 11:20 AM Thomas De Schampheleire

> > > <patrickdepinguin@gmail.com> wrote:

> > > >

> > > > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

> > > >

> > > > In addition to making -feliminate-unused-debug-symbols work for the

> DWARF

> > > > format (see [1]), make this option the default. This behavior was

> the case

> > > > before, e.g. under gcc 4.9.x.

> > > > [1] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=269925

> > >

> > > I have tested this patch and it causes a few FAILs, eventually hinting

> > > at implementation issues:

> > >

> > >                 === g++ tests ===

> > >

> > >

> > > Running target unix

> > > FAIL: g++.dg/debug/enum-2.C -gstabs -O2  scan-assembler JTI_MAX

> > > FAIL: g++.dg/debug/enum-2.C -gstabs -O3  scan-assembler JTI_MAX

> > > FAIL: g++.dg/debug/enum-2.C -gstabs+ -O2  scan-assembler JTI_MAX

> > > FAIL: g++.dg/debug/enum-2.C -gstabs+ -O3  scan-assembler JTI_MAX

> > > FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O2  scan-assembler JTI_MAX

> > > FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O3  scan-assembler JTI_MAX

> > > FAIL: g++.dg/debug/enum-2.C -gstabs3 -O2  scan-assembler JTI_MAX

> > > FAIL: g++.dg/debug/enum-2.C -gstabs3 -O3  scan-assembler JTI_MAX

> > >

> > > maybe expected (stabs....)

> > >

> > > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler

> field_head_or

> > > dy_defn_fld_head.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler

> field_head_or

> > > dy_defn_ptr_head.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler

> field_head_or

> > > dy_defn_ref_head.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler

> field_head_or

> > > dy_defn_var_head_fld.*DW_AT_name

> > > ... more ...

> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14

> scan-assembler gstruct_

> > > head_ordy_defn_var_head.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14

> scan-assembler gstruct_

> > > head_tmpl_defn_var_head<int>.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17

> scan-assembler gstruct_

> > > head_ordy_defn_var_head.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17

> scan-assembler gstruct_

> > > head_tmpl_defn_var_head<int>.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98

> scan-assembler gstruct_

> > > head_ordy_defn_var_head.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98

> > > scan-assembler gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler

> > > gstruct_head_ordy_defn_var_head.*DW_AT_name

> > > FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler

> > > gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name

> > > ... more fesd-* testcases FAIL ...

> > > FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

> > > scan-assembler-times  DW_AT_[^\\n\\r]*linkage_name 7

> > > FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

> > > scan-assembler-times  DW_AT_specification 6

> > > FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

> > > scan-assembler-times 0x3[^\\n\\r]* DW_AT_inline 6

> > >

> > > C variants of the fesd-* testcases also FAIL.  Those testcases are

> > > huge, a quick look didn't

> > > reveal whether those are expected FAILs or not.

> >

> >

> > I tried reproducing these failures, using 'make bootstrap && make

> > check', but I see many many test failures:

> >

> >         === gcc Summary ===

> >

> > # of expected passes        144268

> > # of unexpected failures    113

> > # of unexpected successes    28

> > # of expected failures        593

> > # of unresolved testcases    2

> > # of unsupported tests        2279

> >

> >         === g++ Summary ===

> >

> > # of expected passes        134673

> > # of unexpected failures    137

> > # of expected failures        527

> > # of unsupported tests        5944

> >

> > /home/tdescham/repo/contrib/gcc/host-x86_64-pc-linux-gnu/gcc/xgcc

> > version 10.0.0 20190516 (experimental) (GCC)

> >

> >

> > Is it expected that 'master' (gcc 10) has such failures? Should I test

> > on another branch, if so which?

>

> The guality ones are probably the most "disturbing", but yes, there

> are quite a number of FAILs, my last result shows

>

>                 === gcc Summary ===

>

> # of expected passes            144773

> # of unexpected failures        102

> # of unexpected successes       28

> # of expected failures          602

> # of unresolved testcases       2

> # of unsupported tests          2297

>

>                 === g++ Summary ===

>

> # of expected passes            134956

> # of unexpected failures        1

> # of expected failures          527

> # of unsupported tests          5946

>

> so esp. the C suite has quite a lot (guality, that is...)

>


Do you have any idea how this simple change could cause all these problems?

I could imagine that tests checking specifically for debug symbols could
unexpectedly succeed or fail, but not how other tests could fail.



> > And is there a way to run only specific tests, e.g. the ones that you

> > pointed out?

>

> Yes, from inside gcc/ (in the build tree) do

>

> make check-g++ RUNTESTFLAGS="debug.exp=enum-2.C"

>

> to run a single testcase.  Omit the '=enum-2.C' to run all tests

> where debug.exp resides.  For the dwarf testcases use

> dwarf2.exp in place of debug.exp.  For the C testcases

> use the check-gcc make target.

>


Thanks, I will try that.

Best regards
Thomas
Richard Biener May 17, 2019, 1:39 p.m. | #5
On Fri, May 17, 2019 at 12:07 PM Thomas De Schampheleire
<patrickdepinguin@gmail.com> wrote:
>

>

>

> On Fri, May 17, 2019, 11:57 Richard Biener <richard.guenther@gmail.com> wrote:

>>

>> On Fri, May 17, 2019 at 9:42 AM Thomas De Schampheleire

>> <patrickdepinguin@gmail.com> wrote:

>> >

>> > Hi Richard,

>> >

>> > El jue., 16 may. 2019 a las 14:41, Richard Biener

>> > (<richard.guenther@gmail.com>) escribió:

>> > >

>> > > On Thu, May 16, 2019 at 11:20 AM Thomas De Schampheleire

>> > > <patrickdepinguin@gmail.com> wrote:

>> > > >

>> > > > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

>> > > >

>> > > > In addition to making -feliminate-unused-debug-symbols work for the DWARF

>> > > > format (see [1]), make this option the default. This behavior was the case

>> > > > before, e.g. under gcc 4.9.x.

>> > > > [1] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=269925

>> > >

>> > > I have tested this patch and it causes a few FAILs, eventually hinting

>> > > at implementation issues:

>> > >

>> > >                 === g++ tests ===

>> > >

>> > >

>> > > Running target unix

>> > > FAIL: g++.dg/debug/enum-2.C -gstabs -O2  scan-assembler JTI_MAX

>> > > FAIL: g++.dg/debug/enum-2.C -gstabs -O3  scan-assembler JTI_MAX

>> > > FAIL: g++.dg/debug/enum-2.C -gstabs+ -O2  scan-assembler JTI_MAX

>> > > FAIL: g++.dg/debug/enum-2.C -gstabs+ -O3  scan-assembler JTI_MAX

>> > > FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O2  scan-assembler JTI_MAX

>> > > FAIL: g++.dg/debug/enum-2.C -gstabs+3 -O3  scan-assembler JTI_MAX

>> > > FAIL: g++.dg/debug/enum-2.C -gstabs3 -O2  scan-assembler JTI_MAX

>> > > FAIL: g++.dg/debug/enum-2.C -gstabs3 -O3  scan-assembler JTI_MAX

>> > >

>> > > maybe expected (stabs....)

>> > >

>> > > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

>> > > dy_defn_fld_head.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

>> > > dy_defn_ptr_head.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

>> > > dy_defn_ref_head.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-any.C  -std=gnu++14  scan-assembler field_head_or

>> > > dy_defn_var_head_fld.*DW_AT_name

>> > > ... more ...

>> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14  scan-assembler gstruct_

>> > > head_ordy_defn_var_head.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++14  scan-assembler gstruct_

>> > > head_tmpl_defn_var_head<int>.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17  scan-assembler gstruct_

>> > > head_ordy_defn_var_head.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++17  scan-assembler gstruct_

>> > > head_tmpl_defn_var_head<int>.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98  scan-assembler gstruct_

>> > > head_ordy_defn_var_head.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-baseonly.C  -std=gnu++98

>> > > scan-assembler gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler

>> > > gstruct_head_ordy_defn_var_head.*DW_AT_name

>> > > FAIL: g++.dg/debug/dwarf2/fesd-none.C  -std=gnu++14  scan-assembler

>> > > gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name

>> > > ... more fesd-* testcases FAIL ...

>> > > FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

>> > > scan-assembler-times  DW_AT_[^\\n\\r]*linkage_name 7

>> > > FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

>> > > scan-assembler-times  DW_AT_specification 6

>> > > FAIL: g++.dg/debug/dwarf2/inline-var-1.C  -std=gnu++17

>> > > scan-assembler-times 0x3[^\\n\\r]* DW_AT_inline 6

>> > >

>> > > C variants of the fesd-* testcases also FAIL.  Those testcases are

>> > > huge, a quick look didn't

>> > > reveal whether those are expected FAILs or not.

>> >

>> >

>> > I tried reproducing these failures, using 'make bootstrap && make

>> > check', but I see many many test failures:

>> >

>> >         === gcc Summary ===

>> >

>> > # of expected passes        144268

>> > # of unexpected failures    113

>> > # of unexpected successes    28

>> > # of expected failures        593

>> > # of unresolved testcases    2

>> > # of unsupported tests        2279

>> >

>> >         === g++ Summary ===

>> >

>> > # of expected passes        134673

>> > # of unexpected failures    137

>> > # of expected failures        527

>> > # of unsupported tests        5944

>> >

>> > /home/tdescham/repo/contrib/gcc/host-x86_64-pc-linux-gnu/gcc/xgcc

>> > version 10.0.0 20190516 (experimental) (GCC)

>> >

>> >

>> > Is it expected that 'master' (gcc 10) has such failures? Should I test

>> > on another branch, if so which?

>>

>> The guality ones are probably the most "disturbing", but yes, there

>> are quite a number of FAILs, my last result shows

>>

>>                 === gcc Summary ===

>>

>> # of expected passes            144773

>> # of unexpected failures        102

>> # of unexpected successes       28

>> # of expected failures          602

>> # of unresolved testcases       2

>> # of unsupported tests          2297

>>

>>                 === g++ Summary ===

>>

>> # of expected passes            134956

>> # of unexpected failures        1

>> # of expected failures          527

>> # of unsupported tests          5946

>>

>> so esp. the C suite has quite a lot (guality, that is...)

>

>

> Do you have any idea how this simple change could cause all these problems?

>

> I could imagine that tests checking specifically for debug symbols could unexpectedly succeed or fail, but not how other tests could fail.


Those FAILs are not caused by the patch but are present unpatched.
Well, all apart from
the ones I quoted which scan debug info.

>

>>

>> > And is there a way to run only specific tests, e.g. the ones that you

>> > pointed out?

>>

>> Yes, from inside gcc/ (in the build tree) do

>>

>> make check-g++ RUNTESTFLAGS="debug.exp=enum-2.C"

>>

>> to run a single testcase.  Omit the '=enum-2.C' to run all tests

>> where debug.exp resides.  For the dwarf testcases use

>> dwarf2.exp in place of debug.exp.  For the C testcases

>> use the check-gcc make target.

>

>

> Thanks, I will try that.

>

> Best regards

> Thomas

Patch

diff --git a/gcc/common.opt b/gcc/common.opt
index d342c4f3749..0e72fd08ec4 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1379,7 +1379,7 @@  Common Report Var(flag_ipa_sra) Init(0) Optimization
 Perform interprocedural reduction of aggregates.
 
 feliminate-unused-debug-symbols
-Common Report Var(flag_debug_only_used_symbols)
+Common Report Var(flag_debug_only_used_symbols) Init(1)
 Perform unused symbol elimination in debug info.
 
 feliminate-unused-debug-types
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 5e3e8873d35..06c8c60f19e 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -388,7 +388,7 @@  Objective-C and Objective-C++ Dialects}.
 -fno-eliminate-unused-debug-types @gol
 -femit-struct-debug-baseonly  -femit-struct-debug-reduced @gol
 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
--feliminate-unused-debug-symbols  -femit-class-debug-always @gol
+-fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol
 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
 -fvar-tracking  -fvar-tracking-assignments}
 
@@ -7827,10 +7827,11 @@  confusion with @option{-gdwarf-@var{level}}.
 Instead use an additional @option{-g@var{level}} option to change the
 debug level for DWARF.
 
-@item -feliminate-unused-debug-symbols
+@item -fno-eliminate-unused-debug-symbols
 @opindex feliminate-unused-debug-symbols
-Produce debugging information in stabs format (if that is supported),
-for only symbols that are actually used.
+@opindex fno-eliminate-unused-debug-symbols
+By default, no debug information is produced for symbols that are not actually
+used. Use this option if you want debug information for all symbols.
 
 @item -femit-class-debug-always
 @opindex femit-class-debug-always