public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100536] New: ICE: in expand_call, at calls.c:4980
@ 2021-05-11 16:20 cnsun at uwaterloo dot ca
  2021-05-11 22:03 ` [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-11 16:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100536
           Summary: ICE: in expand_call, at calls.c:4980
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
struct {
  union {
    union {
      union {
        union {
          union {
            union {
              double b[4];
            } a[18];
          } a[18];
        } a[18];
      } a[18];
    } a[18];
  } a[18];
} s;
baz() { bar(s); }

$ gcc-trunk  mutant.c
mutant.c:16:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   16 | baz() { bar(s); }
      | ^~~
mutant.c: In function ‘baz’:
mutant.c:16:9: warning: implicit declaration of function ‘bar’; did you mean
‘baz’? [-Wimplicit-function-declaration]
   16 | baz() { bar(s); }
      |         ^~~
      |         baz
mutant.c:16:9: sorry, unimplemented: passing too large argument on stack
   16 | baz() { bar(s); }
      |         ^~~~~~
during RTL pass: expand
mutant.c:16:9: internal compiler error: in expand_call, at calls.c:4980
0x686a4e expand_call(tree_node*, rtx_def*, int)
        /tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/calls.c:4980
0xb5fe9e expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/expr.c:11461
0xa3cfc9 expand_expr
        /tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/expr.h:301
0xa3cfc9 expand_call_stmt
        /tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:2843
0xa3cfc9 expand_gimple_stmt_1
        /tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:3847
0xa3cfc9 expand_gimple_stmt
        /tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:4011
0xa428c9 expand_gimple_basic_block
        /tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:6048
0xa4451f execute
        /tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:6732
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument
  2021-05-11 16:20 [Bug c/100536] New: ICE: in expand_call, at calls.c:4980 cnsun at uwaterloo dot ca
@ 2021-05-11 22:03 ` pinskia at gcc dot gnu.org
  2021-05-12  6:45 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-05-11 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This most likely should really be rejected as over 1GB argument size is HUGE.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument
  2021-05-11 16:20 [Bug c/100536] New: ICE: in expand_call, at calls.c:4980 cnsun at uwaterloo dot ca
  2021-05-11 22:03 ` [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument pinskia at gcc dot gnu.org
@ 2021-05-12  6:45 ` rguenth at gcc dot gnu.org
  2021-05-12 22:56 ` cnsun at uwaterloo dot ca
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-12  6:45 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
mutant.c:16:9: sorry, unimplemented: passing too large argument on stack
   16 | baz() { bar(s); }
      |         ^~~~~~

This means it's an error-recovery issue.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument
  2021-05-11 16:20 [Bug c/100536] New: ICE: in expand_call, at calls.c:4980 cnsun at uwaterloo dot ca
  2021-05-11 22:03 ` [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument pinskia at gcc dot gnu.org
  2021-05-12  6:45 ` rguenth at gcc dot gnu.org
@ 2021-05-12 22:56 ` cnsun at uwaterloo dot ca
  2021-07-04 18:21 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-12 22:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Chengnian Sun <cnsun at uwaterloo dot ca> ---
A duplicate here.



typedef struct {
  struct {
    struct {
      struct {
        struct {
          struct {
            struct {
              struct {
                struct {
                  struct {
                    struct {
                      int f;
                    } f[8];
                  } f[8];
                } f[8];
              } f[8];
            } f[8];
          } f[8];
        } f[8];
      } f[8];
    } f[8];
  } f[8];
} T;
f(w) T *w;
{
  int i;
  g(w[i]);
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument
  2021-05-11 16:20 [Bug c/100536] New: ICE: in expand_call, at calls.c:4980 cnsun at uwaterloo dot ca
                   ` (2 preceding siblings ...)
  2021-05-12 22:56 ` cnsun at uwaterloo dot ca
@ 2021-07-04 18:21 ` pinskia at gcc dot gnu.org
  2022-01-10 21:27 ` k.even-mendoza at imperial dot ac.uk
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-04 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anbu1024.me at gmail dot com

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 101314 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument
  2021-05-11 16:20 [Bug c/100536] New: ICE: in expand_call, at calls.c:4980 cnsun at uwaterloo dot ca
                   ` (3 preceding siblings ...)
  2021-07-04 18:21 ` pinskia at gcc dot gnu.org
@ 2022-01-10 21:27 ` k.even-mendoza at imperial dot ac.uk
  2022-01-11  1:17 ` pinskia at gcc dot gnu.org
  2022-02-28  8:07 ` roger at nextmovesoftware dot com
  6 siblings, 0 replies; 8+ messages in thread
From: k.even-mendoza at imperial dot ac.uk @ 2022-01-10 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

Karine EM <k.even-mendoza at imperial dot ac.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.even-mendoza at imperial dot ac.
                   |                            |uk

--- Comment #5 from Karine EM <k.even-mendoza at imperial dot ac.uk> ---
With GCC-11 and GCC-10, the compiler does not crash but returns: "confused by
earlier errors, bailing out" and ends gracefully. But with GCC-12, I got a
similar crash, with a flat array, a bit over 1GB:

     1  struct a {
     2    char arr[1100000000];
     3  } b[1];
     4  void c(struct a e) {
     5    if (__builtin_memcmp(e.arr, b, 6))
     6      __builtin_abort();
     7  }
     8  int main() {
     9    struct a d;
    10    d.arr;
    11    c(d);
    12    return 0;
    13  }

However, the compiler does recognize the huge stack and gives: "sorry,
unimplemented: passing too large argument on stack", but still crash. If there
is already an error printed, what is the problem to terminate the compilation
gracefully as GCC-11 and GCC-10 used to do?



==========
With GCC-11 and GCC-10 (at least for this case):
gcc-10 -O2 2c8efdb591d9739d4434f1c216106706c62bd78f_v2.c
2c8efdb591d9739d4434f1c216106706c62bd78f_v2.c: In function ‘main’:
2c8efdb591d9739d4434f1c216106706c62bd78f_v2.c:11:3: sorry, unimplemented:
passing too large argument on stack
   11 |   c(d);
      |   ^~~~
2c8efdb591d9739d4434f1c216106706c62bd78f_v2.c:11: confused by earlier errors,
bailing out

==========
With GCC-12 ((GCC) 12.0.0 20211216 (experimental)), this is the trace:
2c8efdb591d9739d4434f1c216106706c62bd78f.c:11:3: sorry, unimplemented: passing
too large argument on stack
   11 |   c(d);
      |   ^~~~
during RTL pass: expand
2c8efdb591d9739d4434f1c216106706c62bd78f.c:11:3: internal compiler error: in
expand_call, at calls.c:3905
0x6cced7 expand_call(tree_node*, rtx_def*, int)
        .././../gcc-source/gcc/calls.c:3905
0xb43a3f expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        .././../gcc-source/gcc/expr.c:11536
0xa14b41 expand_expr
        .././../gcc-source/gcc/expr.h:301
0xa14b41 expand_call_stmt
        .././../gcc-source/gcc/cfgexpand.c:2831
0xa14b41 expand_gimple_stmt_1
        .././../gcc-source/gcc/cfgexpand.c:3864
0xa14b41 expand_gimple_stmt
        .././../gcc-source/gcc/cfgexpand.c:4028
0xa1a67e expand_gimple_basic_block
        .././../gcc-source/gcc/cfgexpand.c:6069
0xa1c527 execute
        .././../gcc-source/gcc/cfgexpand.c:6795
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument
  2021-05-11 16:20 [Bug c/100536] New: ICE: in expand_call, at calls.c:4980 cnsun at uwaterloo dot ca
                   ` (4 preceding siblings ...)
  2022-01-10 21:27 ` k.even-mendoza at imperial dot ac.uk
@ 2022-01-11  1:17 ` pinskia at gcc dot gnu.org
  2022-02-28  8:07 ` roger at nextmovesoftware dot com
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-11  1:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Karine EM from comment #5)
> With GCC-11 and GCC-10, the compiler does not crash but returns: "confused
> by earlier errors, bailing out" and ends gracefully.

That is actually still a crash :) Just hiding the internal compiler error as
there was already an error. This happens with release checking turned on. It is
by design even.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument
  2021-05-11 16:20 [Bug c/100536] New: ICE: in expand_call, at calls.c:4980 cnsun at uwaterloo dot ca
                   ` (5 preceding siblings ...)
  2022-01-11  1:17 ` pinskia at gcc dot gnu.org
@ 2022-02-28  8:07 ` roger at nextmovesoftware dot com
  6 siblings, 0 replies; 8+ messages in thread
From: roger at nextmovesoftware dot com @ 2022-02-28  8:07 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roger at nextmovesoftware dot com
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #7 from Roger Sayle <roger at nextmovesoftware dot com> ---
This bug is a duplicate of PR 84964, for which a patch has just been proposed.

*** This bug has been marked as a duplicate of bug 84964 ***

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-28  8:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 16:20 [Bug c/100536] New: ICE: in expand_call, at calls.c:4980 cnsun at uwaterloo dot ca
2021-05-11 22:03 ` [Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument pinskia at gcc dot gnu.org
2021-05-12  6:45 ` rguenth at gcc dot gnu.org
2021-05-12 22:56 ` cnsun at uwaterloo dot ca
2021-07-04 18:21 ` pinskia at gcc dot gnu.org
2022-01-10 21:27 ` k.even-mendoza at imperial dot ac.uk
2022-01-11  1:17 ` pinskia at gcc dot gnu.org
2022-02-28  8:07 ` roger at nextmovesoftware dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).