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: avoid alignment of static variables affecting stack's


On Thu, Oct 23, 2014 at 07:30:27AM +0100, Jan Beulich wrote:
> Function (or more narrow) scope static variables (as well as others not
> placed on the stack) should also not have any effect on the stack
> alignment. I noticed the issue first with Linux'es dynamic_pr_debug()
> construct using an 8-byte aligned sub-file-scope local variable.
> 
> According to my checking bad behavior started with 4.6.x (4.5.3 was
> still okay), but generated code got quite a bit worse as of 4.9.0.

If the static/external var has BLKmode, then perhaps it is safe, but I
wonder about other vars, say vectors etc.  Such vars are most likely
loaded from their memory location, and if for some reason that needs to be
spilled again, stack realignment would not be able to do that.
Or do we inspect the IL and for any pseudos with modes needing larger
alignment we adjust the dynamic stack realignment fields?

	Jakub


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