This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] Fix Werror breakage (maintainer-mode)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]