tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

cgo: fixes panic when FuncType.Results is nil

Open codefromthecrypt opened this issue 3 years ago • 5 comments
trafficstars

FuncType.Results can be nil. This fixes the comparison and backfills relevant tests.

Fixes #3096

codefromthecrypt avatar Sep 07 '22 05:09 codefromthecrypt

macOS failure looks like the same as #2892 ?

tinygo:ld.lld: error: undefined symbol: _notARealFunction
[19703](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19704)
>>> referenced by /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tinygo492537698/main.o
[19704](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19705)
failed to run tool: ld.lld
[19705](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19706)
--- FAIL: TestFail (0.00s)
[19706](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19707)
    fail
[19707](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19708)
FAIL

codefromthecrypt avatar Sep 07 '22 05:09 codefromthecrypt

The _notARealFunction error message is noise. It just tests for a linker error, which results in some output on stderr. We should make this less confusing by redirecting stderr.

aykevl avatar Sep 08 '22 15:09 aykevl

@codefromthecrypt did you see @aykevl comment on this PR?

https://github.com/tinygo-org/tinygo/pull/3136#pullrequestreview-1100940709

deadprogram avatar Sep 20 '22 19:09 deadprogram

@deadprogram thanks I missed it. yeap I can add a second layer test beyond the unit tests. np

codefromthecrypt avatar Sep 21 '22 00:09 codefromthecrypt

@FGadvancer I fixed the bug, but we should have an integration test that makes sure it stays fixed. Can you paste the code that led to this panic? It is better than me wildly guessing.

codefromthecrypt avatar Sep 21 '22 02:09 codefromthecrypt

It took a while for me to figure out from the stack trace what the bug was, but am over budget doing more than work provided. If someone is interested in raising a PR to obviate this adding the second layer of tests, works for me. If only one layer of tests isn't good enough and this bug is tolerable meanwhile, I also don't mind if someone closes this.

codefromthecrypt avatar Sep 22 '22 13:09 codefromthecrypt

This seems better than it is right now, at the very least. Now squash/merging thank you for the code @codefromthecrypt

deadprogram avatar Sep 26 '22 17:09 deadprogram