summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3482.c
blob: b98c7d3769f0f2baa291160a92be28a05abae3ec (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
/* bug-3685.c
   A non-conncted live range resulted in wrong code generation at a (potential) tail call.
*/

// Based on code by "Under4Mhz" licensed under GPL 2.0 or later

#include <testfwk.h>

#pragma disable_warning 85

#include <stdint.h>

uint16_t fast_rand( void );

void StatePlayerHit( uint8_t amount );

void PlayerHit( int8_t percent ) {

    percent = fast_rand() % 8 + 8;

    StatePlayerHit( percent ); // Code that corrupts the stack was generated for this call.
}

void
testBug(void)
{
	PlayerHit( 0 );
}

uint16_t fast_rand( void ) {
	return 0;
}

void StatePlayerHit( uint8_t amount ) {
}