Hello.
For quite many functions/Procedures, I get two warnings: warning: frame size too large for reliable stack checking warning: try reducing the number of local variables
Say what? Reducing the number of local variables? Here's an example:
PROCEDURE TTextEditItem.HandleKey(VAR theEvent:EventRecord); VAR i : SInt16; pt : Point; theChr : Char; theKey : SInt16; shift : BOOLEAN; option : BOOLEAN; control : BOOLEAN; command : BOOLEAN; lineHeight, ascent : SInt16; theStyle : TextStyle;
I say that's a small amount of (small) local variables, so how can there be too many?
And what is a "frame" and how can I reduce its size? Or better: How do I allow for a larger frame size?
This is GNU Pascal 3.4.6u2 on Mac OS X and Xcode 2.5.
Regards
Lennart Thelander System Developer Lennart.Thelander@atex.com Phone +46 (0) 42 25 39 05 Fax +46 (0) 42 25 39 29 Atex Media AB Garnisonsgatan 10C S-254 66 Helsingborg SWEDEN
Bringing new life to your media business www.atex.com
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Lennart Thelander a écrit:
Hello.
For quite many functions/Procedures, I get two warnings: warning: frame size too large for reliable stack checking warning: try reducing the number of local variables
Say what? Reducing the number of local variables? Here's an example:
PROCEDURE TTextEditItem.HandleKey(VAR theEvent:EventRecord); VAR i : SInt16; pt : Point; theChr : Char; theKey : SInt16; shift : BOOLEAN; option : BOOLEAN; control : BOOLEAN; command : BOOLEAN; lineHeight, ascent : SInt16; theStyle : TextStyle;
I say that's a small amount of (small) local variables, so how can there be too many?
And what is a "frame" and how can I reduce its size? Or better: How do I allow for a larger frame size?
This is GNU Pascal 3.4.6u2 on Mac OS X and Xcode 2.5.
I had a similar message with stack checking on on a Fedora core 6 system with a 64 bits cpu. But I had indeed a large array as local variable, thus allocated on stack. So I supposed it was normal and simply turned off stack checking. May be there is a problem with 64 bits cpu's. What is yours ?
Maurice
Lennart Thelander wrote:
For quite many functions/Procedures, I get two warnings: warning: frame size too large for reliable stack checking warning: try reducing the number of local variables
Say what? Reducing the number of local variables? Here's an example:
PROCEDURE TTextEditItem.HandleKey(VAR theEvent:EventRecord); VAR i : SInt16; pt : Point; theChr : Char; theKey : SInt16; shift : BOOLEAN; option : BOOLEAN; control : BOOLEAN; command : BOOLEAN; lineHeight, ascent : SInt16; theStyle : TextStyle;
I say that's a small amount of (small) local variables, so how can there be too many?
The word "number" is a bit misleading, it's actually about the total size. Perhaps TextStyle is a larger structure here. It might also be an implicit temporary variable created by the compiler. E.g., some string and set operations need them.
And what is a "frame"
The space on the stack to contain the local variables, parameters etc. of a routine call.
and how can I reduce its size?
If it's an explicit variable, you could make it a pointer (though you might not want to for good reasons). For implicit variables, you cannot do this easily without rewriting the code.
Or better: How do I allow for a larger frame size?
AFAIK, on affected platforms (mainly Mac OS X), it cannot be changed. However, the warning only refers to the stack checking option, i.e., the code with the larger frame size will work fine by itself, just without stack checking.
See also: http://www.gnu-pascal.de/crystal/gpc/de/mail7971.html http://www.gnu-pascal.de/crystal/gpc/de/mail13595.html
Frank
Hello guys.
Thanks for answering.
On 09-02-18 17.04, "Maurice Lombardi" Maurice.Lombardi@ujf-grenoble.fr wrote:
I had a similar message with stack checking on on a Fedora core 6 system with a 64 bits cpu. But I had indeed a large array as local variable, thus allocated on stack. So I supposed it was normal and simply turned off stack checking. May be there is a problem with 64 bits cpu's. What is yours ?
Maurice
It's a 32-bit PowerPC G4.
On 09-02-18 18.31, "Frank Heckenbach" ih8mj@fjf.gnu.de wrote:
Lennart Thelander wrote:
For quite many functions/Procedures, I get two warnings: warning: frame size too large for reliable stack checking warning: try reducing the number of local variables
Say what? Reducing the number of local variables? Here's an example:
PROCEDURE TTextEditItem.HandleKey(VAR theEvent:EventRecord); VAR i : SInt16; pt : Point; theChr : Char; theKey : SInt16; shift : BOOLEAN; option : BOOLEAN; control : BOOLEAN; command : BOOLEAN; lineHeight, ascent : SInt16; theStyle : TextStyle;
I say that's a small amount of (small) local variables, so how can there be too many?
The word "number" is a bit misleading, it's actually about the total size. Perhaps TextStyle is a larger structure here. It might also be an implicit temporary variable created by the compiler. E.g., some string and set operations need them.
TextStyle is a 32-bit integer (UInt32 or SInt32).
OK, the procedure does indeed use hard coded strings. That might be the cause.
And what is a "frame"
The space on the stack to contain the local variables, parameters etc. of a routine call.
OK.
and how can I reduce its size?
If it's an explicit variable, you could make it a pointer (though you might not want to for good reasons). For implicit variables, you cannot do this easily without rewriting the code.
OK.
Or better: How do I allow for a larger frame size?
AFAIK, on affected platforms (mainly Mac OS X), it cannot be changed. However, the warning only refers to the stack checking option, i.e., the code with the larger frame size will work fine by itself, just without stack checking.
It's good to know that the code will work. :-)
See also: http://www.gnu-pascal.de/crystal/gpc/de/mail7971.html http://www.gnu-pascal.de/crystal/gpc/de/mail13595.html
Thanks for the links. I believe the option GPC_CHECK_STACK is set in the debug target and reset in the release target.
Frank
Regards
Lennart Thelander System Developer Lennart.Thelander@atex.com Phone +46 (0) 42 25 39 05 Fax +46 (0) 42 25 39 29 Atex Media AB Garnisonsgatan 10C S-254 66 Helsingborg SWEDEN
Bringing new life to your media business www.atex.com
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.