* support/regression/tests/bug1273984.c: new, added, thanks Günther Jehle
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 6 Feb 2007 23:33:52 +0000 (23:33 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 6 Feb 2007 23:33:52 +0000 (23:33 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4622 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
support/regression/tests/bug1273984.c [new file with mode: 0644]

index 122901e5e2d87870366dcb990f8c2115fb8428ac..488084258b05c4c1d8dbb6bd8886a1f22f4b8d60 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
          can this have lived here for so many years?
        * src/SDCCicode.c (ast2iCode): return left instead of right for assignment,
          fixes bug 1273984, see also patch 1645121, thanks Günther Jehle
+       * support/regression/tests/bug1273984.c: new, added, thanks Günther Jehle
 
 2007-02-06 Bernhard Held <bernhard AT bernhardheld.de>
 
diff --git a/support/regression/tests/bug1273984.c b/support/regression/tests/bug1273984.c
new file mode 100644 (file)
index 0000000..1006a30
--- /dev/null
@@ -0,0 +1,43 @@
+/*  An assignment inside a functioncall changed the type of the parameter.\r
+    See bug description 1273984 for details.\r
+\r
+    Bug detected and fixed by Guenther Jehle\r
+\r
+    sign: unsigned,\r
+ */\r
+\r
+#include <testfwk.h>\r
+\r
+void foo({sign} int val) {\r
+  val; //make the compiler happy\r
+}\r
+\r
+void fooInt({sign} int val) {\r
+  ASSERT(val==3);\r
+}\r
+\r
+void fooChar({sign} char val) {\r
+  ASSERT(val==6);\r
+}\r
+\r
+void\r
+testAssignInFunctioncall(void)\r
+{\r
+  volatile {sign} char charVal=3;\r
+  volatile {sign} int intVal=0x4040;\r
+\r
+  fooInt(intVal=charVal); // should cast charVal to int for function call.\r
+                          // without patch #1645121, a char is put on the stack\r
+                          // (or hold in registers)\r
+  foo(0xAAAA);\r
+  fooInt(intVal=charVal);\r
+\r
+  intVal=6;\r
+\r
+  fooChar(charVal=intVal); // without patch, a int is put on the stack\r
+  foo(0xAAAA);\r
+  fooChar(charVal=intVal);\r
+\r
+}\r
+\r
+\r