The following issue was found by Alessandro. (It got triggered by a
larger test case, which is required for a larger patch by Alessandro,
which is not yet finished.)
Accessing the "lower[-1]" is probably not the best idea …
Build on x86-64-linux.
OK for the trunk?
Tobias
2012-07-25 Alessandro Fanfarillo <fanfarillo....@gmail.com>
Tobias Burnus <bur...@net-b.de>
* module.c (mio_array_spec): Don't read as->lower for
assumed-rank arrays.
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index a3b9088..51b7059 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -2381,11 +2381,12 @@ mio_array_spec (gfc_array_spec **asp)
if (iomode == IO_INPUT && as->corank)
as->cotype = (as->type == AS_DEFERRED) ? AS_DEFERRED : AS_EXPLICIT;
- for (i = 0; i < as->rank + as->corank; i++)
- {
- mio_expr (&as->lower[i]);
- mio_expr (&as->upper[i]);
- }
+ if (as->rank > 0)
+ for (i = 0; i < as->rank + as->corank; i++)
+ {
+ mio_expr (&as->lower[i]);
+ mio_expr (&as->upper[i]);
+ }
done:
mio_rparen ();