I've update to 1.10, and it shows nothing "after compile", actually it's shows error when "run" the file.
The question is that we expect the error shows "when compile the code", not after compile and "runs it".
As soon as the array index is a variable and not a constant, the error message can only be shown at runtime, otherwise some sort of interpreter would be required to catch the error before.
Last edit: fxm (freebasic.net) 2024-02-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To catch this kind of error at compile time would require capability for static analysis, which is likely hundreds and hundreds of hours to implement, or a rewrite of the compiler. Moved to feature requests.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But this will return compile error with "Array out-of-bounds"
With the first code, I get the runtime error:
information of freebasic:
FreeBASIC Compiler - Version 1.07.1 (2024-01-29), built for linux (32bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
Is there any chance that different result cause by freebasic version?
Last edit: Michelle.Tsai 2024-02-02
Take the opportunity to update your FreeBASIC to the latest official version (1.10).
This is normally the thing to do before writing a bug report.
I've update to 1.10, and it shows nothing "after compile", actually it's shows error when "run" the file.
The question is that we expect the error shows "when compile the code", not after compile and "runs it".
terminal link

FYI
above code shows error when compile
As soon as the array index is a variable and not a constant, the error message can only be shown at runtime, otherwise some sort of interpreter would be required to catch the error before.
Last edit: fxm (freebasic.net) 2024-02-02
To catch this kind of error at compile time would require capability for static analysis, which is likely hundreds and hundreds of hours to implement, or a rewrite of the compiler. Moved to feature requests.
Ticket moved from /p/fbc/bugs/1002/
Can't be converted: