summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3235.c
blob: 5422047a8f43477b9308c676b5128cbb533215c8 (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
/*
   bug-3235.c. A function call was incorrectly considered to be recursive in the peephole optimizer when the name of the callee was a prefix of the caller's name.
   Required some further conditions, such as register arguments to the callee and tail-call optimization to trigger.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

void
func (int a) __z88dk_callee;

void
func_ (void)
{
  func (23);
  return;
}

int i;

void
testBug (void)
{
  func_();
  ASSERT (i == 23);
  return;
}

void
func (int a) __z88dk_callee
{
  i = a;
}