------- Comment #4 from sgk at troutmask dot apl dot washington dot edu
2007-07-31 19:37 -------
Subject: Re: Wrong code with with -fdefault-integer-8
On Tue, Jul 31, 2007 at 06:56:33PM -0000, dominiq at lps dot ens dot fr wrote:
>
> > 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.
>
> Would not it be simpler to promote ("cast"?) to gfc_default_integer_kind
> the results of the intrinsic functions such as exponent?
>
That appears to work.
Index: trans-intrinsic.c
===================================================================
--- trans-intrinsic.c (revision 127065)
+++ trans-intrinsic.c (working copy)
@@ -720,7 +720,7 @@ gfc_conv_intrinsic_lib_function (gfc_se
static void
gfc_conv_intrinsic_exponent (gfc_se * se, gfc_expr * expr)
{
- tree arg, fndecl;
+ tree arg, fndecl, tmp;
gfc_expr *a1;
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
@@ -744,7 +744,8 @@ gfc_conv_intrinsic_exponent (gfc_se * se
gcc_unreachable ();
}
- se->expr = build_call_expr (fndecl, 1, arg);
+ tmp = gfc_get_int_type (gfc_default_integer_kind);
+ se->expr = fold_convert (tmp, build_call_expr (fndecl, 1, arg));
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32942