[Bug middle-end/81724] ICE in expand_stack_vars

2021-09-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81724

--- Comment #3 from Andrew Pinski  ---
I think it comes from round_push.

  char three[8192] __attribute__ ((aligned (4096)));   \
  char four[8192] __attribute__ ((aligned (4096)));\


config/nvptx/nvptx.h:#define STACK_BOUNDARY 128
config/nvptx/nvptx.h:#define MAX_STACK_ALIGNMENT (1024 * 8)


#define MAX_SUPPORTED_STACK_ALIGNMENT MAX_STACK_ALIGNMENT


#define SUPPORTS_STACK_ALIGNMENT (MAX_STACK_ALIGNMENT > STACK_BOUNDARY)


  if (size_align % MAX_SUPPORTED_STACK_ALIGNMENT != 0)


I think the code in round_push is wrong.

[Bug middle-end/81724] ICE in expand_stack_vars

2017-08-30 Thread tschwinge at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81724

Thomas Schwinge  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-08-30
 CC||tschwinge at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Thomas Schwinge  ---
I once (months ago, and only very briefly) looked into this; here are my notes,
if that's helpful -- probably not too much.  ;-)

If I'm now reading my notes correctly, this appeared with trunk r238432
"Allocate constant size dynamic stack space in the prologue",
.

$ build-gcc/gcc/xgcc -Bbuild-gcc/gcc/
source-gcc/gcc/testsuite/gcc.dg/stack-layout-dynamic-1.c
-fno-diagnostics-show-caret -fdiagnostics-color=never
--sysroot=install/nvptx-none -O0 -fomit-frame-pointer -DSTACK_SIZE=8192
-DNO_TRAMPOLINES -DNO_LABEL_VALUES -DSIGNAL_SUPPRESS -S -isystem
build-gcc/nvptx-none/./newlib/targ-include -isystem
source-gcc/newlib/libc/include -o stack-layout-dynamic-1.s

$ build-gcc/gcc/xgcc -Bbuild-gcc/gcc/
source-gcc/gcc/testsuite/gcc.dg/stack-layout-dynamic-1.c -O0
-fomit-frame-pointer -S
[...]/source-gcc/gcc/testsuite/gcc.dg/stack-layout-dynamic-1.c: In function
'foo':
[...]/source-gcc/gcc/testsuite/gcc.dg/stack-layout-dynamic-1.c:7:6:
internal compiler error: RTL check: expected code 'const_int', have 'reg' in
expand_stack_vars, at cfgexpand.c:1196
0xaa7607 rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int,
char const*)
[...]/source-gcc/gcc/rtl.c:811
0x6a2c42 expand_stack_vars
[...]/source-gcc/gcc/cfgexpand.c:1196
0x6b1146 expand_used_vars
[...]/source-gcc/gcc/cfgexpand.c:2251
0x6b2a60 execute
[...]/source-gcc/gcc/cfgexpand.c:6237

$ build-gcc-offload-nvptx-none/gcc/xgcc -Bbuild-gcc-offload-nvptx-none/gcc/
source-gcc/gcc/testsuite/gcc.dg/stack-layout-dynamic-1.c -O0
-fomit-frame-pointer -S

#0  internal_error (gmsgid=gmsgid@entry=0x1219800 "RTL check: expected code
'%s', have '%s' in %s, at %s:%d") at [...]/source-gcc/gcc/diagnostic.c:1335
#1  0x00abfb48 in rtl_check_failed_code1 (r=r@entry=0x769c9ac8,
code=, code@entry=CONST_INT, file=,
file@entry=0x11b6a58 "[...]/source-gcc/gcc/cfgexpand.c", line=,
line@entry=1198, func=, func@entry=0x11b85b0

"expand_stack_vars") at [...]/source-gcc/gcc/rtl.c:811
#2  0x006b6bc2 in expand_stack_vars (pred=pred@entry=0x0,
data=data@entry=0x7fffcb50) at [...]/source-gcc/gcc/cfgexpand.c:1198
#3  0x006c5cf7 in expand_used_vars () at
[...]/source-gcc/gcc/cfgexpand.c:2253
#4  0x006c6252 in (anonymous namespace)::pass_expand::execute
(this=0x16d3be0, fun=0x76982b28) at [...]/source-gcc/gcc/cfgexpand.c:6239
#5  0x00a4942d in execute_one_pass (pass=pass@entry=0x16d3be0) at
[...]/source-gcc/gcc/passes.c:2344
#6  0x00a49a48 in execute_pass_list_1 (pass=0x16d3be0) at
[...]/source-gcc/gcc/passes.c:2428
#7  0x00a49aa5 in execute_pass_list (fn=0x76982b28,
pass=) at [...]/source-gcc/gcc/passes.c:2439
#8  0x0070283d in cgraph_node::expand
(this=this@entry=0x769c6000) at [...]/source-gcc/gcc/cgraphunit.c:1983
#9  0x00704274 in expand_all_functions () at
[...]/source-gcc/gcc/cgraphunit.c:2119
#10 symbol_table::compile (this=this@entry=0x768d2000) at
[...]/source-gcc/gcc/cgraphunit.c:2477
#11 0x0070646a in symbol_table::finalize_compilation_unit
(this=0x768d2000) at [...]/source-gcc/gcc/cgraphunit.c:2567
#12 0x00b12fcd in compile_file () at
[...]/source-gcc/gcc/toplev.c:490
#13 0x0055074b in do_compile () at
[...]/source-gcc/gcc/toplev.c:1998
#14 toplev::main (this=this@entry=0x7fffcf20, argc=argc@entry=20,
argv=argv@entry=0x7fffd028) at [...]/source-gcc/gcc/toplev.c:2132
#15 0x00552407 in main (argc=20, argv=0x7fffd028) at
[...]/source-gcc/gcc/main.c:39

(gdb) frame 2
#2  0x006b6bc2 in expand_stack_vars (pred=pred@entry=0x0,
data=data@entry=0x7fffcb50) at [...]/source-gcc/gcc/cfgexpand.c:1198
1198(INTVAL (large_allocsize),
(gdb) list
1193  rtx large_allocsize;
1194
1195  large_allocsize = GEN_INT (large_size);
1196  get_dynamic_stack_size (_allocsize, 0,
large_align, NULL);
1197  loffset = alloc_stack_frame_space
1198(INTVAL (large_allocsize),
1199 PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT);
1200  large_base = get_dynamic_stack_base (loffset,
large_align);
1201

[Bug middle-end/81724] ICE in expand_stack_vars

2017-08-21 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81724

--- Comment #1 from Tom de Vries  ---
More complete failure list:
...
FAIL: gcc.dg/stack-layout-dynamic-1.c (internal compiler error)
FAIL: gcc.dg/memcmp-1.c (internal compiler error)
FAIL: gcc.dg/strcmp-1.c (internal compiler error)
FAIL: gcc.dg/strncmp-1.c (internal compiler error)
...