This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fortran/66052 -- Prevent dereference of NULL pointer
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Mikael Morin <mikael dot morin at sfr dot fr>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 May 2015 15:53:20 -0700
- Subject: Re: [PATCH] fortran/66052 -- Prevent dereference of NULL pointer
- Authentication-results: sourceware.org; auth=none
- References: <20150515151915 dot GG82729 at troutmask dot apl dot washington dot edu> <555730E6 dot 7050703 at sfr dot fr>
On Sat, May 16, 2015 at 01:58:30PM +0200, Mikael Morin wrote:
> > 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.
>
Committed ar r223324 with your suggested change. Indeed,
a better error messaage emitted.
--
Steve