public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* DejaGnu diagnostics checking confused, possibly related to 'dg-line'?
@ 2020-11-03 12:31 ` Thomas Schwinge
  2020-11-03 14:21   ` Thomas Schwinge
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Schwinge @ 2020-11-03 12:31 UTC (permalink / raw)
  To: gcc; +Cc: Tom de Vries, Rainer Orth, Mike Stump

[-- Attachment #1: Type: text/plain, Size: 3140 bytes --]

Hi!

Help.  Save the attached file as 'gcc/testsuite/c-c++-common/goacc/l_.c',
and then run:

    $ make check-gcc-c++ RUNTESTFLAGS=--all\ goacc.exp=l_.c

As expected for '-std=c++98' testing, which comes first:

    PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for errors, line 14)
    PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for warnings, line 11)
    PASS: c-c++-common/goacc/l_.c  -std=c++98 (test for excess errors)
    WARNING: dg-line var l1 defined, but not used
    WARNING: dg-line var l2 defined, but not used
    WARNING: dg-line var l3 defined, but not used

But then it goes on with '-std=c++14', etc. testing:

    UNRESOLVED: c-c++-common/goacc/l_.c  -std=c++14  (test for errors, line 14)
    PASS: c-c++-common/goacc/l_.c  -std=c++14  (test for warnings, line 11)
    PASS: c-c++-common/goacc/l_.c  -std=c++14 (test for excess errors)
    WARNING: dg-line var l1 defined, but not used
    WARNING: dg-line var l2 defined, but not used
    WARNING: dg-line var l3 defined, but not used
    UNRESOLVED: c-c++-common/goacc/l_.c  -std=c++17  (test for errors, line 14)
    PASS: c-c++-common/goacc/l_.c  -std=c++17  (test for warnings, line 11)
    PASS: c-c++-common/goacc/l_.c  -std=c++17 (test for excess errors)
    WARNING: dg-line var l1 defined, but not used
    WARNING: dg-line var l2 defined, but not used
    WARNING: dg-line var l3 defined, but not used
    UNRESOLVED: c-c++-common/goacc/l_.c  -std=c++2a  (test for errors, line 14)
    PASS: c-c++-common/goacc/l_.c  -std=c++2a  (test for warnings, line 11)
    PASS: c-c++-common/goacc/l_.c  -std=c++2a (test for excess errors)
    WARNING: dg-line var l1 defined, but not used
    WARNING: dg-line var l2 defined, but not used
    WARNING: dg-line var l3 defined, but not used

                    === g++ Summary ===

    # of expected passes            9
    # of unresolved testcases       3

Why is suddenly the "test for errors, line 14" an UNRESOLVED?  (The
compiler diagnostics are as expected.  This testcase doesn't depend on
'-std=[...]' at all.)

And now the "funny" thing: if I disable any of the 'dg-line' directives,
it works as expected, all-PASS.  But note that "test for errors, line 14"
doesn't even use a 'dg-line'-captured line number.  (It uses absoute line
numbers.  Same issue visible when using relative ones, or when actually
using 'dg-line' for these.)


I reduced this from a much bigger testcase, and had originally found this
not with 'check-gcc-c++' but with 'check-gcc-c': things worked fine as
long as testing just a single testcase, but broke when testing several.
(Again the symptom was that the first testcase worked fine, but the
following ones had an unexpecte UNRESOLVED for the first 'dg-error' (only
for the first!).)  Supposedly, 'check-gcc-c++' with a single testcase but
testing several variants is exhibiting the same problem.


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: l_.c --]
[-- Type: text/x-csrc, Size: 436 bytes --]

static void test(void)
{
  int i, j;

#pragma acc parallel
  {
    /* { dg-line l1 } */
    /* { dg-line l2 } */
    /* { dg-line l3 } */
   
#pragma acc loop gang
    for (i = 0; i < 10; i++)
      {
#pragma acc loop gang
	/* { dg-error "inner loop uses same OpenACC parallelism as containing loop" "" { target *-*-* } 14 } */
	/* { dg-message "containing loop" "" { target *-*-* } 11 } */
	for (j = 0; j < 10; j++)
	  ;
      }
  }
}

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

