[Bug target/82002] [8 Regression] ICE in sp_valid_at, at config/i386/i386.c:13233

daniel.santos at pobox dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 30 04:25:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82002

--- Comment #1 from Daniel Santos <daniel.santos at pobox dot com> ---
(In reply to Martin Liška from comment #0)
> Starting from r251321 we ICE on:
> 
> $ cat stack-check.ii
> void a (char *);
> void
> b ()
> {
>   char c[10000000000];
>   c[1099511627776] = 'b';
>   a (c);
>   a (c);
> }
> 
> $ g++ stack-check.ii -Ofast -mstackrealign -mabi=ms

Thanks for the report!  I added a new check to catch things that shouldn't be
and it this is good because this invokes a code path that hadn't gotten yet.

      if (TARGET_64BIT
          && m->fs.sp_offset > 0x7fffffff
          && sp_valid_at (frame.stack_realign_offset)
          && (frame.nsseregs + frame.nregs) != 0)
        {
          pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
                                     GEN_INT (m->fs.sp_offset
                                              - frame.sse_reg_save_offset),
                                     style,
                                     m->fs.cfa_reg == stack_pointer_rtx);
        }

The 3rd test in that if statement used to be m->fs.sp_valid, but I changed the
way we manage that so that it's valid for some offsets but not others.  I think
that this should be sp_valid_at (frame.stack_realign_offset + 1) however --
stack-grows-down math is still new and weird to me.  I'll spend some more time
with this tomorrow, but I think that one change is correct.


More information about the Gcc-bugs mailing list