https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68986
--- Comment #19 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> --- Author: hjl Date: Mon Feb 1 20:20:56 2016 New Revision: 233046 URL: https://gcc.gnu.org/viewcvs?rev=233046&root=gcc&view=rev Log: Update preferred stack boundary in ix86_update_stack_boundary __tls_get_addr must be called with 16-byte aligned stack, which is guaranted by setting preferred_stack_boundary to 128 bits. Preferred stack boundary adjustment for __tls_get_addr should be done in ix86_update_stack_boundary, not ix86_compute_frame_layout Also there is no need to over-align stack for __tls_get_addr and function with __tls_get_addr call isn't a leaf function. gcc/ Backport from mainline PR target/68986 * config/i386/i386.c (ix86_compute_frame_layout): Move stack alignment adjustment to ... (ix86_update_stack_boundary): Here. Don't over-align stack nor change stack_alignment_needed for __tls_get_addr. (ix86_finalize_stack_realign_flags): Use stack_alignment_needed if __tls_get_addr is called. gcc/testsuite/ Backport from mainline PR target/68986 * gcc.target/i386/pr68986-1.c: New test. * gcc.target/i386/pr68986-2.c: Likewise. * gcc.target/i386/pr68986-3.c: Likewise. Added: branches/gcc-5-branch/gcc/testsuite/gcc.target/i386/pr68986-1.c branches/gcc-5-branch/gcc/testsuite/gcc.target/i386/pr68986-2.c branches/gcc-5-branch/gcc/testsuite/gcc.target/i386/pr68986-3.c Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/config/i386/i386.c branches/gcc-5-branch/gcc/testsuite/ChangeLog