Easy:
Form1, Mainpanel, subpanels.
Subpanel one contains an array of buttons.
Created at design time, or visible( the latter only on windows, a second panel will be below the ftrst one.
Created in a loop it behaves different. That's a bug. Align := caTop forgets to calculate its proper position relative to the other controls.
I mean that: it is a proper bug. On linux it is always the other way around creted at runtime. So at least there the bug is consistently different from design time.
I can confirm Delphi has exactly the same behavior at runtime, visible or not visible, and at runtime, visible or not visible.
And this is absolutely not implementation detail. Nor is it a feature nor has it much to do with speed.
It is also not a compiler induces optimization (loop reversal). Its a BUG. The LCL should respect intention in its implementation. IOW it should respect creation order as drawing order, it should respect toggling align:= false or true as well.The creatiopn order is readily available in the Children list. The paint order should rely on that
Here the intention is to keep the same order as expected when designing by hand.