1/* Test for a bug in 4.1 ivcanon code. The loop ends up with two IV, both 2 with a base of &num[1]. In the provess of converting the < condition to = 3 we calculate (base1 - 1) - base0, which overflows and gives 0xffffffffu 4 leading to a bogus loop iteration count. */ 5#include <stdlib.h> 6 7struct f 8{ 9 int initial_offset; 10 int can_eliminate; 11 int can_eliminate_prev; 12}; 13 14 15struct f num[2] = {{1, 3, 5}, {30, 50, 70}}; 16int x = 0; 17 18int main() 19{ 20 struct f *p; 21 for (p = num; p < &num[1]; p++) 22 { 23 x += p->can_eliminate; 24 } 25 if (x != 3) 26 abort(); 27 exit (0); 28} 29