#1 2022-04-01 05:59:59

Leslie7
Member
Registered: 2015-06-25
Posts: 248

mORMoti18n - LANGUAGE_NONE

Hi,

I am trying to use mORMoti18n the first time.

Versions:
FPC/Lazarus fixes branch -up to date
mORMot 1.18  -up to date

mORMoti18n.pas(324,15) Error: range check error while evaluating constants (255 must be between 0 and 59)

const
  /// value stored into a TLanguages enumerate to mark no language selected yet
  LANGUAGE_NONE = TLanguages(255);

Offline

#2 2022-04-01 06:12:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,205
Website

Re: mORMoti18n - LANGUAGE_NONE

The unit is expected to compile with range-checking OFF.
It is ensured in Synopse.inc conditionals.

Offline

#3 2022-04-01 06:35:27

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: mORMoti18n - LANGUAGE_NONE

I have all units in the project with {$I Synopse.inc} 

Checked Synopse.inc, it is the same as in the repository

(********************** Shared Conditionals **********************)

{$ifdef PUREPASCAL}
  {$define NODELPHIASM}
  {$define FPC_OR_PUREPASCAL}
{$else}
{$endif PUREPASCAL}

{$H+} // we use long strings
{$R-} // disable Range checking in our code

There are no range checking defines in project options or in the source files.

Is there something else I can check?

Last edited by Leslie7 (2022-04-01 07:02:07)

Offline

#4 2022-04-01 08:04:36

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: mORMoti18n - LANGUAGE_NONE

I have tried it with a freshly created application in Lazarus and the problem is the same.
Is it possible that the compiler's behavior has changed?

Last edited by Leslie7 (2022-04-01 08:05:38)

Offline

#5 2022-04-01 08:34:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,205
Website

Re: mORMoti18n - LANGUAGE_NONE

Sounds like the FPC trunk did change its behavior about range and type checking: it is as if they added some new checks at runtime.
Do have anyone any information about that?

IMHO this is unacceptable because it would break a lot of existing code.
It also break what Delphi and FPC did for decades... weird...
I suspect they will go back and disable this "feature".
Don't use FPC trunk until it is stabilized.

Offline

#6 2022-04-01 08:40:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,205
Website

Re: mORMoti18n - LANGUAGE_NONE

It may be linked to https://wiki.freepascal.org/User_Change … elphi_mode

Which is wrong in its statement: Delphi has no trouble with LANGUAGE_NONE = TLanguages(255), from Delphi 1 to latest Delphi 11.1.

Where to report the problem?

Offline

#7 2022-04-01 08:50:17

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: mORMoti18n - LANGUAGE_NONE

This is most likely the cause.
I will do some digging.

AFAIK we are using the same "fixes" branch .
At which commit is yours?

Last edited by Leslie7 (2022-04-01 09:03:20)

Offline

#8 2022-04-01 09:31:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,205
Website

Re: mORMoti18n - LANGUAGE_NONE

I am using plain FPC 3.2.0 as in the mORMot documentation.

Offline

#9 2022-04-01 09:56:08

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 210

Re: mORMoti18n - LANGUAGE_NONE

ab wrote:

Where to report the problem?

fpc-devel mailing list is very active and probably will get noticed sooner then creating a git issue.
https://www.freepascal.org/maillist.html

Offline

#10 2022-04-01 11:45:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,205
Website

Re: mORMoti18n - LANGUAGE_NONE

Offline

#11 2022-04-03 16:14:31

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: mORMoti18n - LANGUAGE_NONE

https://gitlab.com/freepascal.org/fpc/s … 372da876e6
https://gitlab.com/freepascal.org/fpc/s … 372da876e6

This was amazingly fast fix during a weekend from the FPC devs! 
I have applied the changes to the fixes branch locally and the range checking errors are gone, but unfortunately there other compiler errors like this with ResStringRec.Identifier:

mORMoti18n.pas(901,19) Error: Illegal qualifier


function LoadResString(ResStringRec: PResStringRec): string;
var Buffer: array [0..4095] of Char; // char = use the generic string type
    i: integer;
begin
  if ResStringRec=nil then begin
    result := '';
    Exit;
  end;
  if ResStringRec.Identifier[<64*1024 then begin    

Offline

#12 2022-04-04 06:30:21

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,205
Website

Re: mORMoti18n - LANGUAGE_NONE

mORMoti18n is not FPC/LCL compatible, IIRC.

Offline

#13 2022-04-04 13:03:17

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: mORMoti18n - LANGUAGE_NONE

Ok, got it. The easily predictable question is: any plans? smile

Offline

#14 2022-04-04 20:41:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,205
Website

Re: mORMoti18n - LANGUAGE_NONE

In mormot 2, yes, soon.

Offline

#15 2022-04-05 14:29:05

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: mORMoti18n - LANGUAGE_NONE

Excellent, this is a really important part of the library. smile

Offline

Board footer

Powered by FluxBB