aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/infinite-loop-doom-v_video.c
blob: 35f420655c4442cf998a92f954320984b91f7d71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Reduced from a -Wanalyzer-infinite-loop false positive seen in Doom's
   v_video.c, which is under the GPLv2 or later.  */

typedef unsigned char byte;

byte*				screens[5];

#define SCREENWIDTH 320

void
V_DrawBlock
( int		x,
  int		y,
  int		scrn,
  int		width,
  int		height,
  byte*		src ) 
{ 
    byte*	dest; 

    /* [...snip...] */
 
    dest = screens[scrn] + y*SCREENWIDTH+x; 

    while (height--) /* { dg-bogus "infinite loop" } */
    { 
	__builtin_memcpy (dest, src, width); 
	src += width; 
	dest += SCREENWIDTH; 
    } 
}