[FEATURE REQUEST] Implicit 'volatile' for globals
Original Reporter info from Mantis: kupferstecher
-
Reporter name:
Original Reporter info from Mantis: kupferstecher
- Reporter name:
Description:
Currently there seems to be no concept to define 'volatile' variables, i.e. that these variables are never optimised but loaded and stored to memory once for each occurance in the code. For target embedded this is an essential feature (Interrupts etc.). There is no neccessity to introduce a variable modifier, but the volatility may also be defined implicitly, e.g. for all global variables. While there are hints that this (implicit volatile for globals) is the common way in the pascal languages and the fpc compiler actually does less optimisation on globals, some easy tests showed that there are still optimisations performed and a 'non-optimistaion' seems not to be in the documentation.
So my suggestion (feature request) is
- to treat globals always as non-optimisable variables
OR
- to define a variable modifier 'volatile' that can be applied to any variable
Thread on the forum (2017):
http://forum.lazarus.freepascal.org/index.php?topic=38961
Mailinglist (2015):
http://lists.freepascal.org/pipermail/fpc-pascal/2015-December/046055.html
Mantis conversion info:
- Mantis ID: 32721
- Platform: embedded
- Monitored by: » @d.ioannidis (Dimitrios Chr. Ioannidis), » @ccrause (Christo Crause)