public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/98580] New: ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p
@ 2021-01-07 12:14 acoplan at gcc dot gnu.org
  2021-01-07 13:25 ` [Bug analyzer/98580] ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p since r11-2754-g623bc0276849d48a marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-01-07 12:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98580
           Summary: ICE with -fanalyzer and LTO: tree check: expected
                    class 'type', have 'exceptional' (error_mark) in
                    useless_type_conversion_p
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following fails:

$ cat a.c
int a;
int *p = &a;
void foo();
int main() { foo(); }
$ cat b.c
typedef struct {
  int a;
} b;
typedef struct {
  b c;
} d;
extern d e;
extern int *p;
void foo() { e.c.a && p; }
$ aarch64-elf-gcc -flto -fanalyzer a.c b.c
during IPA pass: analyzer
b.c: In function 'foo':
b.c:9:20: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.c:87
    9 | void foo() { e.c.a && p; }
      |                    ^
0x101c8fc tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        /home/alecop01/toolchain/src/gcc/gcc/tree.c:9860
0x949a4a tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        /home/alecop01/toolchain/src/gcc/gcc/tree.h:3461
0x949a4a useless_type_conversion_p(tree_node*, tree_node*)
        /home/alecop01/toolchain/src/gcc/gcc/gimple-expr.c:87
0x1120770 assert_compat_types
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region-model.cc:1256
0x1125336 ana::region_model::get_rvalue(ana::path_var,
ana::region_model_context*)
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region-model.cc:1391
0x111f875
ana::decl_region::get_svalue_for_initializer(ana::region_model_manager*) const
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region.cc:977
0x11230d8 ana::region_model::get_initial_value_for_global(ana::region const*)
const
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region-model.cc:1451
0x112341f ana::region_model::get_store_value(ana::region const*) const
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region-model.cc:1533
0x1124e54 ana::region_model::get_rvalue_1(ana::path_var,
ana::region_model_context*)
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region-model.cc:1320
0x1125316 ana::region_model::get_rvalue(ana::path_var,
ana::region_model_context*)
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region-model.cc:1389
0x1125388 ana::region_model::get_rvalue(tree_node*, ana::region_model_context*)
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region-model.cc:1402
0x11254eb ana::region_model::get_gassign_result(gassign const*,
ana::region_model_context*)
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region-model.cc:518
0x11258f6 ana::region_model::on_assignment(gassign const*,
ana::region_model_context*)
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/region-model.cc:665
0x110545b ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*) const
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/engine.cc:1118
0x1107970 ana::exploded_graph::process_node(ana::exploded_node*)
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/engine.cc:2948
0x110839e ana::exploded_graph::process_worklist()
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/engine.cc:2573
0x110a5db ana::impl_run_checkers(ana::logger*)
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/engine.cc:4739
0x110b7f7 ana::run_checkers()
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/engine.cc:4810
0x10fe18e execute
        /home/alecop01/toolchain/src/gcc/gcc/analyzer/analyzer-pass.cc:87
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.
lto-wrapper: fatal error: aarch64-elf-gcc returned 1 exit status
compilation terminated.
/home/alecop01/toolchain/build-aarch64-elf/install/lib/gcc/aarch64-elf/11.0.0/../../../../aarch64-elf/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status

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

* [Bug analyzer/98580] ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p since r11-2754-g623bc0276849d48a
  2021-01-07 12:14 [Bug analyzer/98580] New: ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p acoplan at gcc dot gnu.org
@ 2021-01-07 13:25 ` marxin at gcc dot gnu.org
  2021-01-07 15:35 ` [Bug analyzer/98580] ICE with -fanalyzer when LTO writes out error_mark_node for DECL_INITIAL dmalcolm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-01-07 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-01-07
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
            Summary|ICE with -fanalyzer and     |ICE with -fanalyzer and
                   |LTO: tree check: expected   |LTO: tree check: expected
                   |class 'type', have          |class 'type', have
                   |'exceptional' (error_mark)  |'exceptional' (error_mark)
                   |in                          |in
                   |useless_type_conversion_p   |useless_type_conversion_p
                   |                            |since
                   |                            |r11-2754-g623bc0276849d48a

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-2754-g623bc0276849d48a.

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

* [Bug analyzer/98580] ICE with -fanalyzer when LTO writes out error_mark_node for DECL_INITIAL
  2021-01-07 12:14 [Bug analyzer/98580] New: ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p acoplan at gcc dot gnu.org
  2021-01-07 13:25 ` [Bug analyzer/98580] ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p since r11-2754-g623bc0276849d48a marxin at gcc dot gnu.org
