Hi,
I am currently trying to make a small OS kernel, but there is something I don't understand: what does GCC actually do when the -foptimize-sibling-calls option is on?
Because when I turn this option on then the kernel runs into General Protection fault.
I looked at the generated assembler code and saw some differences but does someone know what are actually theses differences doing?
Regards
GGC Sibling Calls Optimization
-
- Member
- Posts: 5513
- Joined: Mon Mar 25, 2013 7:01 pm
Re: GGC Sibling Calls Optimization
It performs tail call elimination between two functions, as long as both functions have compatible signatures.
If optimizations are causing your code to crash, there's probably a bug in your code.
If optimizations are causing your code to crash, there's probably a bug in your code.
Re: GGC Sibling Calls Optimization
Ok thank you for your reply. But do you have any piece of advice to track bugs that are "optimization related" ?
-
- Member
- Posts: 223
- Joined: Thu Jul 05, 2007 8:58 am
Re: GGC Sibling Calls Optimization
Enable compiler warnings and fix them. This will not fix all such bugs, but will significantly reduce their number. Of the things that remain, my experience has been that they are typically related to some sort of data race between threads and/or missing indications of reordering restrictions and such on port access and memory mapped hardware accesses. Beyond that, bochs and its build in debugger can be really useful tools, as they allow you to observe code behaviour in fairly high detail without disturbing execution flow.
Re: GGC Sibling Calls Optimization
Ok thanks a lot for your reply, I'll try Bochs!