[Bug target/68701] [4.9/5/6 Regression] "gcc -m32 -finstrument-functions -ffixed-ebp" produces internal compiler error
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Dec 8 11:25:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68701
--- Comment #10 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #7)
> (In reply to Uroš Bizjak from comment #6)
> > > Yeah. Or if neither -m{,no-}accumulate-outgoing-args is specified, perhaps
> > > turn that on automatically instead if -ffixed-ebp and only error out if
> > > explicit -mno-accumulate-outgoing-args?
> >
> > IMO, this is a good idea.
>
> Perhaps a warning should be emitted when switching
> MASK_ACCUMULATE_OUTGOING_ARGS option automatically, again as is already the
> case with stack probe (i386.c, around line 5294).
Something like following patch:
--cut here--
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 231398)
+++ config/i386/i386.c (working copy)
@@ -5296,6 +5296,15 @@ ix86_option_override_internal (bool main_args_p,
opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
}
+ 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;
--cut here--
This problem can also be triggered with stack realignment, e.g. "-ffixed-ebp
-mstackrealign" on 32 and 64-bit targets with following test case:
--cut here--
typedef float V __attribute__((vector_size(16)));
void bar (V a)
{
volatile V b = a;
}
--cut here--
So, to avoid problems, I think that "-ffixed-ebp" should unconditionally enable
M_A_O_A on all targets, with a warning, as proposed in the above patch.
More information about the Gcc-bugs
mailing list