gcc/testsuite/c-c++-common/analyzer/infinite-loop-crc32c.c
raw| 1 | /* Based on qemu's util/crc32c.c, in turn based on the |
| 2 | Linux kernel cryptographic crc32c module. */ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | extern const uint32_t crc32c_table[256]; |
| 7 | |
| 8 | uint32_t crc32c(uint32_t crc, const uint8_t *data, unsigned int length) |
| 9 | { |
| 10 | while (length--) { /* { dg-bogus "infinite loop" } */ |
| 11 | crc = crc32c_table[(crc ^ *data++) & 0xFFL] ^ (crc >> 8); |
| 12 | } |
| 13 | return crc^0xffffffff; |
| 14 | } |