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-2558.c
blob
46b3b036724e04386c0ab417898f014e96495f37
1
/* bug-2807.c
2
Sign of % operand lost in redundancy elimination.
3
*/
4
5
#include <testfwk.h>
6
7
#include <stdint.h>
8
9
uint16_t
x
;
10
11
static
inline
uint16_t
llvm_srem_u16
(
int16_t
a
,
int16_t
b
) {
12
uint16_t
r
=
a
%
b
;
13
return
r
;
14
}
15
16
static
inline
uint16_t
returnx
(
void
)
17
{
18
return
x
;
19
}
20
21
void
foo
(
void
)
22
{
23
x
=
llvm_srem_u16
(
x
,
returnx
());
24
}
25
26
void
testBug
(
void
)
27
{
28
x
= (
unsigned
)(-
1
);
29
foo
();
30
ASSERT
(
x
== (
unsigned
)(-
23
) % (
unsigned
)(-
23
));
31
}
32