Skip to content

Conversation

@no1wudi
Copy link
Collaborator

@no1wudi no1wudi commented Aug 2, 2024

Fix:

wamr/core/iwasm/compilation/aot_llvm.c: In function ‘insert_native_symbol’:
wamr/core/iwasm/compilation/aot_llvm.c:3290:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
 3290 |     if (ret < 0 || ret + 1 > sizeof(sym->symbol)) {
      |                            ^

Fix:
```
wamr/core/iwasm/compilation/aot_llvm.c: In function ‘insert_native_symbol’:
wamr/core/iwasm/compilation/aot_llvm.c:3290:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
 3290 |     if (ret < 0 || ret + 1 > sizeof(sym->symbol)) {
      |                            ^
```

Signed-off-by: Huang Qi <[email protected]>
@no1wudi no1wudi force-pushed the main branch 2 times, most recently from 4321a18 to 2492383 Compare August 2, 2024 06:51
@wenyongh wenyongh requested a review from yamt August 2, 2024 13:25
bh_assert(strlen(symbol) <= sizeof(sym->symbol));
ret = snprintf(sym->symbol, sizeof(sym->symbol), "%s", symbol);
if (ret < 0 || ret + 1 > sizeof(sym->symbol)) {
if (ret < 0 || ret + 1 > (int)sizeof(sym->symbol)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general i prefer to cast to the larger type. (size_t)
but i guess it doesn't matter for this specific code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the size of sym->symbol is is only 48 byte for this case

@wenyongh wenyongh merged commit c3dd559 into bytecodealliance:main Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants