public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97191] New: ICE In expand_expr_real_1, at expr.c:10234
@ 2020-09-24  8:32 tangyixuan at mail dot dlut.edu.cn
  2020-09-24  8:51 ` [Bug c++/97191] " rguenth at gcc dot gnu.org
  2021-07-27  5:45 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: tangyixuan at mail dot dlut.edu.cn @ 2020-09-24  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97191
           Summary: ICE In expand_expr_real_1, at expr.c:10234
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

Hi, the following code crashes GCC.

$ cat s.cpp

struct A { 
  A (); 
  A ( const A &); 
  A ( int );
}; 
A :: A (){
  int a =0; 
  A b [a][0];
} 

$ g++ -c s.cpp

during RTL pass: expand
s.cpp: In constructor ‘A::A()’:
s.cpp:8:12: internal compiler error: in expand_expr_real_1, at expr.c:10234
    8 |   A b [a][0];
      |            ^
0x606834 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc-11-20200906/gcc/expr.c:10234
0x97e6a1 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        ../../gcc-11-20200906/gcc/expr.c:8480
0x97e6a1 store_expr(tree_node*, rtx_def*, int, bool, bool)
        ../../gcc-11-20200906/gcc/expr.c:5858
0x97fcd1 expand_assignment(tree_node*, tree_node*, bool)
        ../../gcc-11-20200906/gcc/expr.c:5594
0x8742f8 expand_gimple_stmt_1
        ../../gcc-11-20200906/gcc/cfgexpand.c:3749
0x8742f8 expand_gimple_stmt
        ../../gcc-11-20200906/gcc/cfgexpand.c:3847
0x87a39e expand_gimple_basic_block
        ../../gcc-11-20200906/gcc/cfgexpand.c:5888
0x87a39e execute
        ../../gcc-11-20200906/gcc/cfgexpand.c:6572
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] 3+ messages in thread

* [Bug c++/97191] ICE In expand_expr_real_1, at expr.c:10234
  2020-09-24  8:32 [Bug c++/97191] New: ICE In expand_expr_real_1, at expr.c:10234 tangyixuan at mail dot dlut.edu.cn
@ 2020-09-24  8:51 ` rguenth at gcc dot gnu.org
  2021-07-27  5:45 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-24  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2020-09-24
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |10.2.1, 11.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

10238         gcc_assert (!exp
10239                     || SCOPE_FILE_SCOPE_P (context)
10240                     || context == current_function_decl
10241                     || TREE_STATIC (exp)
10242                     || DECL_EXTERNAL (exp)
(gdb) l
10243                     /* ??? C++ creates functions that are not
TREE_STATIC.  */
10244                     || TREE_CODE (exp) == FUNCTION_DECL);
(gdb) p exp
$1 = <var_decl 0x7ffff697e120 a>
(gdb) p current_function_decl 
$2 = <function_decl 0x7ffff696dc00 __ct_base >
(gdb) p exp->decl_minimal.context 
$3 = <function_decl 0x7ffff696d400 __ct >

but the underlying reason may be a stale VLA reference due to a missing
DECL_EXPR.

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

* [Bug c++/97191] ICE In expand_expr_real_1, at expr.c:10234
  2020-09-24  8:32 [Bug c++/97191] New: ICE In expand_expr_real_1, at expr.c:10234 tangyixuan at mail dot dlut.edu.cn
  2020-09-24  8:51 ` [Bug c++/97191] " rguenth at gcc dot gnu.org
@ 2021-07-27  5:45 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-27  5:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |16994

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> but the underlying reason may be a stale VLA reference due to a missing
> DECL_EXPR.

No, it looks more like a cloning of the function issue for the ctor.

If I change [0] to [1], the correct a is used.

The incorrect one:
        aD.2126 = 0;
        _1 = (ssizetype) aD.2106;


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16994
[Bug 16994] [meta-bug] VLA and C++

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

end of thread, other threads:[~2021-07-27  5:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24  8:32 [Bug c++/97191] New: ICE In expand_expr_real_1, at expr.c:10234 tangyixuan at mail dot dlut.edu.cn
2020-09-24  8:51 ` [Bug c++/97191] " rguenth at gcc dot gnu.org
2021-07-27  5:45 ` pinskia at gcc dot gnu.org

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).