Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in len() builtin #36

Closed
drjdn opened this issue Aug 7, 2018 · 1 comment
Closed

Bug in len() builtin #36

drjdn opened this issue Aug 7, 2018 · 1 comment

Comments

@drjdn
Copy link

drjdn commented Aug 7, 2018

The builtin len() function fails on the following:

gomacro> a := [...]int{1,2,3}
gomacro> a
[1 2 3]	// [3]int
gomacro> cap(a)
3	// int
gomacro> len(a)
runtime error: invalid memory address or nil pointer dereference

This is on an x86-64 Linux system running kernel 4.14.60. Doubt the system I'm running has much to do with this error but if so just let me know and I can provide further details.

Thanks,
Jason

@cosmos72
Copy link
Owner

The optimization that evaluates len() at compile time was incomplete. fixed in 0eb51bf

cosmos72 added a commit that referenced this issue Aug 15, 2018
fix #36: do not crash on a := [...]int{1,2,3}; len(a)
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

No branches or pull requests

2 participants