On 10/17/2017 04:46 PM, Jakub Jelinek wrote:
On Tue, Oct 17, 2017 at 04:42:58PM +0200, Tom de Vries wrote:
I found the culprit, in gfortran-dg-runtest:
...
         # look if this is dg-do-run test, in which case

         # we cycle through the option list, otherwise we don't

         if [expr [search_for $test "dg-do run"]] {
             set option_list $torture_with_loops
        } else {
             set option_list [list { -O } ]
         }
...
This doesn't take dg-do-what-default into account. [ Note that this search
also triggers on '! bla bla dg-do run bla bla' ]

Attached patch fixes this.

Tested on x86_64 with test-case
libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90.

Verified that that adding '! dg-do compiler' switches back to running with
'-O'.

OK, if full testing is ok?

I believe this was fully intentional and the presence/absence of
explicit dg-do run can then be used to decide if it should loop through
options or not.

I don't see an explicit mention of ignoring dg-do-what-default in the original submission ( https://gcc.gnu.org/ml/fortran/2004-07/msg00166.html ). It was written in a dg-do-what-default == compile context, and I think the dg-do-what-default == run scenario was overlooked. Note also that the comment says it's trying to determine if it's a 'dg-do-run test', not if it contains a 'dg-do run' string.

Thomas stumbled upon the same problem here ( https://gcc.gnu.org/ml/fortran/2013-08/msg00042.html ). AFAIU, the reply from Mikael Morin here ( https://gcc.gnu.org/ml/fortran/2013-08/msg00044.html ) implies that he would consider it a bug if dg-do-what-default would be 'run' for gfortran.dg.

Perhaps this behaviour has been intentionally exploited in the libgomp testsuite. But it is confusing to me, and evidently to others as well.

Thanks,
- Tom   

Reply via email to