This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: In current gcc trunk: warning: dereferencing type-punned pointer will break strict-aliasing rules
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: "Nathan Sidwell" <nathan at codesourcery dot com>
- Cc: <gcc at gcc dot gnu dot org>,<fche at redhat dot com>
- Date: Mon, 13 Jun 2005 21:20:24 +0200
- Subject: Re: In current gcc trunk: warning: dereferencing type-punned pointer will break strict-aliasing rules
- References: <5460e33305061223596d9663d4@mail.gmail.com> <42AD4111.9030103@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com> wrote:
> Christian Joensson wrote:
>> I'd just like to ask if this is noticed:
>>
>> /usr/local/src/trunk/gcc/gcc/unwind-dw2.c:324: warning: dereferencing
>> type-punned pointer will break strict-aliasing rules
>> /usr/local/src/trunk/gcc/gcc/unwind-dw2.c:789: warning: dereferencing
>> type-punned pointer will break strict-aliasing rules
>> /usr/local/src/trunk/gcc/gcc/unwind-dw2.c:1005: warning:
>> dereferencing type-punned pointer will break strict-aliasing rules
>> /usr/local/src/trunk/gcc/gcc/unwind-dw2-fde.c:1024: warning:
>> dereferencing type-punned pointer will break strict-aliasing rules
>> /usr/local/src/trunk/gcc/gcc/unwind-dw2-fde-glibc.c:393: warning:
>> dereferencing type-punned pointer will break strict-aliasing rules
>
> I had not noticed this, but looking at the first one it must have
> been caused by my patch to the type punning warning. It also appears
> to be a correct warning, in that we are breaking aliasing.
I see also these in my builds:
../../../gcc/libmudflap/mf-runtime.c:320: warning: dereferencing type-punned
pointer will break strict-aliasing rules
../../../gcc/libmudflap/mf-runtime.c:323: warning: dereferencing type-punned
pointer will break strict-aliasing rules
../../../gcc/libmudflap/mf-runtime.c:326: warning: dereferencing type-punned
pointer will break strict-aliasing rules
../../../gcc/libmudflap/mf-runtime.c:329: warning: dereferencing type-punned
pointer will break strict-aliasing rules
../../../gcc/libmudflap/mf-runtime.c:333: warning: dereferencing type-punned
pointer will break strict-aliasing rules
../../../gcc/libmudflap/mf-runtime.c:336: warning: dereferencing type-punned
pointer will break strict-aliasing rules
../../../gcc/libmudflap/mf-runtime.c:339: warning: dereferencing type-punned
pointer will break strict-aliasing rules
../../../gcc/libmudflap/mf-runtime.c:342: warning: dereferencing type-punned
pointer will break strict-aliasing rules
The code is accessing a variable of enum type through an unsigned pointer.
Giovanni Bajo