From: George O. <G.O...@lb...> - 2011-08-18 17:17:16
|
Hi all While playing around with the Contiki OS, I came across something that left me scratching my head for a while... I stripped it down to something small that will still exhibit the same behaviour. I was about to file a bug report but thought I'd double check that it's not bad code for some reason that I've failed to spot The attached will compile just fine with: sdcc -c foo.c However, if we compile with --stack-auto, we get the following error: geo@lin-geo:~/workspace/test-proj$ sdcc --stack-auto -c foo.c foo.c:19: error 78: incompatible types from type 'unsigned-char generic* auto' to type 'struct ip6_addr generic* fixed' As anticipated, if we add __reentrant to foo's prototype and compile without --stack-auto we get the same error. --model-xyz does not make any difference that I've noticed (tried small, large, huge) However, if we make any of the following changes (demonstrated in the attached), --stack-auto works - If foo returns void * - If we cast its return value to (void *) - If it takes only a single argument - If it takes two arguments but neither of type struct xyz * I tried with the following versions: SDCC : mcs51 3.0.4 #6748 (Aug 17 2011) (Linux) SDCC : mcs51 3.0.4 #6726 (Aug 8 2011) (Mac OS X x86_64) SDCC : mcs51 3.0.1 #6188 (Feb 3 2011) (CYGWIN) (can you tell how often I use cygwin???): As ever, folks, thanks a lot for your time reading this and even more so for all the efforts maintaining SDCC geo |