https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
--- Comment #12 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Fri, Feb 21, 2020 at 08:40:22PM +0000, sgk at troutmask dot apl.washington.edu wrote: > > Ugh, this diff fixes constant-folding (without your mpc_sincos) patch. > > Index: gcc/fortran/simplify.c > =================================================================== > --- gcc/fortran/simplify.c (revision 280157) > +++ gcc/fortran/simplify.c (working copy) > @@ -7782,26 +7787,32 @@ gfc_simplify_sum (gfc_expr *array, gfc_expr *dim, gfc_ > gfc_expr * > gfc_simplify_cotan (gfc_expr *x) > { > - gfc_expr *result; > + gfc_expr *arg, *result; > mpc_t swp, *val; > > - if (x->expr_type != EXPR_CONSTANT) > + if (x->expr_type == EXPR_FUNCTION > + && strcmp(x->value.function.isym->name, "cotan") == 0) if (x->expr_type == EXPR_FUNCTION && (strcmp(x->value.function.isym->name, "cotan") == 0 || strcmp(x->value.function.isym->name, "dcotan") == 0)) Something is broken. :(