Browse Source

Prevent memset from calling itself

With -ftree-loop-distribute-patterns, GCC detects that the body of memset
is equivalent to memset, and so turns it into a call to memset, causing
infinite recursion.

Closes #170.
pull/171/head
Andrew Waterman 7 years ago
parent
commit
bc94419338
  1. 5
      util/string.c

5
util/string.c

@ -4,6 +4,11 @@
#include <stdint.h>
#include <ctype.h>
#ifdef __GNUC__
// Don't let GCC pattern-match these functions' bodies into self-calls
#pragma GCC optimize ("no-tree-loop-distribute-patterns")
#endif
void* memcpy(void* dest, const void* src, size_t len)
{
const char* s = src;

Loading…
Cancel
Save