First I would recommend you to install the official CodeWarrior for StarCore V2.7. This tool comes with Engineering build EB17B.
I assume you are building with optimization level 3. Am I right?
If this is the case, the compiler might inline the function t7 several times in the same function.
In order to tell the compiler to generate unique label within an inline function, please use the prefix %C in front of the label.
In your case rewrite the function t7 as follows:
static asm char t7(int p)
_p in $d7;
return in $d8;
clr d8 move.l #_sample,r1 doen3 d7
I hope this helps.