diff options
Diffstat (limited to 'libgfortran/generated/norm2_r16.c')
-rw-r--r-- | libgfortran/generated/norm2_r16.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libgfortran/generated/norm2_r16.c b/libgfortran/generated/norm2_r16.c index 5eaefb8..596195f 100644 --- a/libgfortran/generated/norm2_r16.c +++ b/libgfortran/generated/norm2_r16.c @@ -59,8 +59,15 @@ norm2_r16 (gfc_array_r16 * const restrict retarray, int continue_loop; /* Make dim zero based to avoid confusion. */ - dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; + dim = (*pdim) - 1; + + if (unlikely (dim < 0 || dim > rank)) + { + runtime_error ("Dim argument incorrect in NORM intrinsic: " + "is %ld, should be between 1 and %ld", + (long int) dim + 1, (long int) rank + 1); + } len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) |