projects
/
debian
/
cc1111
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Imported Upstream version 2.9.0
[debian/cc1111]
/
support
/
regression
/
tests
/
bug-524697.c
1
/* Bad addition for adding a length and char[]
2
*/
3
#include <testfwk.h>
4
5
#if defined(SDCC_mcs51)
6
#define SZ_SIZE 89
7
#else
8
#define SZ_SIZE 90
9
#endif
10
11
typedef struct _Foo
12
{
13
char sz[SZ_SIZE];
14
} Foo;
15
16
typedef struct _Bar
17
{
18
unsigned int uLen;
19
} Bar;
20
21
char *getOffset(Foo *pFoo, Bar *pBar)
22
{
23
return pFoo->sz + pBar->uLen;
24
}
25
26
void
27
testOffset(void)
28
{
29
Foo foo = {
30
"Foo"
31
};
32
Bar bar = {
33
3
34
};
35
36
ASSERT(getOffset(&foo, &bar)
37
== (((char *)&foo) + 3));
38
}