fix: set correct argc=0 in _start() function#1211
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1211 +/- ##
=======================================
Coverage 87.93% 87.94%
=======================================
Files 32 32
Lines 7653 7657 +4
=======================================
+ Hits 6730 6734 +4
Misses 844 844
Partials 79 79 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Fixing argv instead of argc. argc should be greater than or equal to 1, and argv[0] should be the executable path. |
I found a few challenges:
So i think the most reasonable solution might be setting argc = 1 and argv[0] to an empty string to at least comply with the C standard minimum requirements, rather than the current argc = 0, argv = null. |
I agree with your solution. |
The original code used
icmp eq i32 0, 0which always evaluates to true, resulting in argc=1:Output: 1 (incorrect)
After fix with add i32 0, 0, argc correctly equals 0.