Possible bug in the switch statement for Coldfire V1

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Possible bug in the switch statement for Coldfire V1

跳至解决方案
1,106 次查看
gustavod
Contributor III

Hi everyone,

 

We are facing a lot of problems with switch statement for coldfire V1 in the CodeWarrior 6.3 IDE.If we use a unsigned char (INT8U in our code) variable for "if" and "while" statements the compiler works well. However, for "switchs" the compiler makes the test with long (32 bits), not for unsigned char (8 bits). If there are some trash in the used register, the test fails.

 

I'm attaching  a sequence of images that show this behavior.

 

Is there any workaround for this compiler bug? This is very annoying, since a lot of code from other people (like FATFS) makes use of switch statements for unsigned char variables.

 

I'm also attaching the source code. The problem occurs in the SD_API.c file, in the function:

INT8U file_name_verify(INT8U *pname1,INT8U *pname2, INT8U *pfile, INT8U num)

 

The problem could be seen in the disassembly of this file.

 

Thanks in advance,

Regards,

Gustavo

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
869 次查看
kef
Specialist I

You should submit srvice request here

在原帖中查看解决方案

0 项奖励
回复
2 回复数
870 次查看
kef
Specialist I

You should submit srvice request here

0 项奖励
回复
869 次查看
gustavod
Contributor III

and the source code.

0 项奖励
回复