Well somewhere along the way I fixed it when I started making gjmp and 
gjmp_append return sane values.

Are there any docs out there that describe how to write a backend. The doc here 
Tiny C Compiler Reference Documentation 
(bellard.org)<https://bellard.org/tcc/tcc-doc.html#Code-generation> seems way 
way out of date

Any guidance, gotchas, tips are welcome

From: tinycc-devel-bounces+paulmoore100=hotmail....@nongnu.org 
<tinycc-devel-bounces+paulmoore100=hotmail....@nongnu.org> On Behalf Of Paul 
Moore
Sent: Tuesday, April 16, 2024 2:42 PM
To: tinycc-devel@nongnu.org
Subject: [Tinycc-devel] warning: function might return no value:

Right at the start of creating my own backend, just making it trace all calls 
to it and do the minimum to not have the compiler complain. Overcome a few 
issues but:

Compiling examples/fib.c I get

warning: function might return no value:

I simplified it a bit so I could follow the code path

int fib(n)
{
                if (n <= 2)
                                return 1;
                else
                                return 2;//return fib(n-1) + fib(n-2);
}

I obviously am not doing something I am supposed to do but cant see what.

Here all the calls to me

gfunc_prolog(000001FC69CF9B50)
gen_opi(158)
load(0, 306)
gen_opi(149)
gjmp_append(0, 0)
load(0, 48)
gjmp(0)
gjmp(0)
load(0, 48)
gjmp(8)
../examples/fib.c:10: warning: function might return no value: 'fib'
gfunc_epilog()
gfunc_prolog(000001FC69CF9A00)
load(0, 48)
store(0, 306)
gfunc_call(1)
gfunc_call(3)
load(0, 48)
gfunc_epilog()

Somewhere in those calls I was supposed to do something, but did not. I read 
through (and stepped through) the code in the i386gen and cannot see what I am 
missing
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to