-O3 or -O4 Error: Incompatible types
System Information
- Operating system: linux opensuse tumbleweed
- Processor architecture: x86-64
- Compiler version: 60690e37
- Device: Computer
Steps to reproduce
- create directory
chsdetbug
- create file
chsdetbug/chsdetbug.pas
with content:unit chsdetbug; interface implementation type myrec=record f1,f2,f3:byte; end; myenum=( asd=0 ); const myarr:array [myenum] of myrec=( (f1:1;f2:2;f3:3) ); procedure foo; var i:byte; begin for i:=0 to 0 do writeln(myarr[myenum(i)].f2); end; end.
- run
ppcx64 -O3 chsdetbug/chsdetbug.pas
What is the current bug behavior?
Free Pascal Compiler version 3.3.1 [2024/12/08] for x86_64
Copyright (c) 1993-2024 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling chsdetbug/chsdetbug.pas
chsdetbug.pas(22,9) Error: Incompatible types: got "Byte" expected "myenum"
chsdetbug.pas(26,4) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
What is the expected (correct) behavior?
Free Pascal Compiler version 3.3.1 [2024/12/08] for x86_64
Copyright (c) 1993-2024 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling chsdetbug/chsdetbug.pas
Assembling chsdetbug
25 lines compiled, 0.0 sec