What do you expect to get by doing:
type Triads = Array [0..2] of Integer; var row: Array [0..3] of Triads; i: Integer; Const triad: Triads = (1, 2, 3); Begin row[1][0] := triad[0]; Writeln (row[1][0]); i:=1; Writeln (row[0]); Readln; End.
( I attached a text file with the program because it doesn't appear correctly in this box.)Please use on forum topic editor the [ # ] button to generate [ code=pascal ][ /code ] and put your code inside the ][
In fact it is WriteLn (row[j][0]); as appears in the code I post just now.
Hello, I am using the Free Pascal IDE for Win32, version 1.0.12.
QuoteHello, I am using the Free Pascal IDE for Win32, version 1.0.12.
did you notice the version number? Isn't that quite old and what version fpc was used for that back then ?
current release is 2.2.6 for the IDE and 3.2.2 comes with it believe.
I started Lazarus I think when it was 1.64.x something way back.....
Maybe it's a typo but also maybe it's accurate, too?
In fact it is WriteLn (row[j][0]); as appears in the code I post just now.
gives this on with fpc 3.2.2 Linux 64 bit (not tested on Windows 32):
1 1
[EDIT] Tested with fpc.exe 3.2.2 32 bit on Windows 11 and same result.
Or more compact:
program Project1;
I use the textmode IDE at version 1.0.12 with FPC 3.2.0, and also have 3.2.3 installed. Windowns 10. I tested your version and KodeZwerg's compact version and always get the expected output, regardless which compiler settings I tried, with 3.2.0 as well as 3.2.3. I would be really surprised if that was an FPC bug. Could you please specify your compiler settings i.e. target processor, optimisation etc.
Or post your fp.cfg file.
in the IDE under Options/Compiler/Processor just select some newer processor type for optimization, and the problem should be gone forever.
in the IDE under Options/Compiler/Processor just select some newer processor type for optimization, and the problem should be gone forever.
Many many thanks! I am so glad you identified the problem!
But in Options/Compiler I don't find the Processor, I only see Syntax Switches and Compiler mode. as in the attachment, can you enlighten me? Many thanks
Hello.
In your fp.cfg, remove all the lines with:
-Cp80386
-Op80386[/b]
@Nitorami : Well seen! ;D
Alright, I could identify the conditions under which this happens, and reproduce the issue on a different machine with an AMD processor, FPC 3.2.2, optimization target processor set to 80386, and level 1 optimisation ON, but no other optimisations. It also happens with fpc 3.0.4., but not with 3.3.1. I don't believe it has actively been fixed in 3.3.1, this may just be random.
@JMarques: You can easily get around this, in the IDE under Options/Compiler/Processor just select some newer processor type for optimization, and the problem should be gone forever.
In the meantime, I'll file a bug report. This is a severe issue and should not happen which such a simple code.
@JMarques: Your menu looks odd, and tabs are missing. You should see Generated Code, Processor, etc. like in the attached screenshot.
In the meantime, I'll file a bug report. This is a severe issue and should not happen which such a simple code.