This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] Fix Werror breakage (maintainer-mode)
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Ian Lance Taylor" <iant at google dot com>
- Cc: "Ralf Wildenhues" <Ralf dot Wildenhues at gmx dot de>, gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Mon, 7 Jul 2008 11:22:23 +0200
- Subject: Re: [v3] Fix Werror breakage (maintainer-mode)
- References: <20080706094423.GB29777@ins.uni-bonn.de> <m3y74e442r.fsf@google.com>
On Mon, Jul 7, 2008 at 8:10 AM, Ian Lance Taylor <iant@google.com> wrote:
> Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
>
>> Now, the unwind-pe.h patch below should fix the PR. But I'm not sure
>> how to fix the cast, so the patch below is a cheap GNU make-specific
>> hack to work around the issue.
>>
>> Can somebody enlighten me as to a proper locale_init.cc fix?
>>
>> OK to apply the gcc/ patch to trunk? What about 4.3 (that was what the
>> report was against)?
>>
>> This survived some bootstraps & regtests on i686-pc-linux-gnu.
>>
>> Thanks,
>> Ralf
>>
>> gcc/ChangeLog:
>> 2008-07-06 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>>
>> PR target/34780
>> * unwind-pe.h (size_of_encoded_value): add attribute unused.
>
> This patch is OK. Thanks.
>
> 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.
Richard.