Re: [PATCH] Add a -Wcast-align=strict warning

2017-09-13 Thread Joseph Myers
On Wed, 13 Sep 2017, Bernd Edlinger wrote: > So you suggest to use min_align_of_type instead of TYPE_ALIGN. > > That would also make sense for the traditional -Wcast-align on > strict-alignment targets, right? Yes, and yes (though I'm not sure if any strict-alignment targets have this

Re: [PATCH] Add a -Wcast-align=strict warning

2017-09-13 Thread Bernd Edlinger
On 09/13/17 22:03, Joseph Myers wrote: > On Wed, 13 Sep 2017, Bernd Edlinger wrote: > >> On 09/13/17 19:06, Joseph Myers wrote: >>> What does this warning do in cases where a type has different alignments >>> inside and outside structs? I'm thinking of something like >>> >>> struct s { long long

Re: [PATCH] Add a -Wcast-align=strict warning

2017-09-13 Thread Joseph Myers
On Wed, 13 Sep 2017, Bernd Edlinger wrote: > On 09/13/17 19:06, Joseph Myers wrote: > > What does this warning do in cases where a type has different alignments > > inside and outside structs? I'm thinking of something like > > > > struct s { long long x; } *p; > > /* ... */ > > (long long *)p

Re: [PATCH] Add a -Wcast-align=strict warning

2017-09-13 Thread Bernd Edlinger
On 09/13/17 19:06, Joseph Myers wrote: > What does this warning do in cases where a type has different alignments > inside and outside structs? I'm thinking of something like > > struct s { long long x; } *p; > /* ... */ > (long long *)p > > on 32-bit x86 - where long long's preferred alignment

Re: [PATCH] Add a -Wcast-align=strict warning

2017-09-13 Thread Joseph Myers
What does this warning do in cases where a type has different alignments inside and outside structs? I'm thinking of something like struct s { long long x; } *p; /* ... */ (long long *)p on 32-bit x86 - where long long's preferred alignment is 8 bytes, but in structures it's 4 bytes.

[PING] [PATCH] Add a -Wcast-align=strict warning

2017-09-11 Thread Bernd Edlinger
Ping... On 09/04/17 10:07, Bernd Edlinger wrote: > Hi, > > as you know we have a -Wcast-align warning which works only for > STRICT_ALIGNMENT targets. But occasionally it would be nice to be > able to switch this warning on even for other targets. > > Therefore I would like to add a strict

[PATCH] Add a -Wcast-align=strict warning

2017-09-04 Thread Bernd Edlinger
Hi, as you know we have a -Wcast-align warning which works only for STRICT_ALIGNMENT targets. But occasionally it would be nice to be able to switch this warning on even for other targets. Therefore I would like to add a strict version of this option which can be invoked with