GCC with patches for OS216
リビジョン | b88744905a46be44ffa3c57d46080f601ae832b8 (tree) |
---|---|
日時 | 2020-07-03 03:48:16 |
作者 | Harald Anlauf <anlauf@gmx....> |
コミッター | Harald Anlauf |
PR fortran/93423 - ICE on invalid with argument list for module procedure
When recovering from an error, a NULL pointer dereference could occur.
Check for that situation and punt.
gcc/fortran/
PR fortran/93423
* resolve.c (resolve_symbol): Avoid NULL pointer dereference.
@@ -15918,7 +15918,7 @@ resolve_symbol (gfc_symbol *sym) | ||
15918 | 15918 | if (formal) |
15919 | 15919 | { |
15920 | 15920 | sym->formal_ns = formal->sym->ns; |
15921 | - if (sym->ns != formal->sym->ns) | |
15921 | + if (sym->formal_ns && sym->ns != formal->sym->ns) | |
15922 | 15922 | sym->formal_ns->refs++; |
15923 | 15923 | } |
15924 | 15924 | } |
@@ -0,0 +1,21 @@ | ||
1 | +! { dg-do compile } | |
2 | +! PR fortran/93423 - ICE on invalid with argument list for module procedure | |
3 | + | |
4 | +module t | |
5 | + type :: b | |
6 | + contains | |
7 | + procedure :: p => bp | |
8 | + end type b | |
9 | + interface | |
10 | + module function bp(s) | |
11 | + class(b), intent(inout) :: s | |
12 | + integer, pointer :: bp | |
13 | + end function | |
14 | + end interface | |
15 | +end module t | |
16 | + | |
17 | +submodule (t) ts | |
18 | +contains | |
19 | + module procedure bp(s) ! { dg-error "must be in a generic module interface" } | |
20 | + end procedure bp ! { dg-error "Expecting END SUBMODULE statement" } | |
21 | +end submodule ts |