public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106765] New: ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc
@ 2022-08-28 15:15 k.even-mendoza at imperial dot ac.uk
  2022-08-28 15:38 ` [Bug c/106765] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: k.even-mendoza at imperial dot ac.uk @ 2022-08-28 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106765
           Summary: ICE (invalid code) in tree check: expected class
                    'type', have 'exceptional' (error_mark) in
                    create_tmp_from_val, at gimplify.cc
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: k.even-mendoza at imperial dot ac.uk
  Target Milestone: ---

This code leads to ICE in GCC-12 and 13:
===
struct a {
  int b
} c() {
  struct a a;
  a.b;
  d a;
===

We are doing a study about compiler fuzzers. We got this from one of the tools.
I wonder if such a bug is interesting even if the program is chopped in the
middle?

02021d3b54a898d36d126c423b2c82b57c500705.c:5:4: internal compiler error: tree
check: expected class 'type', have 'exceptional' (error_mark) in
create_tmp_from_val, at gimplify.cc:570
    5 |   a.b;
      |   ~^~
0x7ee86d tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        .././../gcc-source/gcc/tree.cc:8867
0x72b8e0 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        .././../gcc-source/gcc/tree.h:3631
0x72b8e0 create_tmp_from_val
        .././../gcc-source/gcc/gimplify.cc:570
0x72b8e0 lookup_tmp_var
        .././../gcc-source/gcc/gimplify.cc:593
0x72b8e0 internal_get_tmp_var
        .././../gcc-source/gcc/gimplify.cc:648
0xc447f0 prepare_gimple_addressable
        .././../gcc-source/gcc/gimplify.cc:4586
0xc45148 gimplify_compound_lval
        .././../gcc-source/gcc/gimplify.cc:3286
0xc3e494 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        .././../gcc-source/gcc/gimplify.cc:15158
0xc426e6 gimplify_stmt(tree_node**, gimple**)
        .././../gcc-source/gcc/gimplify.cc:7153
0xc3fb1b gimplify_statement_list
        .././../gcc-source/gcc/gimplify.cc:2025
0xc3fb1b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        .././../gcc-source/gcc/gimplify.cc:15651
0xc426e6 gimplify_stmt(tree_node**, gimple**)
        .././../gcc-source/gcc/gimplify.cc:7153
0xc42ea5 gimplify_bind_expr
        .././../gcc-source/gcc/gimplify.cc:1434
0xc3f176 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        .././../gcc-source/gcc/gimplify.cc:15407
0xc50fbf gimplify_stmt(tree_node**, gimple**)
        .././../gcc-source/gcc/gimplify.cc:7153
0xc50fbf gimplify_body(tree_node*, bool)
        .././../gcc-source/gcc/gimplify.cc:16463
0xc5140b gimplify_function_tree(tree_node*)
        .././../gcc-source/gcc/gimplify.cc:16662
0xa7d1b7 cgraph_node::analyze()
        .././../gcc-source/gcc/cgraphunit.cc:676
0xa7fc87 analyze_functions
        .././../gcc-source/gcc/cgraphunit.cc:1240
0xa8095d symbol_table::finalize_compilation_unit()
        .././../gcc-source/gcc/cgraphunit.cc:2500
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c/106765] ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc
  2022-08-28 15:15 [Bug c/106765] New: ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc k.even-mendoza at imperial dot ac.uk
@ 2022-08-28 15:38 ` pinskia at gcc dot gnu.org
  2022-08-29 13:39 ` [Bug c/106765] [12/13 Regression] ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc since r12-7222-g3f10e0d50b5e3b3f marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-28 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c/106765] [12/13 Regression] ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc since r12-7222-g3f10e0d50b5e3b3f
  2022-08-28 15:15 [Bug c/106765] New: ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc k.even-mendoza at imperial dot ac.uk
  2022-08-28 15:38 ` [Bug c/106765] " pinskia at gcc dot gnu.org
