Issue 145508
Summary memcmp() returns unexpected value
Labels new issue
Assignees
Reporter 8ss-boop
    ```
#include <stdio.h>
#include <string.h>
int foo(const char *a, const char *b)
{
return memcmp(a,b,5);
}
int main()
{
int x=foo("HELLO C23","C23 STD");
int y=memcmp("HELLO C23","C23 STD",5);
printf("%d = %d\n",x, y);
}

```
At -O0 optimization level, when called through function foo(), it incorrectly returns 5 instead of 1.

```
5 = 1
```
Reproduce link:
https://godbolt.org/z/4aqY8x3TT
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to