2017-10-21 18:40:19 -05:00
|
|
|
/* Conformance Test 4.3.0.2: Check uniqueness of static variables */
|
|
|
|
|
2022-10-17 17:50:42 -05:00
|
|
|
int printf(const char *, ...);
|
|
|
|
|
2017-10-21 18:40:19 -05:00
|
|
|
static int var;
|
|
|
|
|
|
|
|
int sub1(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
static int var;
|
|
|
|
|
|
|
|
var = 2;
|
|
|
|
|
|
|
|
{
|
|
|
|
static int var;
|
|
|
|
|
|
|
|
var = 3;
|
|
|
|
if (var != 3)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (var != 2)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int sub2(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
static int var;
|
|
|
|
|
|
|
|
var = 2;
|
|
|
|
|
|
|
|
{
|
|
|
|
static int var;
|
|
|
|
|
|
|
|
var = 3;
|
|
|
|
if (var != 3)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (var != 2)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-10-17 17:50:42 -05:00
|
|
|
int main (void)
|
2017-10-21 18:40:19 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
var = 1;
|
|
|
|
|
|
|
|
if (sub1()) goto Fail;
|
|
|
|
if (sub2()) goto Fail;
|
|
|
|
if (var != 1) goto Fail;
|
|
|
|
|
|
|
|
printf ("Passed Conformance Test 4.3.0.2\n");
|
2022-10-17 17:50:42 -05:00
|
|
|
return 0;
|
2017-10-21 18:40:19 -05:00
|
|
|
|
|
|
|
Fail: printf ("Failed Conformance Test 4.3.0.2\n");
|
|
|
|
}
|