View Issue Details

IDProjectCategoryView StatusLast Update
0037154FPCCompilerpublic2020-06-10 22:48
ReporterKai Burghardt Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86_64OSGNU/Linux 
Product Version3.0.4 
Fixed in Version3.3.1 
Summary0037154: inconsistent RTE generation for reading input from an unopened file in mode ISO
DescriptionReading a number or a character from an unopened file either generate RTE 106 (Invalid numeric format) or RTE 6 (Invalid file handle) or RTE 103 (File not open), depending on whether it is `input` or any other file and whether it is a numeric or non-numeric destination variable.
Steps To Reproduce{$mode ISO}
program isoModeReadingNumbers(input, output);
var
    i: integer;
begin
    readLn(i);
end.

Run the program (possibly forcing that no FD are opened): ./isoModeReadingNumbers <&- >&-

This will emit a “Invalid numeric format” RTE, which is “sort of” wrong.
TagsNo tags attached.
Fixed in Revision45635
FPCOldBugId
FPCTarget-
Attached Files

Activities

Florian

2020-06-06 14:39

administrator   ~0123265

Is it documented somewhere which RTE is expected?

Thaddy de Koning

2020-06-07 11:29

reporter   ~0123297

no. (I can't find it, that is) unopened files can't be read so is undefined by definition.

Kai Burghardt

2020-06-09 14:28

reporter   ~0123355

Well, touché, the standards merely define _an_ error has to occur. However, in ISO 7185 appendix the errors “[…] file is undefined immediately prior to any use of […] read” (D.15) and “[…] end-of-file is true immediately prior to any use of […] read.” (D.16) are listed as _two_ _separate_ errors http://pascal-central.com/iso7185.html#Annex%20D
This appendix is merely informative though.

Nevertheless, I think these error should rise first before a “Invalid numeric format” RTE is generated (D.54 [or D.56 for floats]).

Florian

2020-06-10 22:48

administrator   ~0123388

An RTE 6 is issued now.

Issue History

Date Modified Username Field Change
2020-05-30 14:33 Kai Burghardt New Issue
2020-06-06 14:39 Florian Note Added: 0123265
2020-06-07 11:29 Thaddy de Koning Note Added: 0123297
2020-06-09 14:28 Kai Burghardt Note Added: 0123355
2020-06-10 22:48 Florian Assigned To => Florian
2020-06-10 22:48 Florian Status new => resolved
2020-06-10 22:48 Florian Resolution open => fixed
2020-06-10 22:48 Florian Fixed in Version => 3.3.1
2020-06-10 22:48 Florian Fixed in Revision => 45635
2020-06-10 22:48 Florian FPCTarget => -
2020-06-10 22:48 Florian Note Added: 0123388