Bug 107435 - [13 Regression] ice in build_vector_from_val, at tree.cc:2125
Summary: [13 Regression] ice in build_vector_from_val, at tree.cc:2125
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 13.0
: P1 normal
Target Milestone: 13.0
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2022-10-27 15:00 UTC by David Binderman
Modified: 2022-10-28 13:09 UTC (History)
0 users

See Also:
Host:
Target: x86_64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-10-28 00:00:00


Attachments
C source code (55.71 KB, text/x-csrc)
2022-10-27 15:00 UTC, David Binderman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2022-10-27 15:00:33 UTC
Created attachment 53780 [details]
C source code

For the attached code, compiled with 

-std=gnu89 -O3 -march=znver3 -c bug858.c

recent gcc does this:

during GIMPLE pass: vect
src/io/trove/trove-dbpf/dbpf-open-cache.c: In function ‘dbpf_open_cache_initiali
ze’:
src/io/trove/trove-dbpf/dbpf-open-cache.c:100:6: internal compiler error: in bui
ld_vector_from_val, at tree.cc:2125
0x1072d8e build_vector_from_val(tree_node*, tree_node*)
	../../trunk.git/gcc/tree.cc:2124
0x100a927 vectorizable_recurr(_loop_vec_info*, _stmt_vec_info*, gimple**, _slp_t
ree*, vec<stmt_info_for_cost, va_heap, vl_ptr>*)
	../../trunk.git/gcc/tree-vect-loop.cc:8472

The bug first seems to occur sometime between git hash baeec7cc83b19b46
and 3bd5d9a28e1ce4d1, a day later.

I have a reduction running.
Comment 1 David Binderman 2022-10-27 15:23:39 UTC
Reduced C code seems to be:

struct qlist_head {
  struct qlist_head *next
} qlist_add(struct qlist_head *new, struct qlist_head *head) {
  struct qlist_head *prev = head;
  new->next = head->next;
  prev->next = new;
}
struct {
  struct qlist_head queue_link
} free_list, prealloc[];
dbpf_open_cache_initialize() {
  int i = 0;
  for (; i < 64; i++)
    qlist_add(&prealloc[i], &free_list);
}
Comment 2 Richard Biener 2022-10-28 11:43:34 UTC
Mine.  Missing a conversion of the scalar pointer to the vector component type.
Comment 3 GCC Commits 2022-10-28 13:07:21 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:084128583212bd64308f50c2ab5f4c03be40e48c

commit r13-3544-g084128583212bd64308f50c2ab5f4c03be40e48c
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Oct 28 13:50:57 2022 +0200

    tree-optimization/107435 - ICE with recurrence vectorization
    
    This implements the missed conversion from pointer to integer.
    
            PR tree-optimization/107435
            * tree-vect-loop.cc (vectorizable_recurr): Convert initial
            value to vector component type.
    
            * gcc.dg/torture/pr107435.c: New testcase.
Comment 4 Richard Biener 2022-10-28 13:09:24 UTC
Fixed.