bad shift right 12
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 18 Feb 2003 09:54:30 +0000 (09:54 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 18 Feb 2003 09:54:30 +0000 (09:54 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2280 4a8a32a2-be11-0410-ad9d-d568d2c75423

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

diff --git a/support/regression/tests/bug-607243.c b/support/regression/tests/bug-607243.c
new file mode 100644 (file)
index 0000000..00ed648
--- /dev/null
@@ -0,0 +1,16 @@
+/* bad shift right 12 */
+
+#include <testfwk.h>
+
+typedef unsigned int u16_t; 
+
+struct myhdr { u16_t x; } h, *p; 
+
+#define NTOHS(n) (((((u16_t)(n) & 0xff)) << 8) | (((u16_t)(n) & 0xff00) >> 8)) 
+#define IPH_V(hdr) ((u16_t)NTOHS((hdr)->x) >> 12) 
+
+void foo(void) { 
+  p = &h; 
+  p->x = 0x45; 
+  ASSERT(IPH_V(p)==4);
+}