I have following code but find that x and y are the same value on the debugger. viewing ARM assembly review that the memcpy use same string address. #define A "\xA0\x00\x01" #define B "\xA0\x00\x02" memcpy(x, A, sizeof(A)-1); memcpy(y, B, sizeof(B)-1); If I change #define A "\xA0\x01\x01" #define B "\xA0\x02\x02" it will be OK. Tam
"I am sure that it is a compiler problem because I have checked the asm listing that the compiler only generate one constant string." If these 'arrays of char' are treated as string literals then they are identical up to the nul terminator. So, I guess it may be reasonable for the compiler to disregard the third character and merge the literals. Or, it may be that the compiler is being a bit too clever for its own good in this case.
Yes, I think the compiler is here a little to clever. We will re-work the string merging in the CARM compiler, so that these strings are not identical anymore. Reinhard