@ 2021-01-07 15:35 ` dmalcolm at gcc dot gnu.org
  2021-01-07 20:46 ` cvs-commit at gcc dot gnu.org
  2021-01-07 20:55 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-01-07 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE with -fanalyzer and     |ICE with -fanalyzer when
                   |LTO: tree check: expected   |LTO writes out
                   |class 'type', have          |error_mark_node for
                   |'exceptional' (error_mark)  |DECL_INITIAL
                   |in                          |
                   |useless_type_conversion_p   |
                   |since                       |
                   |r11-2754-g623bc0276849d48a  |
             Status|NEW                         |ASSIGNED

--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this.  Am testing a fix.

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

* [Bug analyzer/98580] ICE with -fanalyzer when LTO writes out error_mark_node for DECL_INITIAL
  2021-01-07 12:14 [Bug analyzer/98580] New: ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p acoplan at gcc dot gnu.org
  2021-01-07 13:25 ` [Bug analyzer/98580] ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p since r11-2754-g623bc0276849d48a marxin at gcc dot gnu.org
  2021-01-07 15:35 ` [Bug analyzer/98580] ICE with -fanalyzer when LTO writes out error_mark_node for DECL_INITIAL dmalcolm at gcc dot gnu.org
@ 2021-01-07 20:46 ` cvs-commit at gcc dot gnu.org
  2021-01-07 20:55 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-07 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:0677759f753d321bde52d7343227f842b7e759d2

commit r11-6527-g0677759f753d321bde52d7343227f842b7e759d2
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Thu Jan 7 15:45:29 2021 -0500

    analyzer: fix ICE when DECL_INITIAL is error_mark_node [PR98580]

    lto-streamer-out.c's get_symbol_initial_value can return error_mark_node
    rather than DECL_INITIAL as an optimization to avoid extra sections for
    simple scalar values.

    Add a check to the analyzer to handle such cases gracefully.

    gcc/analyzer/ChangeLog:
            PR analyzer/98580
            * region.cc (decl_region::get_svalue_for_initializer): Gracefully
            handle when LTO writes out DECL_INITIAL as error_mark_node.

    gcc/testsuite/ChangeLog:
            PR analyzer/98580
            * gcc.dg/analyzer/pr98580-a.c: New test.
            * gcc.dg/analyzer/pr98580-b.c: New test.

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

* [Bug analyzer/98580] ICE with -fanalyzer when LTO writes out error_mark_node for DECL_INITIAL
  2021-01-07 12:14 [Bug analyzer/98580] New: ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p acoplan at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-01-07 20:46 ` cvs-commit at gcc dot gnu.org
@ 2021-01-07 20:55 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-01-07 20:55 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

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

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Should be fixed by the above commit.

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

end of thread, other threads:[~2021-01-07 20:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 12:14 [Bug analyzer/98580] New: ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p acoplan at gcc dot gnu.org
2021-01-07 13:25 ` [Bug analyzer/98580] ICE with -fanalyzer and LTO: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p since r11-2754-g623bc0276849d48a marxin at gcc dot gnu.org
2021-01-07 15:35 ` [Bug analyzer/98580] ICE with -fanalyzer when LTO writes out error_mark_node for DECL_INITIAL dmalcolm at gcc dot gnu.org
2021-01-07 20:46 ` cvs-commit at gcc dot gnu.org
2021-01-07 20:55 ` dmalcolm 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).