* Re: DejaGnu diagnostics checking confused, possibly related to 'dg-line'?
  2020-11-03 12:31 ` DejaGnu diagnostics checking confused, possibly related to 'dg-line'? Thomas Schwinge
@ 2020-11-03 14:21   ` Thomas Schwinge
  2020-11-24 13:16     ` Thomas Schwinge
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Schwinge @ 2020-11-03 14:21 UTC (permalink / raw)
  To: gcc, Tom de Vries; +Cc: Rainer Orth, Mike Stump

Hi!

I've investigated some more.

On 2020-11-03T13:31:53+0100, I wrote:
> Help.  Save the attached file as 'gcc/testsuite/c-c++-common/goacc/l_.c',
> and then run:
>
>     $ make check-gcc-c++ RUNTESTFLAGS=--all\ goacc.exp=l_.c
>
> As expected for '-std=c++98' testing, which comes first:
>
>     PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for errors, line 14)
>     PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for warnings, line 11)
>     PASS: c-c++-common/goacc/l_.c  -std=c++98 (test for excess errors)
>     WARNING: dg-line var l1 defined, but not used
>     WARNING: dg-line var l2 defined, but not used
>     WARNING: dg-line var l3 defined, but not used
>
> But then it goes on with '-std=c++14', etc. testing:
>
>     UNRESOLVED: c-c++-common/goacc/l_.c  -std=c++14  (test for errors, line 14)
>     PASS: c-c++-common/goacc/l_.c  -std=c++14  (test for warnings, line 11)
>     PASS: c-c++-common/goacc/l_.c  -std=c++14 (test for excess errors)
>     WARNING: dg-line var l1 defined, but not used
>     WARNING: dg-line var l2 defined, but not used
>     WARNING: dg-line var l3 defined, but not used
>     UNRESOLVED: c-c++-common/goacc/l_.c  -std=c++17  (test for errors, line 14)
>     PASS: c-c++-common/goacc/l_.c  -std=c++17  (test for warnings, line 11)
>     PASS: c-c++-common/goacc/l_.c  -std=c++17 (test for excess errors)
>     WARNING: dg-line var l1 defined, but not used
>     WARNING: dg-line var l2 defined, but not used
>     WARNING: dg-line var l3 defined, but not used
>     UNRESOLVED: c-c++-common/goacc/l_.c  -std=c++2a  (test for errors, line 14)
>     PASS: c-c++-common/goacc/l_.c  -std=c++2a  (test for warnings, line 11)
>     PASS: c-c++-common/goacc/l_.c  -std=c++2a (test for excess errors)
>     WARNING: dg-line var l1 defined, but not used
>     WARNING: dg-line var l2 defined, but not used
>     WARNING: dg-line var l3 defined, but not used
>
>                     === g++ Summary ===
>
>     # of expected passes            9
>     # of unresolved testcases       3
>
> Why is suddenly the "test for errors, line 14" an UNRESOLVED?  (The
> compiler diagnostics are as expected.  This testcase doesn't depend on
> '-std=[...]' at all.)
>
> And now the "funny" thing: if I disable any of the 'dg-line' directives,
> it works as expected, all-PASS.  But note that "test for errors, line 14"
> doesn't even use a 'dg-line'-captured line number.  (It uses absoute line
> numbers.  Same issue visible when using relative ones, or when actually
> using 'dg-line' for these.)
>
>
> I reduced this from a much bigger testcase, and had originally found this
> not with 'check-gcc-c++' but with 'check-gcc-c': things worked fine as
> long as testing just a single testcase, but broke when testing several.
> (Again the symptom was that the first testcase worked fine, but the
> following ones had an unexpecte UNRESOLVED for the first 'dg-error' (only
> for the first!).)  Supposedly, 'check-gcc-c++' with a single testcase but
> testing several variants is exhibiting the same problem.

The problem is indeed related to the "WARNING: dg-line var [...] defined,
but not used" diagnostics.  These are produced via DejaGnu 'warning'
calls, which increments 'warncnt', and once that reaches
'warning_threshold' (default per '/usr/share/dejagnu/framework.exp' is:
'set warning_threshold 3'), this triggers UNRESOLVED via
'/usr/share/dejagnu/framework.exp:record_test'.  That this UNRESOLVED
appears for the *next* testcase, must be considered some kind of bug
(improper use of 'warning'?), I suppose.

The following works around that:

    --- gcc/testsuite/lib/gcc-dg.exp
    +++ gcc/testsuite/lib/gcc-dg.exp
    @@ -1008,6 +1008,8 @@ if { [info procs saved-dg-test] == [list] } {
                } else {
                    regsub {^saved_linenr_} $varname "" org_varname
                    warning "dg-line var $org_varname defined, but not used"
    +               global warncnt
    +               incr warncnt -1
                }
            }
            unset save_linenr_varnames

..., or:

    --- gcc/testsuite/lib/gcc-dg.exp
    +++ gcc/testsuite/lib/gcc-dg.exp
    @@ -1007,7 +1007,7 @@ if { [info procs saved-dg-test] == [list] } {
                    eval unset $varname_used
                } else {
                    regsub {^saved_linenr_} $varname "" org_varname
    -               warning "dg-line var $org_varname defined, but not used"
    +               verbose "WARNING: dg-line var $org_varname defined, but not used" 0
                }
            }
            unset save_linenr_varnames

..., or hopefully something less hacky.


The question is, what quality/severity should the "dg-line var [...]
defined, but not used" diagnostic have?

For example, "FAIL":

    --- gcc/testsuite/lib/gcc-dg.exp
    +++ gcc/testsuite/lib/gcc-dg.exp
    @@ -1007,7 +1007,7 @@ if { [info procs saved-dg-test] == [list] } {
                    eval unset $varname_used
                } else {
                    regsub {^saved_linenr_} $varname "" org_varname
    -               warning "dg-line var $org_varname defined, but not used"
    +               fail "dg-line var $org_varname defined, but not used"
                }
            }
            unset save_linenr_varnames

    PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for errors, line 14)
    PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for warnings, line 11)
    PASS: c-c++-common/goacc/l_.c  -std=c++98 (test for excess errors)
    FAIL: dg-line var l1 defined, but not used
    FAIL: dg-line var l2 defined, but not used
    FAIL: dg-line var l3 defined, but not used
    PASS: c-c++-common/goacc/l_.c  -std=c++14  (test for errors, line 14)
    [...]

..., or "NOTE":

    --- gcc/testsuite/lib/gcc-dg.exp
    +++ gcc/testsuite/lib/gcc-dg.exp
    @@ -1007,7 +1007,7 @@ if { [info procs saved-dg-test] == [list] } {
                    eval unset $varname_used
                } else {
                    regsub {^saved_linenr_} $varname "" org_varname
    -               warning "dg-line var $org_varname defined, but not used"
    +               note "dg-line var $org_varname defined, but not used"
                }
            }
            unset save_linenr_varnames

    Running [...]/gcc/testsuite/g++.dg/goacc/goacc.exp ...
    PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for errors, line 14)
    PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for warnings, line 11)
    PASS: c-c++-common/goacc/l_.c  -std=c++98 (test for excess errors)
    NOTE: dg-line var l1 defined, but not used
    NOTE: dg-line var l2 defined, but not used
    NOTE: dg-line var l3 defined, but not used
    PASS: c-c++-common/goacc/l_.c  -std=c++14  (test for errors, line 14)
    [...]

..., or something else?


Grüße
 Thomas
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

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

* Re: DejaGnu diagnostics checking confused, possibly related to 'dg-line'?
  2020-11-03 14:21   ` Thomas Schwinge
