diff mbox

Fix incorrect discriminator assignment.

Message ID CAO2gOZU6_0ciDN5eAangX+LNyv33V7wkSFywz=nfomBjnHwiUA@mail.gmail.com
State New
Headers show

Commit Message

Dehao Chen May 28, 2013, 10:56 p.m. UTC
ChangeLog fix patch committed in r199394.

The attached patch restricts the test only run on linux-gnu targets. Is it ok?

Thanks

Dehao

gcc/ChangeLog:

2013-05-28  Dehao Chen  <dehao@google.com>
testsuite/debug/dwarf2/discriminator.c: Restrict the test to linux only.

discriminator 2\n" } } */

Comments

Cary Coutant May 29, 2013, 12:51 a.m. UTC | #1
> The attached patch restricts the test only run on linux-gnu targets. Is it ok?

Ideally we would restrict the test to those targets where
HAVE_AS_DWARF2_DEBUG_LINE is set, but I don't think that can be done
in dg. OK if no one suggests a way to do exactly that.

-cary


> gcc/ChangeLog:
>
> 2013-05-28  Dehao Chen  <dehao@google.com>
> testsuite/debug/dwarf2/discriminator.c: Restrict the test to linux only.
>
> Index: gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c (revision 199393)
> +++ gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c (working copy)
> @@ -1,4 +1,4 @@
> -/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
> +/* { dg-do compile { target { i?86-*-linux-gnu x86_64-*-linux-gnu } } } */
>  /* { dg-options "-O0 -gdwarf-2" } */
>  /* { dg-final { scan-assembler "loc \[0-9] 9 \[0-9]( is_stmt \[0-9])?\n" } } */
>  /* { dg-final { scan-assembler "loc \[0-9] 9 \[0-9]( is_stmt \[0-9])?
> discriminator 2\n" } } */
Mike Stump May 29, 2013, 2:23 a.m. UTC | #2
On May 28, 2013, at 3:56 PM, Dehao Chen <dehao@google.com> wrote:
> The attached patch restricts the test only run on linux-gnu targets. Is it ok?

Ok.  You can put HAVE_AS_DWARF2_DEBUG_LINE in a comment above it to help explain why the target restriction applies.  The idea is, if enough people care, or some x86 target (say, darwin), want to reliably find them all, one can then search for that and fix them all in one go.
Rainer Orth May 29, 2013, 9:24 a.m. UTC | #3
Mike Stump <mrs@mrs.kithrup.com> writes:

> On May 28, 2013, at 3:56 PM, Dehao Chen <dehao@google.com> wrote:
>> The attached patch restricts the test only run on linux-gnu targets. Is it ok?
>
> Ok.  You can put HAVE_AS_DWARF2_DEBUG_LINE in a comment above it to help
> explain why the target restriction applies.  The idea is, if enough people
> care, or some x86 target (say, darwin), want to reliably find them all, one
> can then search for that and fix them all in one go.

Right, this does work e.g. on Solaris/x86 with gas, but fails with Sun
as or Darwin as.

Btw., why is this even x86 specific?  At least on Solaris/SPARC with
gas, HAVE_AS_DWARF2_DEBUG_LINE *is* defined.

And why do you add -gdwarf-2 in dg-options?  AFAICS all tests in
gcc.dg/debug/dwarf2 are built with -gdwarf-2 anyway.  Perhaps you need
just { dg-additional-options "-O0" } instead?

Also, please mention PR testsuite/57413 in the ChangeLog and move the
addition of the testcase from gcc/ChangeLog to gcc/testsuite/ChangeLog,
removing the testsuite/ prefix in the pathname.

Thanks.
        Rainer
Dehao Chen May 29, 2013, 3:50 p.m. UTC | #4
Patch updated and committed as r199412.

Thanks,
Dehao
Andreas Schwab May 30, 2013, 8:40 a.m. UTC | #5
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> And why do you add -gdwarf-2 in dg-options?  AFAICS all tests in
> gcc.dg/debug/dwarf2 are built with -gdwarf-2 anyway.

Do they?  Not here.

