• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for OS216


Commit MetaInfo

Revisionb88744905a46be44ffa3c57d46080f601ae832b8 (tree)
Time2020-07-03 03:48:16
AuthorHarald Anlauf <anlauf@gmx....>
CommiterHarald Anlauf

Log Message

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.

Change Summary

Incremental Difference

--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -15918,7 +15918,7 @@ resolve_symbol (gfc_symbol *sym)
1591815918 if (formal)
1591915919 {
1592015920 sym->formal_ns = formal->sym->ns;
15921- if (sym->ns != formal->sym->ns)
15921+ if (sym->formal_ns && sym->ns != formal->sym->ns)
1592215922 sym->formal_ns->refs++;
1592315923 }
1592415924 }
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr93423.f90
@@ -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