Re: Where to place warning about non-optimized tail and sibling calls

2023-08-02 Thread David Malcolm via Gcc
On Wed, 2023-08-02 at 13:16 -0400, Bradley Lucier wrote: > On 8/1/23 6:08 PM, David Malcolm wrote: > > FWIW I added it to support Scheme from libgccjit; > > Do you know of any Scheme using libgccjit? I don't. It's not Scheme, but in case it's relevant, Emacs is doing ahead-of- time compilation o

Re: Where to place warning about non-optimized tail and sibling calls

2023-08-02 Thread Bradley Lucier via Gcc
On 8/1/23 6:08 PM, David Malcolm wrote: FWIW I added it to support Scheme from libgccjit; Do you know of any Scheme using libgccjit? BTW, I tried to build mainline with --enable-coverage to see which code is executed with -foptimize-sibling-calls, but bootstrap fails with /home/lucier/progr

Re: Where to place warning about non-optimized tail and sibling calls

2023-08-01 Thread Bradley Lucier via Gcc
On 8/1/23 6:08 PM, David Malcolm wrote: Or from libgccjit. FWIW I added it to support Scheme from libgccjit; see this patch kit: https://gcc.gnu.org/ml/gcc-patches/2016-05/msg01287.html Perhaps there's a case for a frontend attribute for this. Dave Thanks. I thought a front-end warning mi

Re: Where to place warning about non-optimized tail and sibling calls

2023-08-01 Thread David Malcolm via Gcc
On Tue, 2023-08-01 at 20:20 +0200, Jose E. Marchesi via Gcc wrote: > > > > The Gambit Scheme->C compiler has an option to generate more > > > efficient > > > code if it knows that all tail and sibling calls in the generated > > > C > > > code will be optimized.  If gcc does not, however, optimize

Re: Where to place warning about non-optimized tail and sibling calls

2023-08-01 Thread Bradley Lucier via Gcc
On 8/1/23 12:51 PM, Paul Koning wrote: How is it possible to write valid C that is correct only if some optimization is done? Perhaps "incorrect" was the wrong word. If sibling-call optimization is not done, then perhaps the program will blow out the stack, which would not happen if the opt

Re: Where to place warning about non-optimized tail and sibling calls

2023-08-01 Thread Jose E. Marchesi via Gcc
>> The Gambit Scheme->C compiler has an option to generate more efficient >> code if it knows that all tail and sibling calls in the generated C >> code will be optimized. If gcc does not, however, optimize a tail or >> sibling call, the generated C code may be incorrect (depending on >> circums

Re: Where to place warning about non-optimized tail and sibling calls

2023-08-01 Thread Jose E. Marchesi via Gcc
> The Gambit Scheme->C compiler has an option to generate more efficient > code if it knows that all tail and sibling calls in the generated C > code will be optimized. If gcc does not, however, optimize a tail or > sibling call, the generated C code may be incorrect (depending on > circumstance

Re: Where to place warning about non-optimized tail and sibling calls

2023-08-01 Thread Paul Koning via Gcc
I'm puzzled. The fundamental rule of optimization is that it doesn't change the (defined) semantics of the program. How is it possible to write valid C that is correct only if some optimization is done? In other words, if it matters whether an optimization is done or not, that suggests to me

Where to place warning about non-optimized tail and sibling calls

2023-08-01 Thread Bradley Lucier via Gcc
The Gambit Scheme->C compiler has an option to generate more efficient code if it knows that all tail and sibling calls in the generated C code will be optimized. If gcc does not, however, optimize a tail or sibling call, the generated C code may be incorrect (depending on circumstances). So