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

            Bug ID: 107776
           Summary: [13 Regression] ICE: SIGSEGV in
                    complex_mul_pattern::matches
                    (tree-vect-slp-patterns.cc:1042) with -O2 -std=c11
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 53932
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53932&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O2 -ffp-contract=off testcase.c -wrapper valgrind,-q
==31587== Invalid read of size 2
==31587==    at 0x165C620: complex_mul_pattern::matches(_complex_operation,
hash_map<_slp_tree*, _complex_perm_kinds,
simple_hashmap_traits<default_hash_traits<_slp_tree*>, _complex_perm_kinds> >*,
hash_map<pair_hash<nofree_ptr_hash<_slp_tree>, nofree_ptr_hash<_slp_tree> >,
bool,
simple_hashmap_traits<default_hash_traits<pair_hash<nofree_ptr_hash<_slp_tree>,
nofree_ptr_hash<_slp_tree> > >, bool> >*, _slp_tree**, vec<_slp_tree*, va_heap,
vl_ptr>*) [clone .part.0] (tree-vect-slp-patterns.cc:1042)
==31587==    by 0x165D6E3: matches (tree-vect-slp-patterns.cc:1023)
==31587==    by 0x165D6E3:
complex_operations_pattern::recognize(hash_map<_slp_tree*, _complex_perm_kinds,
simple_hashmap_traits<default_hash_traits<_slp_tree*>, _complex_perm_kinds> >*,
hash_map<pair_hash<nofree_ptr_hash<_slp_tree>, nofree_ptr_hash<_slp_tree> >,
bool,
simple_hashmap_traits<default_hash_traits<pair_hash<nofree_ptr_hash<_slp_tree>,
nofree_ptr_hash<_slp_tree> > >, bool> >*, _slp_tree**)
(tree-vect-slp-patterns.cc:1424)
==31587==    by 0x16481FF: vect_match_slp_patterns_2(_slp_tree**, vec_info*,
hash_map<_slp_tree*, _complex_perm_kinds,
simple_hashmap_traits<default_hash_traits<_slp_tree*>, _complex_perm_kinds> >*,
hash_map<pair_hash<nofree_ptr_hash<_slp_tree>, nofree_ptr_hash<_slp_tree> >,
bool,
simple_hashmap_traits<default_hash_traits<pair_hash<nofree_ptr_hash<_slp_tree>,
nofree_ptr_hash<_slp_tree> > >, bool> >*, hash_set<_slp_tree*, false,
default_hash_traits<_slp_tree*> >*) (tree-vect-slp.cc:3010)
==31587==    by 0x16481C5: vect_match_slp_patterns_2(_slp_tree**, vec_info*,
hash_map<_slp_tree*, _complex_perm_kinds,
simple_hashmap_traits<default_hash_traits<_slp_tree*>, _complex_perm_kinds> >*,
hash_map<pair_hash<nofree_ptr_hash<_slp_tree>, nofree_ptr_hash<_slp_tree> >,
bool,
simple_hashmap_traits<default_hash_traits<pair_hash<nofree_ptr_hash<_slp_tree>,
nofree_ptr_hash<_slp_tree> > >, bool> >*, hash_set<_slp_tree*, false,
default_hash_traits<_slp_tree*> >*) (tree-vect-slp.cc:3003)
==31587==    by 0x1649557: vect_match_slp_patterns (tree-vect-slp.cc:3042)
==31587==    by 0x1649557: vect_analyze_slp(vec_info*, unsigned int)
(tree-vect-slp.cc:3533)
==31587==    by 0x1653A6F: vect_slp_analyze_bb_1 (tree-vect-slp.cc:7317)
==31587==    by 0x1653A6F: vect_slp_region(vec<basic_block_def*, va_heap,
vl_ptr>, vec<data_reference*, va_heap, vl_ptr>, vec<int, va_heap, vl_ptr>*,
unsigned int, loop*) (tree-vect-slp.cc:7419)
==31587==    by 0x165574C: vect_slp_bbs(vec<basic_block_def*, va_heap, vl_ptr>
const&, loop*) (tree-vect-slp.cc:7610)
==31587==    by 0x16559C6: vect_slp_function(function*) (tree-vect-slp.cc:7698)
==31587==    by 0x165E611: (anonymous
namespace)::pass_slp_vectorize::execute(function*) (tree-vectorizer.cc:1532)
==31587==    by 0x1296F9A: execute_one_pass(opt_pass*) (passes.cc:2644)
==31587==    by 0x129788F: execute_pass_list_1(opt_pass*) (passes.cc:2753)
==31587==    by 0x12978A1: execute_pass_list_1(opt_pass*) (passes.cc:2754)
==31587==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==31587== 
during GIMPLE pass: slp
testcase.c: In function 'foo':
testcase.c:6:1: internal compiler error: Segmentation fault
    6 | foo (void)
      | ^~~
0x139f4af crash_signal
        /repo/gcc-trunk/gcc/toplev.cc:314
...

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-4175-20221120174242-g6b5c98c1c00-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r13-4175-20221120174242-g6b5c98c1c00-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20221118 (experimental) (GCC)

Reply via email to