https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90765
--- Comment #1 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> --- Author: hjl Date: Fri Jun 14 16:24:56 2019 New Revision: 272296 URL: https://gcc.gnu.org/viewcvs?rev=272296&root=gcc&view=rev Log: Update preferred_stack_boundary only when expanding function call locate_and_pad_parm is called when expanding function call from initialize_argument_information and when generating function body from assign_parm_find_entry_rtl: /* Remember if the outgoing parameter requires extra alignment on the calling function side. */ if (crtl->stack_alignment_needed < boundary) crtl->stack_alignment_needed = boundary; if (crtl->preferred_stack_boundary < boundary) crtl->preferred_stack_boundary = boundary; stack_alignment_needed and preferred_stack_boundary should be updated only when expanding function call, not when generating function body. Add update_stack_alignment_for_call to update stack alignment when outgoing parameter is passed in the stack. gcc/ PR rtl-optimization/90765 * calls.c (update_stack_alignment_for_call): New function. (expand_call): Call update_stack_alignment_for_call when outgoing parameter is passed in the stack. (emit_library_call_value_1): Likewise. * function.c (locate_and_pad_parm): Don't update stack_alignment_needed and preferred_stack_boundary. gcc/testsuite/ PR rtl-optimization/90765 * gcc.target/i386/pr90765-1.c: New test. * gcc.target/i386/pr90765-2.c: Likewise. Added: trunk/gcc/testsuite/gcc.target/i386/pr90765-1.c trunk/gcc/testsuite/gcc.target/i386/pr90765-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/calls.c trunk/gcc/function.c trunk/gcc/testsuite/ChangeLog