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, rfc] Semantics of attribute (aligned), misscompilation of crtstuff


Zdenek Dvorak wrote:
> Hi,
> 
>> 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! :-) :-)
> 
> no, it does not -- crtstuff is still invalid.

It's not interesting to a user of GCC whether or crtstuff.c is fully
conformant C, or whether every possible set of options used to compile
it will generate valid code.  The only interesting thing to the user is
whether or not the startup code we provide works.  If you turn off
vectorization, do the resulting crtbegin.o/crtend.o files work?

>>> 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.
> 
> OK, I did not really follow your suggestion; could you please implement
> this fix?

I think it would be a better use of time to fix a serious bug in the
compiler.  But, I'm happy to try to explain the suggestion in more
detail if you're excited about cleaning this up.  Otherwise, let's just
turn off vectorization and move on.  If the problem ever occurs again
(rather than just being a theoretical possibility) we can look at the
problem then.

I agree that it would be nice to clean this up so that it's fully robust
against all possible option combinations, but it just doesn't seem
worthwhile to me.  In fact, I'd expect it makes sense to turn off
vectorization for all of libgcc, if for no other reason than to avoid
pessimizing the data layout by introducing unnecessary padding.  Are we
actually vectorizing anything in libgcc?

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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