summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a9bceda)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1971
4a8a32a2-be11-0410-ad9d-
d568d2c75423
--- /dev/null
+/* Bad addition for adding a length and char[]
+ */
+#include <testfwk.h>
+
+typedef struct _Foo
+{
+ char sz[100];
+} Foo;
+
+typedef struct _Bar
+{
+ unsigned int uLen;
+} Bar;
+
+char *getOffset(Foo *pFoo, Bar *pBar)
+{
+ return pFoo->sz + pBar->uLen;
+}
+
+void
+testOffset(void)
+{
+ Foo foo = {
+ "Foo"
+ };
+ Bar bar = {
+ 3
+ };
+
+ ASSERT(getOffset(&foo, &bar)
+ == (((char *)&foo) + 3));
+}