Unable to read 0-th character from a string with range checking for zero based strings.
## Summary If reading 0-th character from a string with range checking for zero based strings, a range check error yields. ## System Information <!-- The more information are provided the easier it is to replicate the bug --> - **Operating system:** MacOS 14.6.1 (Sonoma)<!-- Windows, Linux (if possible, also name the distro), FreeBSD, Android, ... --> - **Processor architecture:** AARCH64 <!-- x86, x86-64, ARM, AARCH64, AVR, RISC-V, PowerPC, ... --> - **Compiler version:** 3.2.2 <!-- 3.2, 3.2.2, 3.3, trunk, beta, ... (if possible, give also the git hash) --> - **Device:** Computer <!-- Computer, Tablet, Mobile, Amiga, Microcontroller, ... --> ## Steps to reproduce 1. Open Lazarus, Create a console application project `project1`. 2. Paste the code inside `project1.lpr`: ```pascal Program project1; {$ZEROBASEDSTRINGS ON} {$R+} Var I: Integer; S: String; Begin S := 'abc'; WriteLn(Length(S)); For I := High(S) Downto Low(S) Do WriteLn(I, ' ---> ', S[I]); End. ``` 3. Save and build the application. 4. Open a terminal and run the application using command line. ```bash $ cd /path/to/project1/ $ ./project1 ``` ## Example Project <!-- If possible, please create an example project that exhibits the problematic behavior, and link to it here in the bug report. --> ## What is the current bug behavior? A runtime error 201 comes up in the terminal window: ```bash 3 2 ---> c 1 ---> b Runtime error 201 at $00000001040A33B0 $00000001040A33B0 ``` <!-- What actually happens --> ## What is the expected (correct) behavior? No any error, and the result should be like this: ```bash 3 2 ---> c 1 ---> b 0 ---> a ``` <!-- What you should see instead --> ## Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as it's very hard to read otherwise. You can also use syntax highlighting for Pascal with: ```pascal the code``` For more information see https://docs.gitlab.com/ee/user/markdown.html --> ## Possible fixes <!-- If you can, link to the line of code that might be responsible for the problem -->
issue