2Fermer4
Lionel DebrouxLe 29/08/2009 à 21:24
I've seen that bug myself, and I fixed it in GCC4TI SVN more than one month ago (r1360), but thanks for the report nonetheless smile
All routines successfully went through Joey Adam's exhaustive test program, i.e. this particular problem is not triggered by the program, because the re-declared Sprite8/16/32 functions' prototypes are different in that testcase...

To fix it, download a recompiled tigcc.a from http://www.mirari.fr/sncx (yAronet's upload area) and replace the prototypes of Sprite*, in $TIGCC/include/c/sprites.h, by:
extern void Sprite8(short asm("d0"),short asm("d1"),short asm("d2"),const unsigned char* asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__;
extern void Sprite16(short asm("d0"),short asm("d1"),short asm("d2"),__cpushort asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__;
extern void Sprite32(short asm("d0"),short asm("d1"),short asm("d2"),__cpulong asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__;


Side notes:
* __attribute__((__regparm__(n))) (which __ATTR_LIB_C__ is) was (almost) banned from ExtGraph a while ago, so as to avoid this exact same problem. To play on the safe side, ASM routines need explicit register parameters.

* besides the Sprite8/16/32 fix, the recompiled tigcc.a contains 1) a code correctness fix + size optimization for bsearch() (which has been broken since before the creation of the TIGCC CVS repository in 2004, probably since the routine was integrated in TIGCC), 2) a significant size & speed optimization on qsort(), 3) further optimization of the ClipSprite8/16/32 routines (same prototype as Sprite8/16/32) that Joey Adams contributed to TIGCC years ago and 4) support for MIN_AMS 301 and 310.
New prototypes for bsearch() and qsort():
extern void *bsearch(const void* asm("a0"),const void* asm("a1"),short asm("d0"),short asm("d1"),compare_t asm("a2")) __ATTR_LIB_ASM__;
extern void qsort(void* asm("a0"),short asm("d0"),short asm("d1"),compare_t asm("a2"))__ATTR_LIB_ASM__;