ABC1234567
ABC DEF1234567890
ABCDEF234567890??@??
Free Pascal Compiler version 3.2.0 [2020/07/07] for x86_64
@lucamar, It seems the compiler used the first character 'A' or $41 as the length of the string.
Maybe the compiler creates a [temporary] short string, gives it the length of the first string for the bug in the first post by @tomitomy, or some random(?) length as in the bug pointed out by @trev.
Quote from: engkin on April 12, 2021, 07:14:15 pmMaybe the compiler creates a [temporary] short string, gives it the length of the first string for the bug in the first post by @tomitomy, or some random(?) length as in the bug pointed out by @trev.Test (Win x64):Code: Pascal [Select][+][-]{$APPTYPE CONSOLE}{$MODE OBJFPC}{$LONGSTRINGS ON} procedure Test;var S: string;begin for S in [('ABC'+'D'+'EFGH'), ('12345678')] do WriteLn(S);end; begin Test; Readln;end.As we can see the second constant (PROGRAM$_Ld2) is defined as just PChar and the program crashes with SIGSEGV.
So add the {$H-} or change string to string[8] will remove the exception.