summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3481.c
blob: c3cf55fca4b139fe89129f0be5596dc020f152c9 (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
32
33
34
35
36
37
38
39
/* bug-3481.c
   A crash in iCode generation for parameters to calls to functions without prototypes.
 */

#include <testfwk.h>

// Function declarations without prototypes no longer exist in C2X.
#pragma std_c99
#pragma disable_warning 283

// Test derived from code by SF user "Under4Mhz" in 2022.

#include <stdint.h>

#if 0 // Bug not yet fixed
uint16_t fast_rand();

void ImageStatusImage( uint8_t health ) {
    uint8_t frame = fast_rand( health ) % 4;
}

void g( void )
{
	ASSERT ( fast_rand ( 1 ) == 2 );
}

uint16_t fast_rand( int x ) {
	return( x + 1 );
}
#endif

void
testBug( void ) {
#if 0 // Bug not yet fixed
	ASSERT ( fast_rand ( 1 ) == 2 );
	g ();
#endif
}