Open HNYuuu opened 2 years ago
I doubted that it may be the compiler's problem. However, the wasmtime can output the correct string.
Thus, we can conclude it is due to some inherent problems in our framework.
Weird output, but I have no time to step in this issue. Leave for other developers.
Describe the bug In
Wasm-samples/c_samples.nosync/source/test_c_library.c
, we add astrstr
function to illustrate the ability of our engine.However, after several tests, we find that: once the
needle
is longer than 4 bytes, thestrstr
would invoketwoway_strstr
, and the return value ofstrstr
is always0
.We find the source code of
twoway_strstr
, and put it inWasm-samples/c_samples.nosync/source/twoway_strstr.c
, whose result is equivalent to the real execution.Thus, we guess the reason behind that is:
strstr
totwoway_strstr
twoway_strstr
embedded instrstr
is not equivalent to oursTo Reproduce Directly execute these two samples to see the different:
The
twoway_strstr
we found:The problematic
strstr
:Expected behavior The haystack is
TutorialPoint
and the needle isPoint
. Thus, the output should bePoint
.