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