repo.or.cz
/
sdcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
struct / union in initializer, RFE #901.
[sdcc.git]
/
sdcc
/
support
/
regression
/
tests
/
bug-2834.c
blob
5d03606d1914ccdd3f5e4e80b6bbcaba9dcc98d8
1
/* bug-2834.c
2
A bug in union initialization.
3
*/
4
5
#include <testfwk.h>
6
7
union
u
8
{
9
int
i
;
10
int
j
;
11
};
12
13
_Bool
check
(
union
u
*
u
)
14
{
15
return
(
u
->
i
==
23
);
16
}
17
18
void
testBug1
(
void
)
19
{
20
union
u u
= {
23
};
21
ASSERT
(
check
(&
u
));
22
}
23
24
void
testBug2
(
void
)
25
{
26
union
u u
= {.
i
=
23
};
27
ASSERT
(
check
(&
u
));
28
}
29
30
void
testBug3
(
void
)
31
{
32
union
u u
= {.
j
=
23
};
33
ASSERT
(
check
(&
u
));
34
}
35