<div dir="ltr"><div><br></div><div>No, this should have nothing to do with gcc regardless of optimisation and debug settings.</div><div>Optimisations should not stop properly constructed code from working. <br></div><div><br></div><div>I humbly submit that you are smashing the stack.<br></div><div>Stack smashing can potentially overwrite the return address causing the sort of behaviour you are reporting.</div><div><br></div><div>If you're still stuck later, then maybe post some code and I or others can perhaps help you out.</div><div><br></div><div>Regards</div><div><br></div><div>Charles</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 30, 2024 at 6:57 AM Mark Atherton <<a href="mailto:markaren1@xtra.co.nz">markaren1@xtra.co.nz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">All,<br>
<br>
Haven't recursed for a number of years, so need some help.<br>
<br>
I am building an RPN expression evaluator for the uCPU assembler; I <br>
can't see any other way to go other than to use recursion to do the <br>
nested processing that I wish.<br>
<br>
Currently using "gcc version 12.2.0 (MinGW-W64 x86_64-ucrt-posix-seh, <br>
built by Brecht Sanders)"<br>
<br>
The first call of the recursed function worked fine, but crashes upon exit.<br>
<br>
It could be that the compiler is not generating re-entrant code. The <br>
only switch I have used is -O0 to disable compiler optimization.<br>
<br>
Are there any other switches for GCC that I need to use/be aware of ?<br>
<br>
Thanks, Mark<br>
<br>
_______________________________________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
<a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.</blockquote></div>