Re: [PATCH] sccvn: Avoid UB in ao_ref_init_from_vn_reference [PR105533]

2024-03-07 Thread Richard Biener
On Thu, 7 Mar 2024, Jakub Jelinek wrote: > Hi! > > When compiling libgcc or on e.g. > int a[64]; > int p; > > void > foo (void) > { > int s = 1; > while (p) > { > s -= 11; > a[s] != 0; > } > } > sccvn invokes UB in the compiler as detected by ubsan: > ../../gcc/poly-int.h

[PATCH] sccvn: Avoid UB in ao_ref_init_from_vn_reference [PR105533]

2024-03-06 Thread Jakub Jelinek
Hi! When compiling libgcc or on e.g. int a[64]; int p; void foo (void) { int s = 1; while (p) { s -= 11; a[s] != 0; } } sccvn invokes UB in the compiler as detected by ubsan: ../../gcc/poly-int.h:1089:5: runtime error: left shift of negative value -40 The problem is that w