+2017-12-26 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/83540
+ * frontend-passes.c (create_var): If an array to be created
+ has unknown size and -fno-realloc-lhs is in effect,
+ return NULL.
+
2017-12-22 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Eric Botcazou <ebotcazou@adacore.com>
if (e->expr_type == EXPR_CONSTANT || is_fe_temp (e))
return gfc_copy_expr (e);
+ /* Creation of an array of unknown size requires realloc on assignment.
+ If that is not possible, just return NULL. */
+ if (flag_realloc_lhs == 0 && e->rank > 0 && e->shape == NULL)
+ return NULL;
+
ns = insert_block ();
if (vname)
+2017-12-26 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/83540
+ * gfortran.dg/inline_matmul_20.f90: New test.
+
2017-12-26 Tom de Vries <tom@codesourcery.com>
* c-c++-common/unroll-5.c: Use relative line number.
--- /dev/null
+! { dg-do run }
+! { dg-additional-options "-fno-realloc-lhs -ffrontend-optimize" }
+! This used to segfault at runtime.
+! Original test case by Harald Anlauf.
+program gfcbug142
+ implicit none
+ real, allocatable :: b(:,:)
+ integer :: n = 5
+ character(len=20) :: line
+ allocate (b(n,n))
+ call random_number (b)
+ write (unit=line,fmt='(2I5)') shape (matmul (b, transpose (b)))
+ if (line /= ' 5 5') call abort
+end program gfcbug142