https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69381
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |arc Status|UNCONFIRMED |WAITING Last reconfirmed| |2016-01-20 Component|c |target Version|unknown |4.8.4 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- works fine on x86_64. Note your testcase doesn't compile and is likely optimized to nothing (you don't use 'res'). I've fixed it to typedef __SIZE_TYPE__ size_t; size_t strnlen(const char * s, size_t count) { const char *sc; for (sc = s; count-- && *sc != '\0'; ++sc) /* nothing */; return sc - s; } int main() { signed int prec = -1; size_t res=0; char* str = "mordy"; res = strnlen(str, prec); return res; } note also that GCC 4.8 is no longer supported so please try a more recent version (preferably 5.3).