Processor expert bug??

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

Processor expert bug??

1,914 次查看
claybarclay
Contributor II

Hello,

  I am using the PE FLASH_LDD for Kinetis in CW 10.5 and it throws a compiler warning when I turn on optimization. 

IntFlashLdd1.c:550:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Here is the function that gets this warning:

static void SafeRoutineCaller(void)

{

LDD_FLASH_TSafeRoutine SaveRoutineStackSpace; LDD_FLASH_TSafeRoutinePtr SafeRoutinePtr;  /* The safe routine must be aligned to 16bit word */

SafeRoutinePtr = (LDD_FLASH_TSafeRoutinePtr)(((uint32_t)&SaveRoutineStackSpace + 1U) & ~(uint32_t)1U); /* Copy the safe routine's code to a buffer on the stack */

*(LDD_FLASH_TSafeRoutine *)(void *)SafeRoutinePtr = *(LDD_FLASH_TSafeRoutine *)(void *)&SafeRoutine; /* {Default RTOS Adapter} Critical section begin, general PE function is used */

EnterCritical(); ((LDD_FLASH_TSafeRoutinePtr)((uint32_t)(SafeRoutinePtr) | 1U))(); /* Run the Safe routine */ /* {Default RTOS Adapter} Critical section end, general PE function is used */

ExitCritical();

}

 

 

 

 

I would assume since this is automatically generated that I found a PE bug.  Can anyone help me?

thanks

  clay

标签 (1)
0 项奖励
回复
1 回复

866 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

can you please upload your demo project and detail how to reproduce the problem with it? thanks!

0 项奖励
回复