@ 2022-08-29 13:39 ` marxin at gcc dot gnu.org
  2022-08-29 14:10 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-08-29 13:39 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-08-29
     Ever confirmed|0                           |1
            Summary|ICE (invalid code) in tree  |[12/13 Regression] ICE
                   |check: expected class       |(invalid code) in tree
                   |'type', have 'exceptional'  |check: expected class
                   |(error_mark) in             |'type', have 'exceptional'
                   |create_tmp_from_val, at     |(error_mark) in
                   |gimplify.cc                 |create_tmp_from_val, at
                   |                            |gimplify.cc since
                   |                            |r12-7222-g3f10e0d50b5e3b3f
             Status|UNCONFIRMED                 |NEW
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-7222-g3f10e0d50b5e3b3f.

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

* [Bug c/106765] [12/13 Regression] ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc since r12-7222-g3f10e0d50b5e3b3f
  2022-08-28 15:15 [Bug c/106765] New: ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc k.even-mendoza at imperial dot ac.uk
  2022-08-28 15:38 ` [Bug c/106765] " pinskia at gcc dot gnu.org
  2022-08-29 13:39 ` [Bug c/106765] [12/13 Regression] ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc since r12-7222-g3f10e0d50b5e3b3f marxin at gcc dot gnu.org
@ 2022-08-29 14:10 ` rguenth at gcc dot gnu.org
  2022-11-15 19:45 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-29 14:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.3
           Priority|P3                          |P4

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

* [Bug c/106765] [12/13 Regression] ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc since r12-7222-g3f10e0d50b5e3b3f
  2022-08-28 15:15 [Bug c/106765] New: ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc k.even-mendoza at imperial dot ac.uk
                   ` (2 preceding siblings ...)
  2022-08-29 14:10 ` rguenth at gcc dot gnu.org
@ 2022-11-15 19:45 ` pinskia at gcc dot gnu.org
  2022-11-18 17:03 ` cvs-commit at gcc dot gnu.org
  2022-11-18 17:05 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-15 19:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c/106765] [12/13 Regression] ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc since r12-7222-g3f10e0d50b5e3b3f
  2022-08-28 15:15 [Bug c/106765] New: ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc k.even-mendoza at imperial dot ac.uk
                   ` (3 preceding siblings ...)
  2022-11-15 19:45 ` pinskia at gcc dot gnu.org
@ 2022-11-18 17:03 ` cvs-commit at gcc dot gnu.org
  2022-11-18 17:05 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-18 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

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

commit r13-4143-gbd0c9d9e706adaeea0d96152daade0a6819a8715
Author: Andrew Pinski <apinski@marvell.com>
Date:   Thu Nov 17 22:08:07 2022 +0000

    Fix PRs 106764, 106765, and 107307, all ICE after invalid re-declaration

    The problem here is the gimplifier returns GS_ERROR but
    in some cases we don't check that soon enough and try
    to do other work which could crash.
    So the fix in these two cases is to return GS_ERROR
    early if the gimplify_* functions had return GS_ERROR.

    OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

    Thanks,
    Andrew Pinski

    gcc/ChangeLog:

            PR c/106764
            PR c/106765
            PR c/107307
            * gimplify.cc (gimplify_compound_lval): Return GS_ERROR
            if gimplify_expr had return GS_ERROR.
            (gimplify_call_expr): Likewise.

    gcc/testsuite/ChangeLog:

            PR c/106764
            PR c/106765
            PR c/107307
            * gcc.dg/redecl-19.c: New test.
            * gcc.dg/redecl-20.c: New test.
            * gcc.dg/redecl-21.c: New test.

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

* [Bug c/106765] [12/13 Regression] ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc since r12-7222-g3f10e0d50b5e3b3f
  2022-08-28 15:15 [Bug c/106765] New: ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc k.even-mendoza at imperial dot ac.uk
                   ` (4 preceding siblings ...)
  2022-11-18 17:03 ` cvs-commit at gcc dot gnu.org
@ 2022-11-18 17:05 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-18 17:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.3                        |13.0
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed for GCC 13. Since this is an ICE after error, no reason to backport it.

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

end of thread, other threads:[~2022-11-18 17:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-28 15:15 [Bug c/106765] New: ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc k.even-mendoza at imperial dot ac.uk
2022-08-28 15:38 ` [Bug c/106765] " pinskia at gcc dot gnu.org
2022-08-29 13:39 ` [Bug c/106765] [12/13 Regression] ICE (invalid code) in tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc since r12-7222-g3f10e0d50b5e3b3f marxin at gcc dot gnu.org
2022-08-29 14:10 ` rguenth at gcc dot gnu.org
2022-11-15 19:45 ` pinskia at gcc dot gnu.org
2022-11-18 17:03 ` cvs-commit at gcc dot gnu.org
2022-11-18 17:05 ` 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).