@ 2020-11-24 13:16     ` Thomas Schwinge
  2020-11-30 19:46       ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Schwinge @ 2020-11-24 13:16 UTC (permalink / raw)
  To: gcc, Tom de Vries, Rainer Orth, Mike Stump

Hi!

Ping.  Anybody got an opinion on the approach we should take?


Grüße
 Thomas


On 2020-11-03T15:21:40+0100, I wrote:
> Hi!
>
> I've investigated some more.
>
> On 2020-11-03T13:31:53+0100, I wrote:
>> Help.  Save the attached file as 'gcc/testsuite/c-c++-common/goacc/l_.c',
>> and then run:
>>
>>     $ make check-gcc-c++ RUNTESTFLAGS=--all\ goacc.exp=l_.c
>>
>> As expected for '-std=c++98' testing, which comes first:
>>
>>     PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for errors, line 14)
>>     PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for warnings, line 11)
>>     PASS: c-c++-common/goacc/l_.c  -std=c++98 (test for excess errors)
>>     WARNING: dg-line var l1 defined, but not used
>>     WARNING: dg-line var l2 defined, but not used
>>     WARNING: dg-line var l3 defined, but not used
>>
>> But then it goes on with '-std=c++14', etc. testing:
>>
>>     UNRESOLVED: c-c++-common/goacc/l_.c  -std=c++14  (test for errors, line 14)
>>     PASS: c-c++-common/goacc/l_.c  -std=c++14  (test for warnings, line 11)
>>     PASS: c-c++-common/goacc/l_.c  -std=c++14 (test for excess errors)
>>     WARNING: dg-line var l1 defined, but not used
>>     WARNING: dg-line var l2 defined, but not used
>>     WARNING: dg-line var l3 defined, but not used
>>     UNRESOLVED: c-c++-common/goacc/l_.c  -std=c++17  (test for errors, line 14)
>>     PASS: c-c++-common/goacc/l_.c  -std=c++17  (test for warnings, line 11)
>>     PASS: c-c++-common/goacc/l_.c  -std=c++17 (test for excess errors)
>>     WARNING: dg-line var l1 defined, but not used
>>     WARNING: dg-line var l2 defined, but not used
>>     WARNING: dg-line var l3 defined, but not used
>>     UNRESOLVED: c-c++-common/goacc/l_.c  -std=c++2a  (test for errors, line 14)
>>     PASS: c-c++-common/goacc/l_.c  -std=c++2a  (test for warnings, line 11)
>>     PASS: c-c++-common/goacc/l_.c  -std=c++2a (test for excess errors)
>>     WARNING: dg-line var l1 defined, but not used
>>     WARNING: dg-line var l2 defined, but not used
>>     WARNING: dg-line var l3 defined, but not used
>>
>>                     === g++ Summary ===
>>
>>     # of expected passes            9
>>     # of unresolved testcases       3
>>
>> Why is suddenly the "test for errors, line 14" an UNRESOLVED?  (The
>> compiler diagnostics are as expected.  This testcase doesn't depend on
>> '-std=[...]' at all.)
>>
>> And now the "funny" thing: if I disable any of the 'dg-line' directives,
>> it works as expected, all-PASS.  But note that "test for errors, line 14"
>> doesn't even use a 'dg-line'-captured line number.  (It uses absoute line
>> numbers.  Same issue visible when using relative ones, or when actually
>> using 'dg-line' for these.)
>>
>>
>> I reduced this from a much bigger testcase, and had originally found this
>> not with 'check-gcc-c++' but with 'check-gcc-c': things worked fine as
>> long as testing just a single testcase, but broke when testing several.
>> (Again the symptom was that the first testcase worked fine, but the
>> following ones had an unexpecte UNRESOLVED for the first 'dg-error' (only
>> for the first!).)  Supposedly, 'check-gcc-c++' with a single testcase but
>> testing several variants is exhibiting the same problem.
>
> The problem is indeed related to the "WARNING: dg-line var [...] defined,
> but not used" diagnostics.  These are produced via DejaGnu 'warning'
> calls, which increments 'warncnt', and once that reaches
> 'warning_threshold' (default per '/usr/share/dejagnu/framework.exp' is:
> 'set warning_threshold 3'), this triggers UNRESOLVED via
> '/usr/share/dejagnu/framework.exp:record_test'.  That this UNRESOLVED
> appears for the *next* testcase, must be considered some kind of bug
> (improper use of 'warning'?), I suppose.
>
> The following works around that:
>
>     --- gcc/testsuite/lib/gcc-dg.exp
>     +++ gcc/testsuite/lib/gcc-dg.exp
>     @@ -1008,6 +1008,8 @@ if { [info procs saved-dg-test] == [list] } {
>               } else {
>                   regsub {^saved_linenr_} $varname "" org_varname
>                   warning "dg-line var $org_varname defined, but not used"
>     +             global warncnt
>     +             incr warncnt -1
>               }
>           }
>           unset save_linenr_varnames
>
> ..., or:
>
>     --- gcc/testsuite/lib/gcc-dg.exp
>     +++ gcc/testsuite/lib/gcc-dg.exp
>     @@ -1007,7 +1007,7 @@ if { [info procs saved-dg-test] == [list] } {
>                   eval unset $varname_used
>               } else {
>                   regsub {^saved_linenr_} $varname "" org_varname
>     -             warning "dg-line var $org_varname defined, but not used"
>     +             verbose "WARNING: dg-line var $org_varname defined, but not used" 0
>               }
>           }
>           unset save_linenr_varnames
>
> ..., or hopefully something less hacky.
>
>
> The question is, what quality/severity should the "dg-line var [...]
> defined, but not used" diagnostic have?
>
> For example, "FAIL":
>
>     --- gcc/testsuite/lib/gcc-dg.exp
>     +++ gcc/testsuite/lib/gcc-dg.exp
>     @@ -1007,7 +1007,7 @@ if { [info procs saved-dg-test] == [list] } {
>                   eval unset $varname_used
>               } else {
>                   regsub {^saved_linenr_} $varname "" org_varname
>     -             warning "dg-line var $org_varname defined, but not used"
>     +             fail "dg-line var $org_varname defined, but not used"
>               }
>           }
>           unset save_linenr_varnames
>
>     PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for errors, line 14)
>     PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for warnings, line 11)
>     PASS: c-c++-common/goacc/l_.c  -std=c++98 (test for excess errors)
>     FAIL: dg-line var l1 defined, but not used
>     FAIL: dg-line var l2 defined, but not used
>     FAIL: dg-line var l3 defined, but not used
>     PASS: c-c++-common/goacc/l_.c  -std=c++14  (test for errors, line 14)
>     [...]
>
> ..., or "NOTE":
>
>     --- gcc/testsuite/lib/gcc-dg.exp
>     +++ gcc/testsuite/lib/gcc-dg.exp
>     @@ -1007,7 +1007,7 @@ if { [info procs saved-dg-test] == [list] } {
>                   eval unset $varname_used
>               } else {
>                   regsub {^saved_linenr_} $varname "" org_varname
>     -             warning "dg-line var $org_varname defined, but not used"
>     +             note "dg-line var $org_varname defined, but not used"
>               }
>           }
>           unset save_linenr_varnames
>
>     Running [...]/gcc/testsuite/g++.dg/goacc/goacc.exp ...
>     PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for errors, line 14)
>     PASS: c-c++-common/goacc/l_.c  -std=c++98  (test for warnings, line 11)
>     PASS: c-c++-common/goacc/l_.c  -std=c++98 (test for excess errors)
>     NOTE: dg-line var l1 defined, but not used
>     NOTE: dg-line var l2 defined, but not used
>     NOTE: dg-line var l3 defined, but not used
>     PASS: c-c++-common/goacc/l_.c  -std=c++14  (test for errors, line 14)
>     [...]
>
> ..., or something else?
>
>
> Grüße
>  Thomas
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

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

* Re: DejaGnu diagnostics checking confused, possibly related to 'dg-line'?
  2020-11-24 13:16     ` Thomas Schwinge
@ 2020-11-30 19:46       ` Jeff Law
  2020-12-04 16:43         ` Maciej W. Rozycki
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Law @ 2020-11-30 19:46 UTC (permalink / raw)
  To: Thomas Schwinge, gcc, Tom de Vries, Rainer Orth, Mike Stump



On 11/24/20 6:16 AM, Thomas Schwinge wrote:
> Hi!
>
> Ping.  Anybody got an opinion on the approach we should take?
Could we set warning_threshold to a value to inhibit this behavior
completely.  It seems backwards to me that warnings have this effect.

Jeff


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

* Re: DejaGnu diagnostics checking confused, possibly related to 'dg-line'?
  2020-11-30 19:46       ` Jeff Law
@ 2020-12-04 16:43         ` Maciej W. Rozycki
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2020-12-04 16:43 UTC (permalink / raw)
  To: Jeff Law; +Cc: Thomas Schwinge, gcc, Tom de Vries, Rainer Orth, Mike Stump

On Mon, 30 Nov 2020, Jeff Law via Gcc wrote:

> > Ping.  Anybody got an opinion on the approach we should take?
> Could we set warning_threshold to a value to inhibit this behavior
> completely.  It seems backwards to me that warnings have this effect.

 Sounds like rate-limiting of some sort to me.  It may be worth enquiring 
at <dejagnu@gnu.org>, maybe Rob remembers what this was meant for.

  Maciej

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

end of thread, other threads:[~2020-12-04 16:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <464d854a-3387-ca8f-86bb-54cfc9da8767@mentor.com>
2020-11-03 12:31 ` DejaGnu diagnostics checking confused, possibly related to 'dg-line'? Thomas Schwinge
2020-11-03 14:21   ` Thomas Schwinge
2020-11-24 13:16     ` Thomas Schwinge
2020-11-30 19:46       ` Jeff Law
2020-12-04 16:43         ` Maciej W. Rozycki

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