View Issue Details

IDProjectCategoryView StatusLast Update
0038439FPCCompilerpublic2021-02-09 21:48
ReporterWilliam M. Waite Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.0 
Fixed in Version3.3.1 
Summary0038439: Character string type does not comply with ISO 7185 Section 6.1.7
DescriptionAccording to ISO 7185, Section 6.1.7 "A character-string containing more than one string-element shall denote a value of
a string-type (see 6 .4 .3 .2) with the same number of components as the character-string contains
string-elements . All character-strings with a given number of components shall possess the same
string-type." Apparently the compiler actually regards all literal string constants as being of the same type.
Steps To ReproduceDeclare a variable as a string type: c: packed array [1..5] of char;

Assign a string constant supposedly of a different string type: c := '1234567890';

No error is reported, and c is assigned the first five characters of the constant.

See the attached file, which tests both longer and shorter string constants.

TagsNo tags attached.
Fixed in Revision48563
FPCOldBugId
FPCTarget-
Attached Files

Activities

William M. Waite

2021-02-05 00:43

reporter  

try.pas (220 bytes)   
program string1(input, output);
    var
        c: packed array [1..5] of char;
        inline: packed array [1..10] of char;
begin
    c := '1234567890';
    writeln(c);
    inline := '12345';
    writeln(inline);
end.
try.pas (220 bytes)   

Florian

2021-02-09 21:15

administrator   ~0128843

Actually, ISO Pascal allows extensions, so FPC does not have to throw an error here. However, I will add a warning in ISO mode.

Issue History

Date Modified Username Field Change
2021-02-05 00:43 William M. Waite New Issue
2021-02-05 00:43 William M. Waite File Added: try.pas
2021-02-09 21:15 Florian Note Added: 0128843
2021-02-09 21:48 Florian Assigned To => Florian
2021-02-09 21:48 Florian Status new => resolved
2021-02-09 21:48 Florian Resolution open => fixed
2021-02-09 21:48 Florian Fixed in Version => 3.3.1
2021-02-09 21:48 Florian Fixed in Revision => 48563
2021-02-09 21:48 Florian FPCTarget => -