aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/crc-20.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/crc-20.c')
-rw-r--r--gcc/testsuite/gcc.dg/crc-20.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/crc-20.c b/gcc/testsuite/gcc.dg/crc-20.c
new file mode 100644
index 0000000..e9b6897
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/crc-20.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-crc" } */
+
+#include <stdint.h>
+
+//Spoiled crc value
+uint16_t not_crc(uint16_t crc, uint8_t a) {
+ int i;
+ crc ^= a;
+ for (i = 0; i < 8; ++i) {
+ if (crc & 1) {
+ crc = 0;
+ crc = (crc << 1) ^ 0xA001;
+ }
+ else
+ crc = crc >> 1;
+ }
+ return crc;
+}
+
+/* { dg-final { scan-tree-dump-times "Attention! not_crc function calculates CRC." 0 "crc"} } */
+