* * *

Author Topic: An optimisation level better =0 hangs computer.  (Read 1309 times)

serbod

  • Full Member
  • ***
  • Posts: 109
Re: An optimisation level better =0 hangs computer.
« Reply #15 on: August 21, 2017, 03:17:36 pm »
Also, similar problem appears when defining large array variables:
Code: Pascal  [Select]
  1. var LargeArray: array[0..99999999] of Integer;
  2.  

Maybe, need some warning in compiler?

Thaddy

  • Hero Member
  • *****
  • Posts: 4439
Re: An optimisation level better =0 hangs computer.
« Reply #16 on: August 21, 2017, 03:21:30 pm »
Please report your findings in the bugtracker. Also, if you can test if FPC trunk behaves similarly.
In trunk the internal implementation of case has been changed. trunk behaves ok. Tested windows and linux-arm r37005.
What I don't understand is that it worked w/o optimization: case had a shortint size limit -32768-+32767. It is now int32.
Rangechecks and overflowchecks would have caught that, without rangechecks it silently overflows and starts again indefiinitely..
See my previous answer. You will still have to manage your stacksize if this is inside a local routine...
« Last Edit: August 21, 2017, 04:00:29 pm by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Thaddy

  • Hero Member
  • *****
  • Posts: 4439
Re: An optimisation level better =0 hangs computer.
« Reply #17 on: August 21, 2017, 03:24:07 pm »
Also, similar problem appears when defining large array variables:
Code: Pascal  [Select]
  1. var LargeArray: array[0..99999999] of Integer;
  2.  

Maybe, need some warning in compiler?
That give a compiler warning.... Don't do that locally because it will blow up the stack, because inside a procedure,function it will be allocated on the stack. Declared globally there is no problem.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

han

  • New member
  • *
  • Posts: 15

Thaddy

  • Hero Member
  • *****
  • Posts: 4439
Re: An optimisation level better =0 hangs computer.
« Reply #19 on: August 21, 2017, 03:32:44 pm »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

han

  • New member
  • *
  • Posts: 15
Re: An optimisation level better =0 hangs computer.
« Reply #20 on: August 22, 2017, 08:23:32 am »
Done:
https://bugs.freepascal.org/view.php?id=32311
No, done, but you should have checked trunk first.

Sorry, but you have to help me here. What is the definition of a "trunk"? What should I have checked?  It happens in Linux, win32 en 64 bit compilers I'm using and have installed. That's reported. I have the impression the problem started in the same period when I introduced the case .. 99999999 code but I haven't tested that.

Later, okay the intension is test it against the, "Source Snapshot of Development Tree (trunk)". But using fixes v3.0.x or  v3.1.x.? Note I'm a user, not a FPC developer. I'm already glad when it is working with libraries and intend to update only every few months or so.

Han
 
« Last Edit: August 22, 2017, 08:59:20 am by han »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus