On Fri, 24 May 2019 at 16:25, Steve Kargl
<s...@troutmask.apl.washington.edu> wrote:
>
> On Fri, May 24, 2019 at 12:33:51PM +0200, Jakub Jelinek wrote:
> > 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.
> >
>
> Christophe, can you test Jakub's proposed fix?  If it passes,
> I'll update the other testcases.
>

Yes, it's really as simple as:
diff --git a/gcc/testsuite/gfortran.dg/fmt_f_default_field_width_3.f90
b/gcc/testsuite/gfortran.dg/fmt_f_default_field_width_3.f90
index 81ed352..b924b00 100644
--- a/gcc/testsuite/gfortran.dg/fmt_f_default_field_width_3.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_f_default_field_width_3.f90
@@ -30,6 +30,6 @@ program test

 #ifdef __GFC_REAL_16__
     real_16 = 4.18
-    write(buffer, fmt) ':',real_16,':' ! { dg-error "Nonnegative
width required" }
+    write(buffer, fmt) ':',real_16,':' ! { dg-error "Nonnegative
width required" "" { target fortran_real_16 } }
 #endif
 end

because check_effective_target_fortran_real_16 already exists in
target-supports.exp (since 2011!)

Christophe



> --
> Steve

Reply via email to