Bug 98094 - ICE in decompose, at wide-int.h:984
Summary: ICE in decompose, at wide-int.h:984
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-02 09:42 UTC by Stefan Schulze Frielinghaus
Modified: 2020-12-02 12:11 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Schulze Frielinghaus 2020-12-02 09:42:49 UTC
Compiling SPEC benchmark 502.gcc_r on S/390 results in the following ICE:

$ /devel/gcc-2/dst/bin/gcc -c -o tree.o -DSPEC -DNDEBUG -I. -I./include -I./spec_qsort -DSPEC_502 -DSPEC_AUTO_SUPPRESS_OPENMP -DIN_GCC -DHAVE_CONFIG_H -march=arch13 -O3 -std=gnu89 -DSPEC_LP64 tree.c 
during GIMPLE pass: iftoswitch
tree.c: In function 'tree_floor_log2':
tree.c:10732: internal compiler error: in decompose, at wide-int.h:984
0x119ce51 wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> > >::decompose(long*, unsigned int, generic_wide_int<wide_int_ref_storage<false, false> > const&)
        /devel/gcc-2/src/gcc/wide-int.h:984
0x1a44837 wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> > >::decompose(long*, unsigned int, generic_wide_int<wide_int_ref_storage<false, false> > const&)
        /devel/gcc-2/src/gcc/tree.h:3445
0x1a44837 wide_int_ref_storage<false, false>::wide_int_ref_storage<generic_wide_int<wide_int_ref_storage<false, false> > >(generic_wide_int<wide_int_ref_storage<false, false> > const&, unsig
ned int)
        /devel/gcc-2/src/gcc/wide-int.h:1034
0x1a44837 generic_wide_int<wide_int_ref_storage<false, false> >::generic_wide_int<generic_wide_int<wide_int_ref_storage<false, false> > >(generic_wide_int<wide_int_ref_storage<false, false> 
> const&, unsigned int)
        /devel/gcc-2/src/gcc/wide-int.h:790
0x1a44837 wi::binary_traits<generic_wide_int<wide_int_ref_storage<false, false> >, generic_wide_int<wide_int_ref_storage<false, false> >, wi::int_traits<generic_wide_int<wide_int_ref_storage
<false, false> > >::precision_type, wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> > >::precision_type>::result_type wi::sub<generic_wide_int<wide_int_ref_storage<false, 
false> >, generic_wide_int<wide_int_ref_storage<false, false> > >(generic_wide_int<wide_int_ref_storage<false, false> > const&, generic_wide_int<wide_int_ref_storage<false, false> > const&)
        /devel/gcc-2/src/gcc/wide-int.h:2513
0x1a44837 wi::binary_traits<generic_wide_int<wide_int_ref_storage<false, false> >, generic_wide_int<wide_int_ref_storage<false, false> >, wi::int_traits<generic_wide_int<wide_int_ref_storage
<false, false> > >::precision_type, wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> > >::precision_type>::operator_result operator-<generic_wide_int<wide_int_ref_storage<f
alse, false> >, generic_wide_int<wide_int_ref_storage<false, false> > >(generic_wide_int<wide_int_ref_storage<false, false> > const&, generic_wide_int<wide_int_ref_storage<false, false> > co
nst&)
        /devel/gcc-2/src/gcc/wide-int.h:3297
0x1a44837 tree_switch_conversion::cluster::get_range(tree_node*, tree_node*)
        /devel/gcc-2/src/gcc/tree-switch-conversion.h:87
0x1a3771d tree_switch_conversion::jump_table_cluster::can_be_handled(vec<tree_switch_conversion::cluster*, va_heap, vl_ptr> const&, unsigned int, unsigned int)
        /devel/gcc-2/src/gcc/tree-switch-conversion.c:1265
0x1a3d8d5 tree_switch_conversion::jump_table_cluster::can_be_handled(vec<tree_switch_conversion::cluster*, va_heap, vl_ptr> const&, unsigned int, unsigned int)
        /devel/gcc-2/src/gcc/tree-switch-conversion.c:1258
0x1a3d8d5 tree_switch_conversion::jump_table_cluster::find_jump_tables(vec<tree_switch_conversion::cluster*, va_heap, vl_ptr>&)
        /devel/gcc-2/src/gcc/tree-switch-conversion.c:1201
0x1a3d8d5 tree_switch_conversion::jump_table_cluster::find_jump_tables(vec<tree_switch_conversion::cluster*, va_heap, vl_ptr>&)
        /devel/gcc-2/src/gcc/tree-switch-conversion.c:1175
0x22876d9 if_chain::is_beneficial()
        /devel/gcc-2/src/gcc/gimple-if-to-switch.cc:244
0x2289237 execute
        /devel/gcc-2/src/gcc/gimple-if-to-switch.cc:530
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.

Bisect stops at 03eb09292ef228d1d12b5168cdd748583b1f992a
Comment 1 Stefan Schulze Frielinghaus 2020-12-02 10:02:02 UTC
Reduced program:

struct {                                                                                                                                                                                      
  unsigned a : 10                                                                                                                                                                             
} b;                                                                                                                                                                                          
c;                                                                                                                                                                                            
d() {                                                                                                                                                                                         
  c = b.a;                                                                                                                                                                                    
  if (c == 8 || c == 0)                                                                                                                                                                       
    ;                                                                                                                                                                                         
  else if (c > 8 * 8)                                                                                                                                                                         
    ;                                                                                                                                                                                         
  else if (c < 8 * 8)                                                                                                                                                                         
    e();                                                                                                                                                                                      
}
Comment 2 Richard Biener 2020-12-02 10:17:31 UTC
I think there's a dup and/or Martin already fixed this with g:e4c02ce4ab6fce1148f4025360096f18764deadf - can you confirm?
Comment 3 Stefan Schulze Frielinghaus 2020-12-02 10:43:20 UTC
I still run into the same error with e4c02ce4ab6fce1148f4025360096f18764deadf
Comment 4 Richard Biener 2020-12-02 10:47:15 UTC
(In reply to Stefan Schulze Frielinghaus from comment #3)
> I still run into the same error with e4c02ce4ab6fce1148f4025360096f18764deadf

Hmm, it doesn't reproduce for me with a cc1 cross and your reduced testcase.
Comment 5 Richard Biener 2020-12-02 10:48:19 UTC
Ah, so maybe g:c961e94901eb793b1a18d431a1acf7f682eaf04f which has

            * gimple-if-to-switch.cc (find_conditions): Require
            equal precision for low and high of a range.
Comment 6 Stefan Schulze Frielinghaus 2020-12-02 10:53:03 UTC
Ah yes commit c961e94901eb793b1a18d431a1acf7f682eaf04f seems to have fixed this. Closing since fixed. Thanks for your help!
Comment 7 Martin Liška 2020-12-02 12:11:16 UTC
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

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

commit r11-5651-gd01ebe56c2f54bf4ac91ce389ecef734f557ea3e
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Dec 2 13:08:56 2020 +0100

    Add new test-case.
    
    gcc/testsuite/ChangeLog:
    
            PR tree-optimization/98084
            * gcc.dg/tree-ssa/pr98094.c: New test.