------- Comment #2 from sgk at troutmask dot apl dot washington dot edu  
2007-07-31 18:40 -------
Subject: Re:  Wrong code with with -fdefault-integer-8

On Tue, Jul 31, 2007 at 06:04:02PM -0000, kargl at gcc dot gnu dot org wrote:
> 
> > I have reduced the failure for intrinsic_rrspacing.f90 to:
> > 
> > integer i
> > real x
> > x = 3.0
> > print *, exponent (x)
> > i = exponent (x)
> > print *, i
> > end
> > 
> > which gives with -fdefault-integer-8
> > 
> >            8589934720
> >                                 2
> 
> trans-types.c(gfc_get_int_type) is used to build the
> gfc_int4_type_node in trans-io.h.  -fdefault-integer-8
> is probably causing gfc_int4_type_node to be set to 8
> instead of 4.
> 

Ugh!  It's worse than the above.  In iresolve.c, we have

void
gfc_resolve_exponent (gfc_expr *f, gfc_expr *x)
{
  f->ts.type = BT_INTEGER;
  f->ts.kind = gfc_default_integer_kind;
  f->value.function.name = gfc_get_string ("__exponent_%d", x->ts.kind);
}

If I change gfc_default_integer_kind to 4, gfortran produces the right
result.  So, we need to review every unilateral use of gfc_default_integer_kind
in the frontend to determine if the promotion of 4 to 8 via -fdefault-integer-8
is correct.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32942

Reply via email to