This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3] Fix Werror breakage (maintainer-mode)
* Richard Guenther wrote on Mon, Jul 07, 2008 at 11:22:23AM CEST:
> On Mon, Jul 7, 2008 at 8:10 AM, Ian Lance Taylor <iant@google.com> wrote:
> > Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
> >
> >> Can somebody enlighten me as to a proper locale_init.cc fix?
> > I don't understand why locale_init.cc is giving an aliasing warning at
> > all. The line seems to b
> > return reinterpret_cast<const locale&>(c_locale);
> > c_locale is a char array, and as such may be aliased to anything.
>
> This is a common misconception.
>
> char c[4];
> return (int *)&c[0];
>
> is invoking undefined behavior. All the warning machinery sees here
> is (const locale &)&c_locale in some form. The warning
> (it's a "may") is only invalid because at a different place in the program
> the dynamic type of c_local is changed to locale.
The warning that I reported was a "will break strict aliasing",
not a "may" one.
Anyway, I have now merely applied the other, unwind-pe.h fix,
trunk and 4.3, which is what PR34780 was about. Should I open
a new PR for the locale_init.cc issue?
Thanks,
Ralf