This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] [4.5 regression] C++ ignores some aligned attributes
- From: Paul Brook <paul at codesourcery dot com>
- To: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Guenther <richard dot guenther at gmail dot com>, Steven Bosscher <stevenb dot gcc at gmail dot com>, dnovillo at google dot com, froydnj at codesourcery dot com, Mark Mitchell <mark at codesourcery dot com>
- Date: Wed, 4 Aug 2010 16:03:56 +0100
- Subject: Re: [PATCH] [4.5 regression] C++ ignores some aligned attributes
- References: <201008041419.o74EJAXY011360@d12av02.megacenter.de.ibm.com>
> > Should we be rejecting this mismatch, rather than papering over what
> > looks like user error? If the packed attribute can reduce alignment
> > then this is going to cause havoc on STRICT_ALIGN targets.
>
> Well, the only thing my patch does is to revert behavior back to what it
> was in 4.4 and earlier, after having been (clearly inadvertently) changed
> by an unrelated patch. At least Firefox relies on that behavior; Firefox
> builds would certainly break if we add the error you suggest ...
I'd argue that this is a feature. Code already broke (PR45112) once due to
mismatched alignment assumptions, so who knows what other bugs are lurking
behind this mismatch. Better to fail at compile time than runtime.
It seems rather inconsistent to require any particular behavior in the
presence of this inconsistency, but not provide a diagnostic for all the other
closely related cases that we know are still going to break. If nothing else
this seems like a missed optimization opportunity.
> That said, I have no strong opinion on what the behavior should be in
> the case of differing aligned attributes between declaration and
> definition. (However, I would suggest to keep the behavior the same
> between C and C++ whereever that makes sense.)
Fair point.
Paul