aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2017-04-18 19:55:13 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2017-04-18 19:56:40 +0000
commit158dd0ff70a06c65449a0d61d78a65877f15d112 (patch)
tree1c8602654084b4649445b10e81c928e323d24e37
parent082286108f6b3ce3184e4784b475f251bfc64bfb (diff)
bug-2684: New test.
Change-Id: I70fac8f96a7c4d78572229578ac3c441c01509fb
-rw-r--r--bug-2684/Makefile1
-rw-r--r--bug-2684/bug-2684.cpp62
-rwxr-xr-xbug-2684/build.sh10
3 files changed, 73 insertions, 0 deletions
diff --git a/bug-2684/Makefile b/bug-2684/Makefile
new file mode 100644
index 0000000..23f8a8f
--- /dev/null
+++ b/bug-2684/Makefile
@@ -0,0 +1 @@
+include ../common.mk
diff --git a/bug-2684/bug-2684.cpp b/bug-2684/bug-2684.cpp
new file mode 100644
index 0000000..f1da22d
--- /dev/null
+++ b/bug-2684/bug-2684.cpp
@@ -0,0 +1,62 @@
+#define FUNC_MACRO (sizeof(unsigned long) - 1)
+
+void FUNC(void* d, void const* s, unsigned long n)
+{
+ const unsigned long *ass = (const unsigned long *)s;
+ unsigned long* adt = (unsigned long*)d;
+ const unsigned char* ss = (const unsigned char*)s;
+ unsigned char* dt = (unsigned char*)d;
+ unsigned long i = 0;
+
+ if (n >= 16)
+ {
+ if (((((unsigned long)ss) & FUNC_MACRO) == 0) && ((((unsigned long)dt) & FUNC_MACRO) == 0))
+ {
+ unsigned long asize = n / sizeof(unsigned long);
+ unsigned long rem = n & FUNC_MACRO;
+ for (i = 0; i < (asize - 3); i += 4)
+ {
+ adt[i] = ass[i];
+ adt[i+1] = ass[i+1];
+ adt[i+2] = ass[i+2];
+ adt[i+3] = ass[i+3];
+ }
+
+ while (i < asize)
+ {
+ adt[i] = ass[i];
+ ++i;
+ }
+ i = n - rem;
+ }
+ else
+ {
+ for (i = 0 ; (i + 15) < n; i += 16)
+ {
+ dt[i] = ss[i];
+ dt[i+1] = ss[i+1];
+ dt[i+2] = ss[i+2];
+ dt[i+3] = ss[i+3];
+ dt[i+4] = ss[i+4];
+ dt[i+5] = ss[i+5];
+ dt[i+6] = ss[i+6];
+ dt[i+7] = ss[i+7];
+ dt[i+8] = ss[i+8];
+ dt[i+9] = ss[i+9];
+ dt[i+10] = ss[i+10];
+ dt[i+11] = ss[i+11];
+ dt[i+12] = ss[i+12];
+ dt[i+13] = ss[i+13];
+ dt[i+14] = ss[i+14];
+ dt[i+15] = ss[i+15];
+ }
+ }
+
+ }
+ while (i < n)
+ {
+ dt[i] = ss[i];
+ ++i;
+ }
+}
+
diff --git a/bug-2684/build.sh b/bug-2684/build.sh
new file mode 100755
index 0000000..d5a9e58
--- /dev/null
+++ b/bug-2684/build.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -e
+
+CXXFLAGS="-DPTPD_PTIMERS -DPTPD_UNICAST_MAX=128 -c -g3 -funwind-tables -O2 -fmessage-length=0 -fno-strict-aliasing -Wall -D_C99 -D_HAS_C9X"
+
+echo "$(basename $(pwd)): FAIL" > result.txt
+set -x
+${CXX} -c -o /dev/null ${CXXFLAGS} bug-2684.cpp
+set +x
+echo "$(basename $(pwd)): PASS" > result.txt