This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fortran/66052 -- Prevent dereference of NULL pointer


Le 15/05/2015 17:19, Steve Kargl a écrit :
> Regression tested on trunk.  OK to commit?
> 

Hello,

> Index: gcc/fortran/decl.c
> ===================================================================
> --- gcc/fortran/decl.c	(revision 223094)
> +++ gcc/fortran/decl.c	(working copy)
> @@ -6968,7 +6968,8 @@ gfc_match_protected (void)
>    gfc_symbol *sym;
>    match m;
>  
> -  if (gfc_current_ns->proc_name->attr.flavor != FL_MODULE)
> +  if (gfc_current_ns->proc_name
> +      && gfc_current_ns->proc_name->attr.flavor != FL_MODULE)
>      {
>         gfc_error ("PROTECTED at %C only allowed in specification "
>  		  "part of a module");

Wouldn't one get a slightly better error message if using
	!gfc_current_ns->proc_name
	|| gfc_current_ns->proc_name->attr.flavor != FL_MODULE
as condition ?

OK with that change.  Thanks.

Mikael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]