This is the mail archive of the
mailing list for the GCC project.
RE: [PATCH] Portable Volatility Warning
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Hans-Peter Nilsson <hp at bitrange dot com>, Richard Biener <richard dot guenther at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 5 Sep 2013 13:43:05 +0200
- Subject: RE: [PATCH] Portable Volatility Warning
- Authentication-results: sourceware.org; auth=none
- References: <DUB122-W1C81DDDE3D71BB5B08142E4310 at phx dot gbl> <CAFiYyc3=h6uiQ+7zfNMxYsrUfe5wRAGO=0ueZh-4sh8OAPQCew at mail dot gmail dot com>,<alpine dot BSF dot 2 dot 02 dot 1309041942150 dot 92727 at arjuna dot pair dot com>
On Wed, 4 Sep 2013 19:48:13, Hans-Peter Nilsson wrote:
> On Tue, 3 Sep 2013, Richard Biener wrote:
>> I think the warning can be completely implemented inside struct-layout.c
>> for example in finish_bitfield_representative (if you pass that the first field
>> in the group, too). Of course that is at the expense of warning for
>> struct declarations rather than actual code differences (the struct may
>> not be used)
> FWIW, I don't feeling stringly whether this is ok or not, but I
> *think* missing warnings for (unused) declarations is ok; we are
> (ok, I am) interested in semantic differences for generated
> code, not declarations.
> brgds, H-P
Well, the way I see this is as follows:
If the generated code depends on whether -fstrict-volatile-bitfileds setting,
a warning should be generated.
Of course there should be no false-positives. Otherwise this feature would be useless.
The generated code depends on:
- If the member is a bit field. (and not only a unaligned data value)
- If the member is declared volatile.
- If the object is declared volatile.
- If the pointer is declared volatile.
- The alignment of the structure.
- The alignment of the access.
That's why I chose that approach, otherwise I would only warn on every bit field,
and that would be silly.
Richard, I hope this discussion is not holding up Sandra's patch.
At least Parts 1-3 are completely non-controversial.