Part Number: MSP430FR5969
Tool/software: TI C/C++ Compiler
I am calculating a crc over a memory range bounded by MPUSEGB1. After assigning the register value and shifting left by 4 bits, I got a compiler warning. After debugging I found that the bit shift is the root cause of the issue.
compiler warning:
warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] uint16_t * end_addr = (uint16_t *)(0x0f00 << 4);
code:
uint16_t * end_addr = (uint16_t *)(0x0f00 << 4); // causes warning uint16_t * end_addr = (uint16_t *)((uint16_t)(0x0f00 << 4)); // causes warning uint16_t * end_addr = (uint16_t *)((0x0f00 << 4) & 0xffff); // causes warning uint16_t * end_addr = (uint16_t *)(0xf000); // does not cause warning
The values compute correctly even with the warning so I know the operations work as intended, but for some reason they always draw a warning from the compiler unless I explicitly use "0xF000". What causes this behavior?