In case we want to vectorize the loop, we can not
rely only on TREE_OVERFLOW flag, while folding the INTEGER_CST,
which represents the step of vectorization.
We still should check TYPE_OVERFLOW_WRAPS flag instead
TYPE_OVERFLOW_SANITIZED flag, because the step could
be already marked as TREE_OVERFLOW == 1.
Change-Id: I1288b7e3b587c5773b184636bdfdada168b8941f
if (TREE_OVERFLOW (tem) == TREE_OVERFLOW (t)
|| (ANY_INTEGRAL_TYPE_P (type)
&& !TYPE_OVERFLOW_TRAPS (type)
- && !TYPE_OVERFLOW_SANITIZED (type))
- || (flag_sanitize & (SANITIZE_SI_OVERFLOW | SANITIZE_UI_OVERFLOW)) == 0)
+ && TYPE_OVERFLOW_WRAPS (type))
+ || (flag_sanitize & (SANITIZE_SI_OVERFLOW | SANITIZE_UI_OVERFLOW))
+ == 0)
return tem;
break;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=unsigned-integer-overflow" } */
+
+typedef struct {
+ int r;
+ int i;
+} kiss_fft_cpx;
+
+typedef struct {
+ int inmem[0];
+} TonalityAnalysisState;
+
+float a;
+kiss_fft_cpx b[0];
+TonalityAnalysisState c;
+
+void foo() {
+ int i = 0;
+ for (; i < 40; i++)
+ b[-i].i = a * c.inmem[i];
+}