Bug 93723 - ICEs building ada with -fanalyzer
Summary: ICEs building ada with -fanalyzer
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: analyzer (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: David Malcolm
URL:
Keywords: build
Depends on:
Blocks: 93388
  Show dependency treegraph
 
Reported: 2020-02-13 02:05 UTC by David Malcolm
Modified: 2020-10-14 20:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-02-17 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Malcolm 2020-02-13 02:05:02 UTC
I attempted to bootstrap GCC with the config/bootstrap-analyzer.mk from PR 93388 comment #0; it failed with various ICEs in Ada.

Quite a few of this form:
+===========================GNAT BUG DETECTED==============================+
| 10.0.1 20200211 (experimental) (x86_64-pc-linux-gnu) GCC error:          |
| unhandled tree code in region_model::get_lvalue_1:                       |
|     ‘array_range_ref’                                                    |
| Error detected around ../../../src/gcc/ada/libgnat/a-exctra.adb:40:33    |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

and at least one of:
+===========================GNAT BUG DETECTED==============================+
| 10.0.1 20200211 (experimental) (x86_64-pc-linux-gnu) GCC error:          |
| in make_region_for_type, at analyzer/region-model.cc:6066                |
| Error detected around ../../../src/gcc/ada/atree.adb:2501:28             |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+
Comment 1 Dávid Bolvanský 2020-02-17 22:58:04 UTC
make_region_for_type also crashes when building zstd
https://github.com/facebook/zstd

make CC="gcc -fanalyzer -flto" -B

during IPA pass: analyzer
legacy/zstd_v07.c: In function ‘ZBUFFv07_decompressContinue’:
legacy/zstd_v07.c:4395:39: internal compiler error: in make_region_for_type, at analyzer/region-model.cc:5983
 4395 |     const char* const iend = istart + *srcSizePtr;
      |                                       ^
0x100fbb9 make_region_for_type
        ../../gcc/analyzer/region-model.cc:5983
0x100fbb9 ana::region_model::add_region_for_type(ana::region_id, tree_node*)
        ../../gcc/analyzer/region-model.cc:5993
0x1011984 ana::region_model::get_or_create_view(ana::region_id, tree_node*)
        ../../gcc/analyzer/region-model.cc:6568
0x1017bed ana::array_region::get_element(ana::region_model*, ana::region_id, ana::svalue_id, ana::region_model_context*)
        ../../gcc/analyzer/region-model.cc:2199
0x1017da3 ana::region_model::get_or_create_mem_ref(tree_node*, ana::svalue_id, ana::svalue_id, ana::region_model_context*)
        ../../gcc/analyzer/region-model.cc:6526
0x101d9fa ana::region_model::get_or_create_pointer_plus_expr(tree_node*, ana::svalue_id, ana::svalue_id, ana::region_model_context*)
        ../../gcc/analyzer/region-model.cc:6546
0x101d9fa ana::region_model::on_assignment(gassign const*, ana::region_model_context*)
        ../../gcc/analyzer/region-model.cc:3977
0xff855b ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode const*, gimple const*, ana::program_state*, ana::state_change*) const
        ../../gcc/analyzer/engine.cc:948
0xff8ffb ana::exploded_graph::process_node(ana::exploded_node*)
        ../../gcc/analyzer/engine.cc:2439
0xff9632 ana::exploded_graph::process_worklist()
        ../../gcc/analyzer/engine.cc:2259
0xffac8e ana::impl_run_checkers(ana::logger*)
        ../../gcc/analyzer/engine.cc:3580
0xffb91d ana::run_checkers()
        ../../gcc/analyzer/engine.cc:3634
0xff07d8 execute
        ../../gcc/analyzer/analyzer-pass.cc:84
Comment 2 Dávid Bolvanský 2020-02-17 22:58:48 UTC
Without LTO

during IPA pass: analyzer
common/entropy_common.c: In function ‘HUF_readStats’:
common/entropy_common.c:196:37: internal compiler error: in make_region_for_type, at analyzer/region-model.cc:5983
  196 |                 huffWeight[n]   = ip[n/2] >> 4;
      |                                     ^
0x1128bb9 make_region_for_type
        ../../gcc/analyzer/region-model.cc:5983
Comment 3 David Malcolm 2020-02-17 23:02:20 UTC
(In reply to Dávid Bolvanský from comment #2)
> Without LTO
> 
> during IPA pass: analyzer
> common/entropy_common.c: In function ‘HUF_readStats’:
> common/entropy_common.c:196:37: internal compiler error: in
> make_region_for_type, at analyzer/region-model.cc:5983
>   196 |                 huffWeight[n]   = ip[n/2] >> 4;
>       |                                     ^
> 0x1128bb9 make_region_for_type
>         ../../gcc/analyzer/region-model.cc:5983

Thanks Dávid.  Please can you generate preprocessed source for this with -E, file a separate bug against the "analyzer" component for this, and attach the preprocessed source to that bug?  (I'd prefer to track it separately as the underlying tree codes may be different)
Comment 4 Dávid Bolvanský 2020-02-17 23:08:34 UTC
Thanks, created https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93798
Comment 5 David Malcolm 2020-02-17 23:20:04 UTC
Thanks!
Comment 6 GCC Commits 2020-10-14 20:38:09 UTC
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:12b267cc606a48a2fef809189c35573c4a51d3a5

commit r11-3895-g12b267cc606a48a2fef809189c35573c4a51d3a5
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Tue Oct 13 17:11:17 2020 -0400

    analyzer: fix build with ada [PR93723]
    
    gcc/analyzer/ChangeLog:
            PR analyzer/93723
            * store.cc (binding_map::apply_ctor_to_region): Remove redundant
            assertion.
Comment 7 David Malcolm 2020-10-14 20:57:55 UTC
As noted in https://gcc.gnu.org/pipermail/gcc-patches/2020-October/556203.html I was able to successfully bootstrap with the patch from comment #6 using the method from comment #0.  This was with ada enabled, so marking this one as resolved.