From: Uros Bizjak Date: Thu, 10 Dec 2015 16:43:49 +0000 (+0100) Subject: backport: re PR target/68701 ("gcc -m32 -finstrument-functions -ffixed-ebp" produces... X-Git-Tag: releases/gcc-4.9.4~455 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=934f4d4b6a1a4d6a7986517a75d6ff986dee9764;p=thirdparty%2Fgcc.git backport: re PR target/68701 ("gcc -m32 -finstrument-functions -ffixed-ebp" produces internal compiler error) Backport from mainline 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. testsuite/ChangeLog: Backport from mainline 2015-12-08 Uros Bizjak PR target/68701 * gcc.target/i386/pr68701-1.c: New test. * gcc.target/i386/pr68701-2.c: Ditto. From-SVN: r231529 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bd387b0019ef..38477faf1b95 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-12-10 Uros Bizjak + + Backport from mainline + 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-09 John David Anglin PR target/68729 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9b7b58a52c9d..c6d0102ae1cd 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4029,6 +4029,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 6663cb16e58a..0d506ec5b377 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2015-12-10 Uros Bizjak + + Backport from mainline + 2015-12-08 Uros Bizjak + + PR target/68701 + * gcc.target/i386/pr68701-1.c: New test. + * gcc.target/i386/pr68701-2.c: Ditto. + 2015-12-09 Uros Bizjak * gcc.target/i386/sse4_1-roundps-1.c: Remove ASM_SUFFIX define. 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 000000000000..008eb6bddd28 --- /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 000000000000..bfe592ec8ec9 --- /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; +}