From: Uros Bizjak Date: Tue, 8 Dec 2015 18:41:21 +0000 (+0100) Subject: re PR target/68701 ("gcc -m32 -finstrument-functions -ffixed-ebp" produces internal... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e5d0977ff4183b9cd21eefbfd8a27f692dc9a0a;p=gcc.git re PR target/68701 ("gcc -m32 -finstrument-functions -ffixed-ebp" produces internal compiler error) 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: PR target/68701 * testsuite/gcc.target/i386/pr68701-1.c: New test. * testsuite/gcc.target/i386/pr68701-2.c: Ditto. From-SVN: r231419 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 94331edf3aa..ed8dd112cdc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-12-08 Uros Bizjak + + PR target/68701 + * config/i386/i386.c (ix86_option_override_internal): Enable + -maccumulate-outgoing-args when %ebp is fixed due to stack + realignment requirements. + 2015-12-08 Tom de Vries PR tree-optimization/68640 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index e423b3c1897..d30fbff7af4 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 80f85c836e6..55aa177a303 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-12-08 Uros Bizjak + + PR target/68701 + * testsuite/gcc.target/i386/pr68701-1.c: New test. + * testsuite/gcc.target/i386/pr68701-2.c: Ditto. + 2015-12-08 Uros Bizjak * gcc.target/i386/sse4_1-round.h (do_round): Fix inline asm statements. diff --git a/gcc/testsuite/gcc.target/i386/pr68701-1.c b/gcc/testsuite/gcc.target/i386/pr68701-1.c new file mode 100644 index 00000000000..008eb6bddd2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68701-1.c @@ -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; +} diff --git a/gcc/testsuite/gcc.target/i386/pr68701-2.c b/gcc/testsuite/gcc.target/i386/pr68701-2.c new file mode 100644 index 00000000000..bfe592ec8ec --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68701-2.c @@ -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; +}