https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68566
--- Comment #12 from kargl at gcc dot gnu.org ---
(In reply to Gerhard Steinmetz from comment #11)
> Another constellation (appearing legal) :
>
>
> $ cat zz1.f90
> program p
> integer :: n(2) = [2,1]
> print *, reshape ([1,2,3,4,5,6], [2,4], [0,0], [2,1])
> print *, reshape ([1,2,3,4,5,6], [2,4], [0,0], n)
> print *, reshape ([1,2,3,4,5,6], [2,4], [0,0], [n])
> end
>
>
> $ gfortran-6 zz1.f90
> f951: internal compiler error: Segmentation fault
>
>
Index: check.c
===================================================================
--- check.c (revision 237855)
+++ check.c (working copy)
@@ -3820,7 +3820,7 @@ gfc_check_reshape (gfc_expr *source, gfc
if (!type_check (order, 3, BT_INTEGER))
return false;
- if (order->expr_type == EXPR_ARRAY)
+ if (order->expr_type == EXPR_ARRAY && gfc_is_constant_expr (order))
{
int i, order_size, dim, perm[GFC_MAX_DIMENSIONS];
gfc_expr *e;