On Fri, May 24, 2019 at 11:28:34AM +0100, Mark Eggleston wrote:
> > FAIL: gfortran.dg/fmt_f_default_field_width_3.f90   -O   (test for
> > errors, line 33)
> > PASS: gfortran.dg/fmt_f_default_field_width_3.f90   -O  (test for excess 
> > errors)
> > 
> > that is, it seems there's no error message generated for line 33.
> > 
> > Christophe
> > 
> 
> There is no error for line 33 because it isn't included in the compilation
> because __GFC_REAL_16__ isn't defined. DejaGnu doesn't know this and the
> dg-warning directive for this line is still processed.
> 
> I don't know enough about DejaGnu directives to determine whether this
> situation can be handled. Does anybody know how to deal with a line that if
> compiled a warning message output and if not compiled there is no output?
> 
> Is the easiest solution to omit the test code where kind=16?

You can do (pseudo patch, untested):
 #ifdef __GFC_REAL_16__
      real_16 = 4.18
-     write(buffer, fmt) ':',real_16,':' ! { dg-error "Positive width required" 
}
+     write(buffer, fmt) ':',real_16,':' ! { dg-error "Positive width required" 
"" { target fortran_real_16 } }
 #endif

Effective target fortran_real_16 should be true whenever:
        real(kind=16) :: x
        x = cos (x)
        end
compiles and links into an executable without diagnostics.

        Jakub

Reply via email to