Recent

Author Topic: FPC 3.2.0 Released !  (Read 35679 times)

Seenkao

  • Hero Member
  • *****
  • Posts: 546
    • New ZenGL.
Re: FPC 3.2.0 Released !
« Reply #75 on: November 28, 2020, 11:55:11 am »
Я извиняюсь, но ваш ответ больше похож на: " Нам наплевать на данную ошибку".

google translate:
I'm sorry, but your answer is more like: "We don't give a damn about this error."
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 370
Re: FPC 3.2.0 Released !
« Reply #76 on: November 28, 2020, 01:11:28 pm »
Hi,

When do you plan RC or final version for FPC 3.2.1?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: FPC 3.2.0 Released !
« Reply #77 on: November 28, 2020, 03:49:21 pm »
I'm sorry, but your answer is more like: "We don't give a damn about this error."

You did not show that is indeed an error. You only showed some screenshot with some code snippet with no explanation how Field and ACTIVE are declared only stating that enabling range checking leads to problems for you. So unless you provide a self contained, compilable example that shows that something fails then there is no error to give a damn about.

When do you plan RC or final version for FPC 3.2.1?

We are currently in the progress of merging fixes and improvements from trunk, so it will still take some time. Maybe before Christmas, but don't take that for granted.

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: FPC 3.2.0 Released !
« Reply #78 on: November 28, 2020, 03:58:36 pm »
If so, for what reason, the check is carried out during the execution of the program? Why does this check not occur at the link stage, when the program has not yet been compiled.
Range checks errors can't usually be checked during compilation/linking. Some will (i.e. accessing array[-1] of an array[0..100]) but with a variable there is no way to check during linking, only during execution of your program. That's why you should debug and test with range check on. After that, when you check your program is flawless ( ::) ) you can disable range check (and other debugging options) for your release to client.

Seenkao

  • Hero Member
  • *****
  • Posts: 546
    • New ZenGL.
Re: FPC 3.2.0 Released !
« Reply #79 on: November 28, 2020, 04:35:36 pm »
Range checks errors can't usually be checked during compilation/linking. Some will (i.e. accessing array[-1] of an array[0..100]) but with a variable there is no way to check during linking, only during execution of your program. That's why you should debug and test with range check on. After that, when you check your program is flawless ( ::) ) you can disable range check (and other debugging options) for your release to client.
Флаги нельзя проверять по переменным! А если это будет сделано, то компилятор как раз выдаст ошибку, если переменные будут разной размерности.
google translate:
Flags cannot be checked against variables! And if this is done, then the compiler will just give an error if the variables are of different dimensions.

PascalDragon,
Code: Pascal  [Select][+][-]
  1. ...
  2. const
  3.   EDIT_TRUE     = $FFFFFFFFF;         // <--- typo (I did it on purpose)
  4. ...
  5. var
  6.   EditMode : LongWord;                   //  Byte or Word - ignored if not more LongWord
  7. ...
  8. procedure ...
  9.     if not (EditMode and EDIT_TRUE) = 0 then
  10.     begin
  11.       EditMode := EditMode or EDIT_TRUE;                          // <-- work!!! always
  12.       EditMode := EditMode or $1 0000 0000;                      // <-- when debugging is enabled, the dimension
  13.                               // checking code is inserted next
  14.                               // and even if the program was working, it will not work when debugging
  15.                               // (overflow enabled)
  16.       newEdit[EditOne].Flags := newEdit[EditOne].Flags or ACTIVE;
  17.     end
  18.     else begin
  19.    ...
  20.  
OS - Linux
CPU - x86_64
I hope I have detailed enough?

P.S. in the structure the bytes will be checked for dimension.
« Last Edit: November 28, 2020, 05:05:10 pm by Seenkao »
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: FPC 3.2.0 Released !
« Reply #80 on: November 28, 2020, 05:31:00 pm »
I hope I have detailed enough?

I still had to guess quite a bit. A simple program I can stuff into the compiler is quite essential! Nevertheless I came up with the following:

Code: Pascal  [Select][+][-]
  1. program trangeerr;
  2.  
  3. {$mode delphi}
  4.  
  5. const
  6.   EDIT_TRUE     = $FFFFFFFFF;         // <--- typo (I did it on purpose)
  7.  
  8. var
  9.   EditMode : LongWord;                   //  Byte or Word - ignored if not more LongWord
  10.  
  11. const
  12.   ACTIVE = 2;
  13.  
  14. type
  15.   TEdit = record
  16.     Flags: LongWord;
  17.   end;
  18.  
  19. procedure Test;
  20. const
  21.   EditOne = 1;
  22. var
  23.   newEdit: array[0..1] of TEdit;
  24. begin
  25.   //if not (EditMode and EDIT_TRUE) = 0 then
  26.   begin
  27.     EditMode := EditMode or EDIT_TRUE;                          // <-- work!!! always
  28.     EditMode := EditMode or $100000000;                      // <-- when debugging is enabled, the dimension
  29.                             // checking code is inserted next
  30.                             // and even if the program was working, it will not work when debugging
  31.                             // (overflow enabled)
  32.     newEdit[EditOne].Flags := newEdit[EditOne].Flags or ACTIVE;
  33.   end;
  34. end;
  35.  
  36. begin
  37.   Test;
  38. end.

When compiled without -Cr no error will happen, but if compiled with -Cr there'll be a runtime error at line 27 as it should be.

It is right that the compiler currently does not complain at compile time, because it can't. Once the compiler does the EditMode or EDIT_TRUE operation (which will result in a value of native width, in the case of a 64-bit target indeed a 64-bit value) it no longer knows that a constant was involved and thus it can't generate an error at compile time when that value is assigned to EditMode. And EditMode or EDIT_TRUE is a valid expression even if EDIT_TRUE is larger than the size of EditMode.

Seenkao

  • Hero Member
  • *****
  • Posts: 546
    • New ZenGL.
Re: FPC 3.2.0 Released !
« Reply #81 on: November 28, 2020, 05:59:38 pm »
P.S. in the structure the bytes will be checked for dimension.
It is right that the compiler currently does not complain at compile time, because it can't. Once the compiler does the EditMode or EDIT_TRUE operation (which will result in a value of native width, in the case of a 64-bit target indeed a 64-bit value) it no longer knows that a constant was involved and thus it can't generate an error at compile time when that value is assigned to EditMode. And EditMode or EDIT_TRUE is a valid expression even if EDIT_TRUE is larger than the size of EditMode.

Понятно, байты проверяет и этого достаточно... Всего доброго!
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 370
Re: FPC 3.2.0 Released !
« Reply #82 on: November 29, 2020, 12:18:44 pm »

When do you plan RC or final version for FPC 3.2.1?

We are currently in the progress of merging fixes and improvements from trunk, so it will still take some time. Maybe before Christmas, but don't take that for granted.

Thanks! This release is very important, because it officially supports target aarch64-darwin

I'm having problem with using compiled FPC 3.2.1 fixes. So I hope that a package will correctly install FPC 3.2.1 on my Intel Mac.
« Last Edit: November 29, 2020, 12:20:19 pm by Igor Kokarev »

mrblack

  • Newbie
  • Posts: 1
Re: FPC 3.2.0 Released !
« Reply #83 on: December 05, 2020, 03:08:40 am »
Hello folks! I'd like to use free pascal with visual studio code, and i'm wondering, how to set ptop formatter with it? I can't find an executable. Thanks for the help. Pascal rules!

UPD
apt show fp-utils-3.0.4
« Last Edit: December 29, 2020, 04:02:44 am by mrblack »

 

TinyPortal © 2005-2018