Hello! Attached patch fixes a compilation corner case, where -ffixed-ebp option interferes with stack realignment requirements (the realignment without -maccumulate-outgoing-args needs live %ebp).
The ICE can be worked around by adding -maccumulate-outgoing-args to compile flags, and this is what the patch does, in addition to emitting an informative warning. 2015-12-08 Uros Bizjak <ubiz...@gmail.com> PR target/68701 * config/i386/i386.c (ix86_option_override_internal): Enable -maccumulate-outgoing-args when %ebp is fixed due to stack realignment requirements. testsuite/ChangeLog: 2015-12-08 Uros Bizjak <ubiz...@gmail.com> PR target/68701 * testsuite/gcc.target/i386/pr68701-1.c: New test. * testsuite/gcc.target/i386/pr68701-2.c: Ditto. Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Patch was committed to mainline SVN and will be backported to all active branches in a couple of days. Uros.
Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 231413) +++ config/i386/i386.c (working copy) @@ -5296,6 +5296,17 @@ ix86_option_override_internal (bool main_args_p, opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS; } + /* Stack realignment without -maccumulate-outgoing-args requires %ebp, + so enable -maccumulate-outgoing-args when %ebp is fixed. */ + if (fixed_regs[BP_REG] + && !(opts->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS)) + { + if (opts_set->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS) + warning (0, "fixed ebp register requires %saccumulate-outgoing-args%s", + prefix, suffix); + opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS; + } + /* Figure out what ASM_GENERATE_INTERNAL_LABEL builds as a prefix. */ { char *p; Index: testsuite/gcc.target/i386/pr68701-1.c =================================================================== --- testsuite/gcc.target/i386/pr68701-1.c (nonexistent) +++ testsuite/gcc.target/i386/pr68701-1.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ffixed-ebp -mno-accumulate-outgoing-args" } */ + +/* { dg-warning "fixed ebp register requires" "" { target *-*-* } 0 } */ + +void foo (void); + +int +main (int argc, char *argv[]) +{ + foo (); + return argc - 1; +} Index: testsuite/gcc.target/i386/pr68701-2.c =================================================================== --- testsuite/gcc.target/i386/pr68701-2.c (nonexistent) +++ testsuite/gcc.target/i386/pr68701-2.c (working copy) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ffixed-ebp -mno-accumulate-outgoing-args -mstackrealign -msse" } */ + +/* { dg-warning "fixed ebp register requires" "" { target *-*-* } 0 } */ + +typedef float V __attribute__((vector_size(16))); + +void bar (V a) +{ + volatile V b = a; +}