COMPILER BUG?? StarCore C++ Compiler v2.7 Engineering Build 17a Freescale Production

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

COMPILER BUG?? StarCore C++ Compiler v2.7 Engineering Build 17a Freescale Production

4,383 Views
imran
Contributor I
I'm using the following compiler version:
 
===============
StarCore C++ Compiler v2.7 Engineering Build 17a Freescale Production
Delivery scc-1-107, Compiled date Jul 21 2005 12:43:13
Copyright (c) 2005 by Freescale Semiconductor, Inc, All Rights Reserved
===============
 
 
I get this error message when I try and compile the code shown below:
 
===============
[ASM,2,5999,98,listing_4_5.sl]: ERROR --- Symbol re-defined: _L10
[ASM,2,5999,180,listing_4_5.sl]: ERROR --- Symbol re-defined: _L10
[SCC,2,1027,-1]:Non-zero return status from "C:\Program Files\Metrowerks\CodeWarrior\Starcore_Support\Compiler\bin\asmsc100.exe".
===============
 
 
I try and compile the following code (from Listing 4.5 in Metrowers CodeWarrior Help System):
 
===============
/************Listing 4.5************/
 
#include <stdio.h>
char sample[10] = {9,6,7,1,0,5,1,8,2,6};
int status;
 
asm char t7(int p)
{
asm_header
 .arg
   _p in $d7;
return in $d8;
 .reg $d7,$d8,$r1;
asm_body
 
   clr      d8               move.l   #_sample,r1       doen3 d7
   dosetup3 _L10
   loopstart3
_L10:
   move.b   (r1),d1
   add      d8,d1,d8
   inc      d1
   move.b   d1,(r1)+
   loopend3
asm_end
}
 
int main()
{
   int m = 8;
   int s,i;
 
   for(i=0;i < 10;i++) {
       sample[i] *= 2;
       printf("%d ",sample[i]);
   }
   printf("\n");
   s = (int)t7(m);
   printf("S= %d\n",s);
 
   for(i=0;i < 10;i++)
       printf("%d ",sample[i]);
   printf("\n");
   return 1;
}
/********************************/
===============
 
Please let me know if this is a known bug, or solution to work around this problem.
 
Thanks,
-imran
Labels (1)
Tags (1)
0 Kudos
Reply
2 Replies

1,347 Views
CrasyCat
Specialist III

Hello

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)
{
asm_header
 .arg
  _p in $d7;
return in $d8;
 .reg $d7,$d8,$r1;
asm_body
 
  clr      d8               move.l   #_sample,r1       doen3 d7
  dosetup3 %C_L10
  loopstart3
%C_L10:
  move.b   (r1),d1
  add      d8,d1,d8
  inc      d1
  move.b   d1,(r1)+
  loopend3
asm_end
}
 

I hope this helps.

CrasyCat

0 Kudos
Reply

1,347 Views
imran
Contributor I

Thanks, that resolved it.

 

-imran

0 Kudos
Reply