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
/
bug3183823.c
blob
2774b9a87e3224f87b106edcb3ccafff5ce4215e
1
/*
2
bug3183823.c
3
*/
4
5
#include <testfwk.h>
6
7
float
neg
(
float
x
)
8
{
9
return
-
x
;
10
}
11
12
void
testNeg
(
void
)
13
{
14
#if !defined(__SDCC_pic16) && !defined(__SDCC_pdk14)
// Lack of memory
15
float
x
,
y
;
16
char
a
,
b
;
17
18
x
=
neg
(
0.0
);
19
y
=
neg
(-
0.0
);
20
ASSERT
(
x
==
0.0
);
21
ASSERT
(
y
==
0.0
);
22
ASSERT
(
x
==-
0.0
);
23
ASSERT
(
y
==-
0.0
);
24
ASSERT
(
x
==
y
);
25
ASSERT
(
x
>=
y
);
26
ASSERT
(
x
<=
y
);
27
ASSERT
(
y
>=
x
);
28
ASSERT
(
y
<=
x
);
29
30
a
= ((
char
*)&
x
)[
0
];
31
b
= ((
char
*)&
x
)[
3
];
32
((
char
*)&
x
)[
0
] =
b
;
33
((
char
*)&
x
)[
3
] =
a
;
34
ASSERT
(
x
!=
0.0
);
35
#endif
36
}