https://bugs.llvm.org/show_bug.cgi?id=40470
Bug ID: 40470
Summary: CMake config checks lead to invalid output wasm
Product: lld
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedb...@nondot.org
Reporter: alonza...@gmail.com
CC: llvm-bugs@lists.llvm.org, peter.sm...@linaro.org
Testcase:
===
#ifdef CHECK_FUNCTION_EXISTS
#ifdef __cplusplus
extern "C"
#endif
char
CHECK_FUNCTION_EXISTS(void);
#ifdef __CLASSIC_C__
int main()
{
int ac;
char* av[];
#else
int main(int ac, char* av[])
{
#endif
CHECK_FUNCTION_EXISTS();
if (ac > 1000) {
return *av[0];
}
return 0;
}
#else /* CHECK_FUNCTION_EXISTS */
#error "CHECK_FUNCTION_EXISTS has to specify the function"
#endif /* CHECK_FUNCTION_EXISTS */
===
Build with
emcc a.c -DCHECK_FUNCTION_EXISTS=strtod
Output is
===
redeclaration of library function 'strtod'
[-Wincompatible-library-redeclaration]
CHECK_FUNCTION_EXISTS(void);
^
<command line>:9:31: note: expanded from here
#define CHECK_FUNCTION_EXISTS strtod
^
a.c:7:3: note: 'strtod' is a builtin with type 'double (const char *, char **)'
<command line>:9:31: note: expanded from here
#define CHECK_FUNCTION_EXISTS strtod
^
1 warning generated.
Ddef __stack_pointer
wasm-ld: warning: function signature mismatch: strtod
>>> defined as () -> i32 in /tmp/emscripten_temp_OvrAvc/a_0.o
>>> defined as (i32, i32) -> f64 in
>>> /home/azakai/.emscripten_cache/wasm_o/libc.a(strtod_94cb6386.c.o)
===
It complains correctly about the invalid signature. However, the wasm-ld stage
emitted a wasm, which is invalid. wabt errors with
/tmp/emscripten_temp/a.out.wasm:00001f9: error: type mismatch in call, expected
[i32, i32] but got []
and as emcc continues on to run wasm-emscripten-finalize that fails with
[parse exception: attempted pop from empty stack / beyond block start boundary
at 505 (at 0:505)]
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs