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

Reply via email to