Re: [PATCH 3/5] Add DWARF5 variants of assembly scan tests that use DW_FORM_implicit_const

2020-08-24 Thread Jakub Jelinek via Gcc-patches
On Mon, Aug 24, 2020 at 02:56:56PM +0200, Mark Wielaard wrote:
> Some DWARF tests scan the assembly output looking for constant values.
> When using DWARF5 those constants might use DW_FORM_implicit_const,
> which are output (in the comments) after the attribute instead of
> before. To make sure these tests work introduce a -gdwarf-5 variant
> of these tests and explicitly use -gdwarf-2 for the original.

I just wonder if we want to use -gdwarf-2 rather than -gdwarf-4 in the
original, -gdwarf-5 has been the default for a couple of years and thus
that is what those testshave been compiled with.
Also not sure about the -dwarf5 suffixes, couldn't we say just use
pr41445-{7,8}.c, inline-var-2.C or inline3.c (or whatever next number
with the same prefix is still unused)?

> ---
>  .../dwarf2/{inline-var-1.C => inline-var-1-dwarf5.C}  | 6 --
>  gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C  | 2 +-
>  .../gcc.dg/debug/dwarf2/{inline2.c => inline2-dwarf5.c}   | 7 ---
>  gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c   | 4 +++-
>  .../debug/dwarf2/{pr41445-5.c => pr41445-5-dwarf5.c}  | 8 
>  gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c | 2 +-
>  .../debug/dwarf2/{pr41445-6.c => pr41445-6-dwarf5.c}  | 8 
>  gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c | 2 +-
>  8 files changed, 22 insertions(+), 17 deletions(-)
>  copy gcc/testsuite/g++.dg/debug/dwarf2/{inline-var-1.C => 
> inline-var-1-dwarf5.C} (76%)
>  copy gcc/testsuite/gcc.dg/debug/dwarf2/{inline2.c => inline2-dwarf5.c} (88%)
>  copy gcc/testsuite/gcc.dg/debug/dwarf2/{pr41445-5.c => pr41445-5-dwarf5.c} 
> (73%)
>  copy gcc/testsuite/gcc.dg/debug/dwarf2/{pr41445-6.c => pr41445-6-dwarf5.c} 
> (68%)
> 
> diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C 
> b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1-dwarf5.C
> similarity index 76%
> copy from gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
> copy to gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1-dwarf5.C
> index 3b1c913edfca..52ed5b6912fd 100644
> --- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
> +++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1-dwarf5.C
> @@ -1,7 +1,9 @@
> +// DWARF5 variant of inline-var-1.C
>  // { dg-do compile { target c++17 } }
> -// { dg-options "-O -g -dA -gno-strict-dwarf 
> -fno-eliminate-unused-debug-symbols" }
> +// { dg-options "-O -gdwarf-5 -dA -gno-strict-dwarf 
> -fno-eliminate-unused-debug-symbols" }
>  // { dg-require-weak "" }
> -// { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 6 { xfail 
> *-*-aix* } } }
> +// { dg-final { scan-assembler-times " DW_AT_inline \\(0x3\\)" 2 { xfail 
> *-*-aix* } } }
> +// { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 4 { xfail 
> *-*-aix* } } }
>  // { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 { xfail 
> *-*-aix* } } }
>  // { dg-final { scan-assembler-times " DW_AT_declaration" 6 { xfail *-*-aix* 
> } } }
>  // { dg-final { scan-assembler-times " DW_AT_specification" 6 { xfail 
> *-*-aix* } } }
> diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C 
> b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
> index 3b1c913edfca..9a88e28cbe0f 100644
> --- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
> +++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
> @@ -1,5 +1,5 @@
>  // { dg-do compile { target c++17 } }
> -// { dg-options "-O -g -dA -gno-strict-dwarf 
> -fno-eliminate-unused-debug-symbols" }
> +// { dg-options "-O -gdwarf-2 -dA -gno-strict-dwarf 
> -fno-eliminate-unused-debug-symbols" }
>  // { dg-require-weak "" }
>  // { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 6 { xfail 
> *-*-aix* } } }
>  // { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 { xfail 
> *-*-aix* } } }
> diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c 
> b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2-dwarf5.c
> similarity index 88%
> copy from gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
> copy to gcc/testsuite/gcc.dg/debug/dwarf2/inline2-dwarf5.c
> index 7e019a6c06a0..03013f11bca8 100644
> --- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
> +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2-dwarf5.c
> @@ -1,4 +1,4 @@
> -/* Contributed by Dodji Seketeli 
> +/* DWARF5 variant of inline2.
> Origin: PR debug/37801
>  
>Abstract instances (DW_TAG_subroutines having the DW_AT_inline attribute)
> @@ -14,7 +14,8 @@
>properly nested DW_TAG_inlined_subroutine DIEs for third, second and first.
>  */
>  
> -/* { dg-options "-O -g3 -gdwarf -dA -fgnu89-inline" } */
> +/* Explicitly use dwarf-5 which uses DW_FORM_implicit_const.  */
> +/* { dg-options "-O -g3 -gdwarf-5 -dA -fgnu89-inline" } */
>  /* { dg-do compile } */
>  
>  /* There are 6 inlined subroutines:
> @@ -32,7 +33,7 @@
>  /* There are 3 DW_AT_inline attributes: one per abstract inline instance.
> The value of the attribute must be 0x3, meaning the function was
> actually inlined.  */
> -/* { dg-fin

Re: [PATCH 3/5] Add DWARF5 variants of assembly scan tests that use DW_FORM_implicit_const

2020-08-24 Thread Mark Wielaard
On Mon, Aug 24, 2020 at 07:44:27PM +0200, Jakub Jelinek wrote:
> On Mon, Aug 24, 2020 at 02:56:56PM +0200, Mark Wielaard wrote:
> > Some DWARF tests scan the assembly output looking for constant values.
> > When using DWARF5 those constants might use DW_FORM_implicit_const,
> > which are output (in the comments) after the attribute instead of
> > before. To make sure these tests work introduce a -gdwarf-5 variant
> > of these tests and explicitly use -gdwarf-2 for the original.
> 
> I just wonder if we want to use -gdwarf-2 rather than -gdwarf-4 in the
> original, -gdwarf-5 has been the default for a couple of years and thus
> that is what those testshave been compiled with.

I used -gdwarf-2 because I thought that was still the default for some
arches/platforms. And they pass with -gdwarf-2.

> Also not sure about the -dwarf5 suffixes, couldn't we say just use
> pr41445-{7,8}.c, inline-var-2.C or inline3.c (or whatever next number
> with the same prefix is still unused)?

Sure, if that is a better naming scheme I'll rename them.

Cheers,

Mark



Re: [PATCH 3/5] Add DWARF5 variants of assembly scan tests that use DW_FORM_implicit_const

2020-09-17 Thread Mark Wielaard
On Mon, 2020-08-24 at 22:26 +0200, Mark Wielaard wrote:
> On Mon, Aug 24, 2020 at 07:44:27PM +0200, Jakub Jelinek wrote:
> > On Mon, Aug 24, 2020 at 02:56:56PM +0200, Mark Wielaard wrote:
> > > Some DWARF tests scan the assembly output looking for constant values.
> > > When using DWARF5 those constants might use DW_FORM_implicit_const,
> > > which are output (in the comments) after the attribute instead of
> > > before. To make sure these tests work introduce a -gdwarf-5 variant
> > > of these tests and explicitly use -gdwarf-2 for the original.
> > 
> > I just wonder if we want to use -gdwarf-2 rather than -gdwarf-4 in the
> > original, -gdwarf-5 has been the default for a couple of years and thus
> > that is what those testshave been compiled with.
> 
> I used -gdwarf-2 because I thought that was still the default for some
> arches/platforms. And they pass with -gdwarf-2.
> 
> > Also not sure about the -dwarf5 suffixes, couldn't we say just use
> > pr41445-{7,8}.c, inline-var-2.C or inline3.c (or whatever next number
> > with the same prefix is still unused)?
> 
> Sure, if that is a better naming scheme I'll rename them.

Here is the adjusted patch.

gcc/testsuite/ChangeLog:

* gcc.dg/debug/dwarf2/inline2.c: Add -gdwarf-2.
* g++.dg/debug/dwarf2/inline-var-1.C: Likewise.
* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c: Likewise.
* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c: Likewise.
* gcc.dg/debug/dwarf2/inline6.c: New variant with -gdwarf-5.
* g++.dg/debug/dwarf2/inline-var-3.C: Likewise.
* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-7.c: Likewise.
* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-8.c: Likewise.

OK to commit?

From 99e4e5bca0d55971c515b98188ec6f206517267d Mon Sep 17 00:00:00 2001
From: Mark Wielaard 
Date: Sun, 23 Aug 2020 16:21:08 +0200
Subject: [PATCH] Add DWARF5 variants of assembly scan tests that use
 DW_FORM_implicit_const

Some DWARF tests scan the assembly output looking for constant values.
When using DWARF5 those constants might use DW_FORM_implicit_const,
which are output (in the comments) after the attribute instead of
before. To make sure these tests work introduce a -gdwarf-5 variant
of these tests and explicitly use -gdwarf-2 for the original.

gcc/testsuite/ChangeLog:

	* gcc.dg/debug/dwarf2/inline2.c: Add -gdwarf-2.
	* g++.dg/debug/dwarf2/inline-var-1.C: Likewise.
	* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c: Likewise.
	* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c: Likewise.
	* gcc.dg/debug/dwarf2/inline6.c: New variant with -gdwarf-5.
	* g++.dg/debug/dwarf2/inline-var-3.C: Likewise.
	* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-7.c: Likewise.
	* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-8.c: Likewise.
---
 gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C  | 2 +-
 .../debug/dwarf2/{inline-var-1.C => inline-var-3.C}   | 6 --
 gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c   | 4 +++-
 .../gcc.dg/debug/dwarf2/{inline2.c => inline6.c}  | 7 ---
 gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c | 2 +-
 gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c | 2 +-
 .../gcc.dg/debug/dwarf2/{pr41445-5.c => pr41445-7.c}  | 8 
 .../gcc.dg/debug/dwarf2/{pr41445-6.c => pr41445-8.c}  | 8 
 8 files changed, 22 insertions(+), 17 deletions(-)
 copy gcc/testsuite/g++.dg/debug/dwarf2/{inline-var-1.C => inline-var-3.C} (76%)
 copy gcc/testsuite/gcc.dg/debug/dwarf2/{inline2.c => inline6.c} (88%)
 copy gcc/testsuite/gcc.dg/debug/dwarf2/{pr41445-5.c => pr41445-7.c} (73%)
 copy gcc/testsuite/gcc.dg/debug/dwarf2/{pr41445-6.c => pr41445-8.c} (68%)

diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
index 3b1c913edfca..9a88e28cbe0f 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
@@ -1,5 +1,5 @@
 // { dg-do compile { target c++17 } }
-// { dg-options "-O -g -dA -gno-strict-dwarf -fno-eliminate-unused-debug-symbols" }
+// { dg-options "-O -gdwarf-2 -dA -gno-strict-dwarf -fno-eliminate-unused-debug-symbols" }
 // { dg-require-weak "" }
 // { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 6 { xfail *-*-aix* } } }
 // { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 { xfail *-*-aix* } } }
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C
similarity index 76%
copy from gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
copy to gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C
index 3b1c913edfca..52ed5b6912fd 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C
@@ -1,7 +1,9 @@
+// DWARF5 variant of inline-var-1.C
 // { dg-do compile { target c++17 } }
-// { dg-options "-O -g -dA -gno-strict-dwarf -fno-eliminate-unused-debug-symbols" }
+// { dg-options "-O -gdwarf-5 -dA -gno-strict-dwarf -

Re: [PATCH 3/5] Add DWARF5 variants of assembly scan tests that use DW_FORM_implicit_const

2020-09-17 Thread Jakub Jelinek via Gcc-patches
On Thu, Sep 17, 2020 at 06:03:28PM +0200, Mark Wielaard wrote:
> On Mon, 2020-08-24 at 22:26 +0200, Mark Wielaard wrote:
> > On Mon, Aug 24, 2020 at 07:44:27PM +0200, Jakub Jelinek wrote:
> > > On Mon, Aug 24, 2020 at 02:56:56PM +0200, Mark Wielaard wrote:
> > > > Some DWARF tests scan the assembly output looking for constant values.
> > > > When using DWARF5 those constants might use DW_FORM_implicit_const,
> > > > which are output (in the comments) after the attribute instead of
> > > > before. To make sure these tests work introduce a -gdwarf-5 variant
> > > > of these tests and explicitly use -gdwarf-2 for the original.
> > > 
> > > I just wonder if we want to use -gdwarf-2 rather than -gdwarf-4 in the
> > > original, -gdwarf-5 has been the default for a couple of years and thus
> > > that is what those testshave been compiled with.
> > 
> > I used -gdwarf-2 because I thought that was still the default for some
> > arches/platforms. And they pass with -gdwarf-2.
> > 
> > > Also not sure about the -dwarf5 suffixes, couldn't we say just use
> > > pr41445-{7,8}.c, inline-var-2.C or inline3.c (or whatever next number
> > > with the same prefix is still unused)?
> > 
> > Sure, if that is a better naming scheme I'll rename them.
> 
> Here is the adjusted patch.
> 
> gcc/testsuite/ChangeLog:
> 
> * gcc.dg/debug/dwarf2/inline2.c: Add -gdwarf-2.
> * g++.dg/debug/dwarf2/inline-var-1.C: Likewise.
> * gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c: Likewise.
> * gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c: Likewise.
> * gcc.dg/debug/dwarf2/inline6.c: New variant with -gdwarf-5.
> * g++.dg/debug/dwarf2/inline-var-3.C: Likewise.
> * gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-7.c: Likewise.
> * gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-8.c: Likewise.
> 
> OK to commit?

Ok, thanks.

Jakub