View Issue Details

IDProjectCategoryView StatusLast Update
0034633FPCCompilerpublic2019-07-20 22:19
ReporternanobitAssigned To 
Status newResolutionopen 
Platformwin32OSWindowsOS Version10
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0034633: wrong enumsize if large maxvalue
Description{$mode objfpc} // implicit {$packenum 4}
type tenum = (b0, b1, b2, bMax := high(dword));
(sizeof(tenum) = 4) is ok
but error (too small) with smaller {$packenum}

{$mode delphi} // implicit {$packenum 1}
type tenum = (b0, b1, b2, bMax = high(word)+100);
(sizeof(tenum) = 4) is ok

type tenum = (b0, b1, b2, bMax = high(dword));
(sizeof(tenum) = 1) is error, should be 4
TagsNo tags attached.
Fixed in Revision
Attached Files


has duplicate 0035849 resolvedJonas Maebe huge enumeration type definitions (i. e. sizeOf > 4) silently fails 


Jonas Maebe

2018-12-02 12:39

manager   ~0112320

The issue is that this compiles without warnings/errors. Enums can only have values in the range low(longint)..high(longint), so the high(dword) gets converted to -1 (and -1..2 is in the shortint range, so it can indeed be represented by 1 byte).

Issue History

Date Modified Username Field Change
2018-12-02 09:27 nanobit New Issue
2018-12-02 12:39 Jonas Maebe Note Added: 0112320
2019-07-20 22:19 Jonas Maebe Relationship added has duplicate 0035849