This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] proposed fix for bug # 61144
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Rich Felker <dalias at libc dot org>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Jan Hubicka <hubicka at ucw dot cz>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 16 Jun 2014 10:56:01 +0200
- Subject: Re: [PATCH] proposed fix for bug # 61144
- Authentication-results: sourceware.org; auth=none
- References: <20140521015948 dot GA21600 at brightrain dot aerifal dot cx> <CAFiYyc0qj1Yc+VDchBYqsocT4aoyL01CMEB2LmzV3-=TcnHmBg at mail dot gmail dot com> <20140522035942 dot GG507 at brightrain dot aerifal dot cx>
> > /* Variables declared 'const' without an initializer
> > have zero as the initializer if they may not be
> > overridden at link or run time. */
> > if (!DECL_INITIAL (real_decl)
> > && (DECL_EXTERNAL (decl) || decl_replaceable_p (decl)))
> > return error_mark_node;
> >
> > Honza?
>
> Indeed, this may be a better place to do it as long as
> decl_replaceable_p reliably returns true for weak aliases. If so, the
> following might work:
>
> if ((!DECL_INITIAL (real_decl) && DECL_EXTERNAL (decl))
> || decl_replaceable_p (decl)))
> return error_mark_node;
>
> On the other hand, I might just separate it out into two separate if
> statements since they should probably have their own comments.
Yep, this looks like correct change. I used to have FIXME on this but
it seems it went away during some cleanups - the original condition was
comming from expmed's folding and indeed it looked unsafe to me.
This change is OK with the testcase (if it passes testing)
Honza
>
> I would appreciate help from anyone familiar with GCC internals on
> getting this right.
>
> Rich