2018-03-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / Wstrict-overflow-23.c
blob16014bb15c5299d3a7ddef8d84e817b1004e2452
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wstrict-overflow" } */
4 unsigned int
5 do_scrolling (unsigned int window_size, unsigned int writecost)
7 unsigned int i = window_size;
9 int terminal_window_p = 0;
10 unsigned int queue = 0;
12 for (i = window_size; i; i--)
14 if (writecost < i)
15 ++queue;
16 else if (writecost & 1)
17 terminal_window_p = 1;
20 if (queue > 0)
22 if (!terminal_window_p)
24 terminal_window_p = 1;
28 if (terminal_window_p)
29 return 100;
30 return 0;