GGC Sibling Calls Optimization

Programming, for all ages and all languages.
Post Reply
LIC
Member
Member
Posts: 44
Joined: Mon Jun 04, 2018 8:10 am
Libera.chat IRC: lic

GGC Sibling Calls Optimization

Post by LIC »

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
Octocontrabass
Member
Member
Posts: 5512
Joined: Mon Mar 25, 2013 7:01 pm

Re: GGC Sibling Calls Optimization

Post by Octocontrabass »

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.
LIC
Member
Member
Posts: 44
Joined: Mon Jun 04, 2018 8:10 am
Libera.chat IRC: lic

Re: GGC Sibling Calls Optimization

Post by LIC »

Ok thank you for your reply. But do you have any piece of advice to track bugs that are "optimization related" ?
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Re: GGC Sibling Calls Optimization

Post by davidv1992 »

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.
LIC
Member
Member
Posts: 44
Joined: Mon Jun 04, 2018 8:10 am
Libera.chat IRC: lic

Re: GGC Sibling Calls Optimization

Post by LIC »

Ok thanks a lot for your reply, I'll try Bochs!
Post Reply