Issue |
91357
|
Summary |
clang on windows (VS 2022) provides unhelpful error message when attempting to use alloca
|
Labels |
clang
|
Assignees |
|
Reporter |
msprotz
|
```
c:\Users\protz\Desktop\hacl-packages>clang --version
clang version 17.0.3
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin
c:\Users\protz\Desktop\hacl-packages>clang test.c
test.c:5:12: error: call to undeclared library function 'alloca' with type 'void *(unsigned long long)'; ISO C99 and
later do not support implicit function declarations [-Wimplicit-function-declaration]
5 | int *x = alloca(sizeof(int));
| ^
test.c:5:12: note: include the header <stdlib.h> or explicitly provide a declaration for 'alloca'
1 error generated.
c:\Users\protz\Desktop\hacl-packages>type test.c
#include <string.h>
#include <stdlib.h>
int main() {
int *x = alloca(sizeof(int));
memset(x, 0, sizeof(int));
return x[0];
}
```
the recommendation to use `stdlib.h`, as provided in the error message, is incorrect, since what I need for this particular toolchain is `malloc.h`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs