This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH,fortran] Relax restrictions on KIND in SELECT CASE constructs


On Sat, Dec 18, 2004 at 03:34:04AM +0100, Tobias Schl?ter wrote:
> Steve Kargl wrote:
> > +  if (e->ts.kind != case_expr->ts.kind)
> > +    {
> > +      if (e->ts.kind == gfc_kind_max(e, case_expr))
> > +	gfc_convert_type_warn (case_expr, &e->ts, 2, 0);
> > +      else
> > +	gfc_convert_type_warn (e, &case_expr->ts, 2, 0);
> > +    }
> > +
> 
> I think since this is invalid code you should warn for the conversion (i.e.
> call gfc_convert_type), and then change the dg-error lines in the testcase you
> pointed out to dg-warning.
> 

Actually, the code in the testsuite is valid code.  It's
that the testsuite assumes that it is invalid.  Sorry
for the confusion.  No warning is necessary in that the
standard Fortran conversion is assumed.  See 7.2.3.

   subroutine (x,y)
   integer*1 x
   integer y
   if (x == y) then
   else
   end if
   end

 The standard mandates that x is promoted to the kind of
 y.  The same holds for select case.


   subroutine (x,y)
   integer*1 x
   integer y
   select case (x)
   case y
   end select
   end

These are equivalent.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]