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

V panic error after some use on VM #145

Open
rahim-gh opened this issue Jun 2, 2024 · 2 comments
Open

V panic error after some use on VM #145

rahim-gh opened this issue Jun 2, 2024 · 2 comments

Comments

@rahim-gh
Copy link

rahim-gh commented Jun 2, 2024

compiled from source, got the iso and use it in QEMU VM, after some use (hangs around the file system, compile and run the pre-write codes) suddenly the system crushed with the error: V panic: array.get: index out of range like in the screenshot.

Screenshot_VinixOS_2024-06-02_21:05:40

another problem, the v compiler isn't working at all, and thanks.

@ArisAthena
Copy link

Perhaps it would be helpful if the latest version of the v compiler was used. Secondly the logs could be checked in Vinix with dmesg and journalctl -u vinix This might shed light on precisely what happened but the sort of message you got indicates a bug with the version of V that is being used. What do you think?

@ArisAthena
Copy link

ArisAthena commented Dec 22, 2024

Highly typically the error involves the array.get function, so peeking at the source code for V in vlib/arrays/arrays.v It seems that the array handling functions are well written but as a case example the first one,

// min returns the minimum value in the array
// Example: arrays.min([1, 2, 3, 0, 9])! // => 0
pub fn min[T](array []T) !T {
        if array.len == 0 {
                return error('.min called on an empty array')
       }
       mut val := array[0]
               for e in array {
                       if e < val {
                               val = e
                       }
        }
        return val
}

The function correctly checks for an empty array and returns an error. However, if the function is called with an empty array and the error is not handled, the program will panic. And so on and so forth the file needs to be examined carefully. What do you think?

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