This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [PATCH] [4.5 regression] C++ ignores some aligned attributes


> > 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


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