Executing on host: /daten/aranym/gcc/gcc-20130530/Build/gcc/xgcc -B/daten/aranym/gcc/gcc-20130530/Build/gcc/ /daten/aranym/gcc/gcc-20130530/gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c  -fno-diagnostics-show-caret -fdiagnostics-color=never  -ansi -pedantic-errors -O0 -ffat-lto-objects -ffat-lto-objects -ffat-lto-objects -S  -o discriminator.s    (timeout = 300)
spawn /daten/aranym/gcc/gcc-20130530/Build/gcc/xgcc -B/daten/aranym/gcc/gcc-20130530/Build/gcc/ /daten/aranym/gcc/gcc-20130530/gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c -fno-diagnostics-show-caret -fdiagnostics-color=never -ansi -pedantic-errors -O0 -ffat-lto-objects -ffat-lto-objects -ffat-lto-objects -S -o discriminator.s
PASS: gcc.dg/debug/dwarf2/discriminator.c (test for excess errors)
FAIL: gcc.dg/debug/dwarf2/discriminator.c scan-assembler loc [0-9] 11 [0-9]( is_stmt [0-9])?\n
FAIL: gcc.dg/debug/dwarf2/discriminator.c scan-assembler loc [0-9] 11 [0-9]( is_stmt [0-9])? discriminator 2\n
FAIL: gcc.dg/debug/dwarf2/discriminator.c scan-assembler loc [0-9] 11 [0-9]( is_stmt [0-9])? discriminator 1\n

Andreas.
Dehao Chen May 30, 2013, 3 p.m. UTC | #6
On Thu, May 30, 2013 at 1:40 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
>> And why do you add -gdwarf-2 in dg-options?  AFAICS all tests in
>> gcc.dg/debug/dwarf2 are built with -gdwarf-2 anyway.
>
> Do they?  Not here.
>
> Executing on host: /daten/aranym/gcc/gcc-20130530/Build/gcc/xgcc -B/daten/aranym/gcc/gcc-20130530/Build/gcc/ /daten/aranym/gcc/gcc-20130530/gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c  -fno-diagnostics-show-caret -fdiagnostics-color=never  -ansi -pedantic-errors -O0 -ffat-lto-objects -ffat-lto-objects -ffat-lto-objects -S  -o discriminator.s    (timeout = 300)
> spawn /daten/aranym/gcc/gcc-20130530/Build/gcc/xgcc -B/daten/aranym/gcc/gcc-20130530/Build/gcc/ /daten/aranym/gcc/gcc-20130530/gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c -fno-diagnostics-show-caret -fdiagnostics-color=never -ansi -pedantic-errors -O0 -ffat-lto-objects -ffat-lto-objects -ffat-lto-objects -S -o discriminator.s
> PASS: gcc.dg/debug/dwarf2/discriminator.c (test for excess errors)
> FAIL: gcc.dg/debug/dwarf2/discriminator.c scan-assembler loc [0-9] 11 [0-9]( is_stmt [0-9])?\n
> FAIL: gcc.dg/debug/dwarf2/discriminator.c scan-assembler loc [0-9] 11 [0-9]( is_stmt [0-9])? discriminator 2\n
> FAIL: gcc.dg/debug/dwarf2/discriminator.c scan-assembler loc [0-9] 11 [0-9]( is_stmt [0-9])? discriminator 1\n

That's weird cause in dwarf2.exp:

# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
    set DEFAULT_CFLAGS " -ansi -pedantic-errors -gdwarf-2"
}

But anyway, shall I add the -gdwarf-2 option back to discriminator.c?

Dehao

>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
Cary Coutant May 30, 2013, 5:41 p.m. UTC | #7
> That's weird cause in dwarf2.exp:
>
> # If a testcase doesn't have special options, use these.
> global DEFAULT_CFLAGS
> if ![info exists DEFAULT_CFLAGS] then {
>     set DEFAULT_CFLAGS " -ansi -pedantic-errors -gdwarf-2"
> }
>
> But anyway, shall I add the -gdwarf-2 option back to discriminator.c?

I think that gets overridden by dg-options. If you use {
dg-additional-options "-O2" } instead, it should still pass -gdwarf-2
(along with the other two).

-cary
Dehao Chen May 30, 2013, 5:58 p.m. UTC | #8
On Thu, May 30, 2013 at 10:41 AM, Cary Coutant <ccoutant@google.com> wrote:
>> That's weird cause in dwarf2.exp:
>>
>> # If a testcase doesn't have special options, use these.
>> global DEFAULT_CFLAGS
>> if ![info exists DEFAULT_CFLAGS] then {
>>     set DEFAULT_CFLAGS " -ansi -pedantic-errors -gdwarf-2"
>> }
>>
>> But anyway, shall I add the -gdwarf-2 option back to discriminator.c?
>
> I think that gets overridden by dg-options. If you use {
> dg-additional-options "-O2" } instead, it should still pass -gdwarf-2
> (along with the other two).

In the current test, I didn't use dg-options, but dg-additional-options instead:

