View Issue Details

IDProjectCategoryView StatusLast Update
0037085FPCCompilerpublic2020-10-10 16:16
ReporterThaddy de Koning Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformallOSall 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0037085: In ISO mode, Dispose with multiple parameters is not yet implemented.
DescriptionAccording to ISO, if new() is used with parameters, dispose should also use parameters.
There is an example on the forum here:
https://forum.lazarus.freepascal.org/index.php/topic,49834.msg362392.html#msg362392

Why did this not show up before? Dunno.
TagsNo tags attached.
Fixed in Revision45519
FPCOldBugId
FPCTarget-
Attached Files

Relationships

related to 0037320 resolvedFlorian Fails on ISO 7185 dispose 

Activities

Thaddy de Koning

2020-05-16 12:26

reporter   ~0122850

Last edited: 2020-05-16 12:28

View 3 revisions

Mind, multiple parameters (array of const style) and New() and Dispose() should match when used?
It has implications for memory layout. Frankly, I did not know it existed and - apart from the forum example - never saw it used.
I think this is hard to fix, maybe just document it as incompatible for now.
(Scott, do you have more info?)

Marco van de Voort

2020-05-16 13:40

manager   ~0122853

It would also be interesting to hear if compilers really implement the partial allocation, or if it is an artefact.

Sven Barth

2020-05-17 16:04

manager   ~0122883

FPC at least does not implement partial allocation. The only thing it does if a variant selector is provided is to assign the provided value if it is a named variant selector.

So in the example provided on the forum there won't be any difference to not using a variant selector. In the following example however the field b will have the value True.

{$mode iso}

type
  v = ^x;
  x = record
    n: Integer;
    case b: Boolean OF
      True:  (x0: Real);
      False: (x1, x2: Integer)
  end;

var
  a: v;

begin
  New(a, True);
end.


That said FPC definitely needs to parse this variant Dispose as well.

Florian

2020-05-27 23:25

administrator   ~0123102

It is parsed and semantically checked. The generated code does not change though. If it is common, that an RTE is generated if the record contents and the constants do not match, I can implement this as well.

Wolfgang Helbig

2020-10-10 12:32

reporter   ~0126213

fpc fails to compile the latest version of the p5 compiler. Among other things, the p5 compiler makes heavy use of dispose with a variant of a record. Lucky me, I still have a version of the p5 compiler from 2010. FPC compiles both pcom and pint with minimal changes, namely assigning commandline parameters to external files and, of course, mode ISO switch!

Florian

2020-10-10 13:18

administrator   ~0126215

About which p5 are you talking and about which FPC version?

Issue History

Date Modified Username Field Change
2020-05-16 11:48 Thaddy de Koning New Issue
2020-05-16 12:26 Thaddy de Koning Note Added: 0122850
2020-05-16 12:27 Thaddy de Koning Note Edited: 0122850 View Revisions
2020-05-16 12:28 Thaddy de Koning Note Edited: 0122850 View Revisions
2020-05-16 13:40 Marco van de Voort Note Added: 0122853
2020-05-17 16:04 Sven Barth Note Added: 0122883
2020-05-27 23:25 Florian Assigned To => Florian
2020-05-27 23:25 Florian Status new => resolved
2020-05-27 23:25 Florian Resolution open => fixed
2020-05-27 23:25 Florian Fixed in Revision => 45519
2020-05-27 23:25 Florian FPCTarget => -
2020-05-27 23:25 Florian Note Added: 0123102
2020-05-27 23:26 Florian Fixed in Version => 3.3.1
2020-07-09 22:37 Marco van de Voort Relationship added related to 0037320
2020-10-10 12:32 Wolfgang Helbig Note Added: 0126213
2020-10-10 13:18 Florian Note Added: 0126215