This is the mail archive of the 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, rfc] Semantics of attribute (aligned), misscompilation of crtstuff

Zdenek Dvorak wrote:

>> So, I think we should just turn the vectorizer off when compiling this file.
> I don't agree -- that does not solve anything. 

Sure it does -- the bug goes away! :-) :-)

I understand what you're saying, but from a user's point of view,
turning off vectorization produces a perfectly good product.

> Any time in the future
> we may add another optimization that changes the alignment of global
> variables, and the problem will repeat (it seems even possible that some
> change in as could expose this problem).

crtstuff is something of a hack.  It's a GNU C implementation of what is
necessarily very low-level code.  That's why I did suggest what I think
is a better solution, with the long-term correctness properties you're
looking for -- drop the C declarations of these arrays, and declare them
at the assembly level.

Another option would be something like:

  #pragma GCC ctor_begin

and then the compiler itself could emit the right code for the target.

If we define the variables in C, then (without adding features to the
compiler that we don't presently have), we cannot guarantee that there
is no unnecessary padding.  And, unnecessary padding is a pessimization.

So, the only choices I see that don't deliver inferior results for the
user are (1) disable vectorization, or (2) enhance the compiler with new
features that allow us to specify alignment precisely, or (3) provide
per-target assembly code macros to generate the begin/end markers.

I guess I think that (2) is abstractly best -- but I think (1) is pretty
high on the back-for-buck scale. :-)

Mark Mitchell
(650) 331-3385 x713

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