public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94475] New: [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813
@ 2020-04-03 17:07 asolokha at gmx dot com
  2020-04-03 17:09 ` [Bug c++/94475] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: asolokha at gmx dot com @ 2020-04-03 17:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94475
           Summary: [10 Regression] ICE: tree check: expected class
                    'type', have 'exceptional' (error_mark) in
                    element_mode, at tree.c:13813
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++-10.0.1-alpha20200329 snapshot (g:60c254b279e8e8443b8ad26cc46b9e4084cff66c)
ICEs when compiling the following testcase, extracted from
test/std/numerics/bit/bitops.rot/rotr.pass.cpp from the libcxx 10.0.0 test
suite:

unsigned char
sr ()
{
  const unsigned char xz = EI;

  return xz - (xz >> 1);
}

% g++-10.0.1 -c ayrzmymn.cpp
ayrzmymn.cpp: In function 'unsigned char sr()':
ayrzmymn.cpp:4:28: error: 'EI' was not declared in this scope
    4 |   const unsigned char xz = EI;
      |                            ^~
ayrzmymn.cpp:6:23: internal compiler error: tree check: expected class 'type',
have 'exceptional' (error_mark) in element_mode, at tree.c:13813
    6 |   return xz - (xz >> 1);
      |                       ^
0x7bb6b4 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/tree.c:9787
0x7c101b tree_class_check(tree_node const*, tree_code_class, char const*, int,
char const*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/tree.h:3657
0x7c101b element_mode(tree_node const*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/tree.c:13813
0xcaacef fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/fold-const.c:10795
0xcb3749 fold_build2_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/fold-const.c:13157
0xb95872 do_narrow
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/convert.c:439
0xb98936 convert_to_integer_1
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/convert.c:844
0xb99848 convert_to_integer_maybe_fold(tree_node*, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/convert.c:980
0x8d735d ocp_convert(tree_node*, tree_node*, int, int, int)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/cvt.c:874
0x8d007d cp_fold
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/cp-gimplify.c:2494
0x8d110c cp_fold_maybe_rvalue(tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/cp-gimplify.c:2330
0xa79958 maybe_warn_about_returning_address_of_local
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/typeck.c:9480
0xa79958 check_return_expr(tree_node*, bool*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/typeck.c:10089
0xa2c2bf finish_return_stmt(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/semantics.c:955
0x99b0d0 cp_parser_jump_statement
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:13111
0x99b0d0 cp_parser_statement
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:11362
0x99c4d8 cp_parser_statement_seq_opt
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:11835
0x99c5b8 cp_parser_compound_statement
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:11785
0x9b4855 cp_parser_function_body
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:23062
0x9b4855 cp_parser_ctor_initializer_opt_and_function_body
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:23113

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

* [Bug c++/94475] [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813
  2020-04-03 17:07 [Bug c++/94475] New: [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813 asolokha at gmx dot com
@ 2020-04-03 17:09 ` mpolacek at gcc dot gnu.org
  2020-04-03 17:13 ` [Bug c++/94475] [9/10 " mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-03 17:09 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-04-03

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/94475] [9/10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813
  2020-04-03 17:07 [Bug c++/94475] New: [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813 asolokha at gmx dot com
  2020-04-03 17:09 ` [Bug c++/94475] " mpolacek at gcc dot gnu.org
@ 2020-04-03 17:13 ` mpolacek at gcc dot gnu.org
  2020-04-06  6:31 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-03 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10 Regression] ICE: tree   |[9/10 Regression] ICE: tree
                   |check: expected class       |check: expected class
                   |'type', have 'exceptional'  |'type', have 'exceptional'
                   |(error_mark) in             |(error_mark) in
                   |element_mode, at            |element_mode, at
                   |tree.c:13813                |tree.c:13813
   Target Milestone|---                         |9.4

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r9-4974-gdfd7fdca2ac17d8b823a16700525824ca312ade0.

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

* [Bug c++/94475] [9/10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813
  2020-04-03 17:07 [Bug c++/94475] New: [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813 asolokha at gmx dot com
  2020-04-03 17:09 ` [Bug c++/94475] " mpolacek at gcc dot gnu.org
  2020-04-03 17:13 ` [Bug c++/94475] [9/10 " mpolacek at gcc dot gnu.org
@ 2020-04-06  6:31 ` rguenth at gcc dot gnu.org
  2020-04-15  1:02 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-06  6:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

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

* [Bug c++/94475] [9/10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813
  2020-04-03 17:07 [Bug c++/94475] New: [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2020-04-06  6:31 ` rguenth at gcc dot gnu.org
@ 2020-04-15  1:02 ` ppalka at gcc dot gnu.org
  2020-04-16 12:59 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-04-15  1:02 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |ppalka at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

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

* [Bug c++/94475] [9/10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813
  2020-04-03 17:07 [Bug c++/94475] New: [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2020-04-15  1:02 ` ppalka at gcc dot gnu.org
@ 2020-04-16 12:59 ` cvs-commit at gcc dot gnu.org
  2020-04-16 13:00 ` [Bug c++/94475] [9 " ppalka at gcc dot gnu.org
  2021-04-21 14:43 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-16 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:effcb4181e143bc390286a489ff849768a49f6af

commit r10-7757-geffcb4181e143bc390286a489ff849768a49f6af
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Apr 15 12:47:41 2020 -0400

    c++: Error recovery with erroneous DECL_INITIAL [PR94475]

    Here we're ICE'ing in do_narrow during error-recovery, because ocp_convert
    returns error_mark_node after it attempts to reduce a const decl to its
    erroneous DECL_INITIAL via scalar_constant_value, and we later pass this
    error_mark_node to fold_build2 which isn't prepared to handle
error_mark_nodes.

    We could fix this ICE in do_narrow by checking if ocp_convert returns
    error_mark_node, but for the sake of consistency and for better error
recovery
    it seems it'd be preferable if ocp_convert didn't care that a const decl's
    initializer is erroneous and would instead proceed as if the decl was not
const,
    which is the approach that this patch takes.

    gcc/cp/ChangeLog:

            PR c++/94475
            * cvt.c (ocp_convert): If the result of scalar_constant_value is
            erroneous, ignore it and use the original expression.

    gcc/testsuite/ChangeLog:

            PR c++/94475
            * g++.dg/conversion/err-recover2.C: New test.
            * g++.dg/diagnostic/pr84138.C: Remove now-bogus warning.
            * g++.dg/warn/Wsign-compare-8.C: Remove now-bogus warning.

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

* [Bug c++/94475] [9 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813
  2020-04-03 17:07 [Bug c++/94475] New: [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2020-04-16 12:59 ` cvs-commit at gcc dot gnu.org
@ 2020-04-16 13:00 ` ppalka at gcc dot gnu.org
  2021-04-21 14:43 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-04-16 13:00 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10 Regression] ICE: tree |[9 Regression] ICE: tree
                   |check: expected class       |check: expected class
                   |'type', have 'exceptional'  |'type', have 'exceptional'
                   |(error_mark) in             |(error_mark) in
                   |element_mode, at            |element_mode, at
                   |tree.c:13813                |tree.c:13813

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 10 so far.

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

* [Bug c++/94475] [9 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813
  2020-04-03 17:07 [Bug c++/94475] New: [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813 asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2020-04-16 13:00 ` [Bug c++/94475] [9 " ppalka at gcc dot gnu.org
@ 2021-04-21 14:43 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-21 14:43 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 10+.  I reckon this isn't worth backporting since it's just an
error-recovery ICE.

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

end of thread, other threads:[~2021-04-21 14:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 17:07 [Bug c++/94475] New: [10 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in element_mode, at tree.c:13813 asolokha at gmx dot com
2020-04-03 17:09 ` [Bug c++/94475] " mpolacek at gcc dot gnu.org
2020-04-03 17:13 ` [Bug c++/94475] [9/10 " mpolacek at gcc dot gnu.org
2020-04-06  6:31 ` rguenth at gcc dot gnu.org
2020-04-15  1:02 ` ppalka at gcc dot gnu.org
2020-04-16 12:59 ` cvs-commit at gcc dot gnu.org
2020-04-16 13:00 ` [Bug c++/94475] [9 " ppalka at gcc dot gnu.org
2021-04-21 14:43 ` ppalka 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).