http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46331
--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-07 14:32:47 UTC --- Patch: The part removed too agressively decides if an expression is constant. In the case of rand(), the result obviously does not reduce to a constant but the array constructor was expanded. Returning zero here means the function is not constant and therefore the array is not expanded at compile time. Regression tested OK on x86-64. Index: expr.c =================================================================== --- expr.c (revision 166382) +++ expr.c (working copy) @@ -900,7 +900,6 @@ int gfc_is_constant_expr (gfc_expr *e) { gfc_constructor *c; - gfc_actual_arglist *arg; if (e == NULL) return 1; @@ -921,19 +920,8 @@ gfc_is_constant_expr (gfc_expr *e) /* Specification functions are constant. */ if (check_specification_function (e) == MATCH_YES) return 1; + return 0; - /* Call to intrinsic with at least one argument. */ - if (e->value.function.isym && e->value.function.actual) - { - for (arg = e->value.function.actual; arg; arg = arg->next) - if (!gfc_is_constant_expr (arg->expr)) - return 0; - - return 1; - } - else - return 0; - case EXPR_CONSTANT: case EXPR_NULL: return 1;