This is the mail archive of the
mailing list for the GCC project.
Re: [Patch] Not very subtle fix for pr61510
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: hubicka at ucw dot cz, rguenther at suse dot de
- Date: Thu, 31 Jul 2014 19:23:21 +0100
- Subject: Re: [Patch] Not very subtle fix for pr61510
- Authentication-results: sourceware.org; auth=none
- References: <20140704161638 dot GA15722 at arm dot com>
On Mon, Jun 23, 2014 at 06:43:20PM +0100, Jan Hubicka wrote:
> > On Mon, 23 Jun 2014, James Greenhalgh wrote:
> > >
> > > Hi,
> > >
> > > pr61510 is a case where cgraphunit.c::analyze_functions can end up
> > > dereferencing a NULL pointer. This is, to me, the obvious way to avoid
> > > dereferencing NULL.
> > >
> > > However, I'm not very confident that this isn't just masking some
> > > horrible and subtle bug, so I'd like some review feedback on the patch.
> > >
> > > Tested on aarch64-none-elf, where I was seeing the issue.
> > >
> > > OK?
> > Obvious in some sense to me, too, but I wonder why we don't have a cgraph
> > node
> > for it and what happens if it is created later (and then doesn't
> > have the flag set)?
> In that case we won't get the used_as_abstract_origin flag. that will make us
> to throw away the debug info if we remove it. I guess we simply want
> graph_get_create_node here. I can prepare patch tonight (after teaching)
I've spun a patch with what I think you were suggesting here.
Tested on aarch64-none-elf with no regressions to confirm it fixes the
bug and bootstrapped on x86 and aarch64 with no issues.
2014-07-31 James Greenhalgh <firstname.lastname@example.org>
* cgraphunit.c (analyze_functions): Use get_create rather than get
for decls which are clones of abstract functions.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 3080b9a..02c9fa1 100644
@@ -1047,7 +1047,7 @@ analyze_functions (void)
if (DECL_ABSTRACT_ORIGIN (decl))
struct cgraph_node *origin_node
- = cgraph_node::get (DECL_ABSTRACT_ORIGIN (decl));
+ = cgraph_node::get_create (DECL_ABSTRACT_ORIGIN (decl));
origin_node->used_as_abstract_origin = true;