https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64137
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- (In reply to Richard Biener from comment #1) > - if (op == GT_EXPR && expr->ts.type == BT_INTEGER) > + if (op == GT_EXPR && arrayexpr->ts.type == BT_INTEGER) > works for me. Looks good to me. Thanks for the patch and debugging! [Seems to be a copy'n'paste error from gfc_conv_intrinsic_minmaxval, which returns the value (= int or float) such that expr->ts.type works; the code in gfc_conv_intrinsic_minmaxloc return a location which is always an int.] > So I suppose this is a wrong-code bug as we shouldn't have > subtracted 1 off -Huge (what's that anyway?) But then is "integer -Huge" > C INT_MIN + 1? HUGE(variable) is a function which returns the largest possible value for that variable, i.e. MAX_INT for a default-kind integer or FLT_MAX for a default-kind real variable. For MAXLOC, one starts with "val = <smallest possible value>", which is MIN_INT == -MAX_INT - 1 == -HUGE() - 1 for int or FLT_MIN == -HUGE() for real with -ffinite-math or otherwise -INF for reals.