Added
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 2 Mar 2002 06:12:18 +0000 (06:12 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 2 Mar 2002 06:12:18 +0000 (06:12 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1971 4a8a32a2-be11-0410-ad9d-d568d2c75423

support/regression/tests/bug-524697.c [new file with mode: 0644]

diff --git a/support/regression/tests/bug-524697.c b/support/regression/tests/bug-524697.c
new file mode 100644 (file)
index 0000000..c32e1db
--- /dev/null
@@ -0,0 +1,32 @@
+/* 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));
+}