aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2020-12-03 20:33:22 +0100
committerHarald Anlauf <anlauf@gmx.de>2020-12-03 20:33:22 +0100
commit30b606bb9b9314010a446ea4bed3481632008f75 (patch)
tree0940049a5dfabfad17c3a8760ae0ec9b244c9b0b /gcc/fortran/decl.c
parent656131e06aa76ba3cb50305c07cf5c8ee79fce44 (diff)
downloadgcc-30b606bb9b9314010a446ea4bed3481632008f75.zip
gcc-30b606bb9b9314010a446ea4bed3481632008f75.tar.gz
gcc-30b606bb9b9314010a446ea4bed3481632008f75.tar.bz2
PR fortran/95342 - ICE in gfc_match_subroutine, at fortran/decl.c:7913
Add checks for NULL pointers before dereferencing them. gcc/fortran/ChangeLog: PR fortran/95342 * decl.c (gfc_match_function_decl): Avoid NULL pointer dereference. (gfc_match_subroutine): Likewise. gcc/testsuite/ChangeLog: PR fortran/95342 * gfortran.dg/pr95342.f90: New test.
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 93a155c..c85ae0d 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -7408,6 +7408,7 @@ gfc_match_function_decl (void)
procedure interface body. */
if (sym->attr.is_bind_c && sym->attr.module_procedure && sym->old_symbol
&& strcmp (sym->name, sym->old_symbol->name) == 0
+ && sym->binding_label && sym->old_symbol->binding_label
&& strcmp (sym->binding_label, sym->old_symbol->binding_label) != 0)
{
const char *null = "NULL", *s1, *s2;
@@ -7923,6 +7924,7 @@ gfc_match_subroutine (void)
procedure interface body. */
if (sym->attr.module_procedure && sym->old_symbol
&& strcmp (sym->name, sym->old_symbol->name) == 0
+ && sym->binding_label && sym->old_symbol->binding_label
&& strcmp (sym->binding_label, sym->old_symbol->binding_label) != 0)
{
const char *null = "NULL", *s1, *s2;