/* { dg-additional-options "-O0" } */

Dehao
>
> -cary
Rainer Orth May 31, 2013, noon UTC | #9
Dehao Chen <dehao@google.com> writes:

> On Thu, May 30, 2013 at 10:41 AM, Cary Coutant <ccoutant@google.com> wrote:
>>> That's weird cause in dwarf2.exp:
>>>
>>> # If a testcase doesn't have special options, use these.
>>> global DEFAULT_CFLAGS
>>> if ![info exists DEFAULT_CFLAGS] then {
>>>     set DEFAULT_CFLAGS " -ansi -pedantic-errors -gdwarf-2"
>>> }
>>>
>>> But anyway, shall I add the -gdwarf-2 option back to discriminator.c?
>>
>> I think that gets overridden by dg-options. If you use {
>> dg-additional-options "-O2" } instead, it should still pass -gdwarf-2
>> (along with the other two).
>
> In the current test, I didn't use dg-options, but dg-additional-options instead:
>
> /* { dg-additional-options "-O0" } */

Indeed, and I see -ansi -pedantic-errors -gdwarf-2 -O0 used for the test
on both x86_64-unknown-linux-gnu and i386-pc-solaris2.10 (if I augment
the target clause).

Something unusual seems to be going on with Andreas' testing.  Any
RUNTESTFLAGS or DEJAGNU options in the environment?

	Rainer
Rainer Orth May 31, 2013, 12:03 p.m. UTC | #10
Andreas Schwab <schwab@linux-m68k.org> writes:

> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
>> And why do you add -gdwarf-2 in dg-options?  AFAICS all tests in
>> gcc.dg/debug/dwarf2 are built with -gdwarf-2 anyway.
>
> Do they?  Not here.
>
> Executing on host: /daten/aranym/gcc/gcc-20130530/Build/gcc/xgcc
> -B/daten/aranym/gcc/gcc-20130530/Build/gcc/
> /daten/aranym/gcc/gcc-20130530/gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c
> -fno-diagnostics-show-caret -fdiagnostics-color=never -ansi
> -pedantic-errors -O0 -ffat-lto-objects -ffat-lto-objects -ffat-lto-objects
> -S -o discriminator.s (timeout = 300)
> spawn /daten/aranym/gcc/gcc-20130530/Build/gcc/xgcc
> -B/daten/aranym/gcc/gcc-20130530/Build/gcc/
> /daten/aranym/gcc/gcc-20130530/gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c
> -fno-diagnostics-show-caret -fdiagnostics-color=never -ansi
> -pedantic-errors -O0 -ffat-lto-objects -ffat-lto-objects -ffat-lto-objects
> -S -o discriminator.s
> PASS: gcc.dg/debug/dwarf2/discriminator.c (test for excess errors)
> FAIL: gcc.dg/debug/dwarf2/discriminator.c scan-assembler loc [0-9] 11
> [0-9]( is_stmt [0-9])?\n
> FAIL: gcc.dg/debug/dwarf2/discriminator.c scan-assembler loc [0-9] 11
> [0-9]( is_stmt [0-9])? discriminator 2\n
> FAIL: gcc.dg/debug/dwarf2/discriminator.c scan-assembler loc [0-9] 11
> [0-9]( is_stmt [0-9])? discriminator 1\n

Could you please run just copy site.exp from one of the testsuite/gcc*
directories to a new directory and run

% runtest --tool gcc dwarf2.exp=discriminator.c

there?  Maybe this gives a clue.

Thanks.
        Rainer
Andreas Schwab May 31, 2013, 3:13 p.m. UTC | #11
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> Indeed, and I see -ansi -pedantic-errors -gdwarf-2 -O0 used for the test
> on both x86_64-unknown-linux-gnu and i386-pc-solaris2.10 (if I augment
> the target clause).

DEFAULT_CFLAGS is set by many *.exp files.  dwarf2.exp will not
overwrite an existing definition, so using anthing different from "-ansi
-pedantic-errors" will not work.

Andreas.
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c (revision 199393)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c (working copy)
@@ -1,4 +1,4 @@ 
-/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-do compile { target { i?86-*-linux-gnu x86_64-*-linux-gnu } } } */
 /* { dg-options "-O0 -gdwarf-2" } */
 /* { dg-final { scan-assembler "loc \[0-9] 9 \[0-9]( is_stmt \[0-9])?\n" } } */
 /* { dg-final { scan-assembler "loc \[0-9] 9 \[0-9]( is_stmt \[0-9])?