Bug 21107 - [4.0/4.1/4.2 regression] internal compiler error: in expand_one_stack_var_at, at cfgexpand.c:476
[4.0/4.1/4.2 regression] internal compiler error: in expand_one_stack_var_at,...
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: middle-end
4.1.0
: P5 normal
: 4.1.0
Assigned To: Not yet assigned to anyone
: ice-on-valid-code
: 29135 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-19 14:36 UTC by Martin Kögler
Modified: 2006-09-19 04:19 UTC (History)
3 users (show)

See Also:
Host:
Target: avr-unknown-none
Build:
Known to work: 3.4.4 3.3.2
Known to fail: 4.0.0 4.0.1 4.1.0
Last reconfirmed: 2005-09-24 17:20:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Kögler 2005-04-19 14:36:08 UTC
If Pmode is smaller than the HOST_BITS_PER_WIDE_INT (ie for i686 as host all
targets, which use HImode or QImode as Pmode), a stack overflow produce the
following internal compiler error:

$./cc1 t4.c
 check1972

/homes/mkoegler/m68hc05/src/host-i686-pc-linux-gnu/gcc/test/t4.c: In function
'check1972':
/homes/mkoegler/m68hc05/src/host-i686-pc-linux-gnu/gcc/test/t4.c:7: internal
compiler error: in expand_one_stack_var_at, at cfgexpand.c:476
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
$cat t4.c
union S1972
{
  char b[24000];
};
void
check1972 ()
{
  union S1972 ret;
  union S1972 b1;
  union S1972 b2;
}

$./cc1 --version
GNU C version 4.1.0 20050416 (experimental) (avr)
        compiled by GNU C version 4.1.0 20050302 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Comment 1 Andrew Pinski 2005-04-19 14:47:14 UTC
  /* If this fails, we've overflowed the stack frame.  Error nicely?  */
  gcc_assert (offset == trunc_int_for_mode (offset, Pmode));

Hmm, I wonder if this is a regression or not.
Comment 2 Martin Kögler 2005-04-20 08:08:10 UTC
It compiles on a older version (3.3.2):
$avr-gcc -S t.c
$cat t.s
        .file   "t.c"
        .arch avr2
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
        .global __do_copy_data
        .global __do_clear_bss
        .text
.global check1972
        .type   check1972, @function
check1972:
/* prologue: frame size=72000 */
        push r28
        push r29
        in r28,__SP_L__
        in r29,__SP_H__
        subi r28,lo8(72000)
        sbci r29,hi8(72000)
        in __tmp_reg__,__SREG__
        cli
        out __SP_H__,r29
        out __SREG__,__tmp_reg__
        out __SP_L__,r28
/* prologue end (size=11) */
/* epilogue: frame size=72000 */
        subi r28,lo8(-72000)
        sbci r29,hi8(-72000)
        in __tmp_reg__,__SREG__
        cli
        out __SP_H__,r29
        out __SREG__,__tmp_reg__
        out __SP_L__,r28
        pop r29
        pop r28
        ret
/* epilogue end (size=10) */
/* function check1972 size 21 (0) */
        .size   check1972, .-check1972
/* File "t.c": code   21 = 0x0015 (   0), prologues  11, epilogues  10 */
$avr-gcc -v
Reading specs from /usr/lib/gcc-lib/avr/3.3.2/specs
Configured with: ./configure --prefix=/usr --mandir=/usr/share/man --target=avr
--enable-languages=c
Thread model: single
gcc version 3.3.2
Comment 3 Serge Belyshev 2005-04-29 12:38:31 UTC
Confirmed, note: the code is valid C.
Comment 4 Andrew Pinski 2005-04-29 12:58:17 UTC
(In reply to comment #3)
> Confirmed, note: the code is valid C.

But we should be erroring out as the stack size is just too big for this target.
Comment 5 Andrew Pinski 2006-01-29 00:26:01 UTC
Should have been fixed by:
http://gcc.gnu.org/ml/gcc-patches/2005-11/msg00508.html
Comment 6 Mark Mitchell 2006-05-25 02:35:57 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 7 Andrew Pinski 2006-09-17 19:49:57 UTC
Fixed by:
2005-11-12  Eric Botcazou  <ebotcazou@adacore.com>

        * function.c (assign_stack_local_1): Restrict sanity check
        on frame size overflow to 32-bit and above platforms.
Comment 8 Andrew Pinski 2006-09-19 04:19:55 UTC
*** Bug 29135 has been marked as a duplicate of this bug. ***