Refer to the attachment. That program was compiled with -O4 and _all_ individual optimizations (-OoXXX) enabled, yet FPC could not consolidate all the constants being added to Value into a single constant.
И на самом деле это правильное поведение компилятора! Он выполнил задание программиста, а программист задал несколько переменных. При изменении переменных в программе, она будет корректно выполняться.
Лично меня, устраивает подобное поведение компилятора!
А что меня не устраивает, это то, что когда всем переменным передаётся значение "A", то значение "A" не записывается в регистр и в последующем не передаётся другие переменные просто считывая данные из регистра, а постоянно обращается к памяти считывая значение "A", для того чтоб записать значение в новую переменную (это не постоянное поведение компилятора, но очень частое).
-----------------------------------
Google translate:
And in fact, this is the correct behavior of the compiler! It has completed the programmer's task, and the programmer has set several variables. When changing variables in the program, it will be executed correctly.
Personally, I am satisfied with this behavior of the compiler!
But what I am not satisfied with is that when all variables are passed the value "A", the value "A" is not written to the register and subsequently other variables are not passed simply by reading data from the register, but constantly accesses memory reading the value "A" in order to write the value to a new variable (this is not constant behavior of the compiler, but very common).
Do you have nothing better to do than manual optimization?
Поздравляю! Вы в очередной раз подтвердили что вы несёте чушь! )))
Google translate:
Congratulations! You have once again confirmed that you are talking nonsense! )))