cpu: cortexm_common: fix compile warning#5727
Conversation
|
@gebart Can you confirm that this cannot break stuff? |
cpu/cortexm_common/vectors_cortexm.c
Outdated
| uint32_t pc; | ||
| uint32_t* orig_sp; | ||
| uint32_t pc = 0; | ||
| uint32_t* orig_sp = 0x0; |
There was a problem hiding this comment.
Is NULL not cool for pointers anymore?
There was a problem hiding this comment.
78b772f to
e25f461
Compare
|
@LudwigKnuepfer Well, it took 5 seconds. ;) |
|
Does this change the resulting binary in any way on a recent (non broken) compiler? (my guess is: no) |
MD5 differs ( |
|
I looked over the disassembly, using gcc-5.4 this change introduced two new mov instructions to set some registers to zero for initializing the sp and pc variables. The total binary size was not affected though, probably because of alignment. |
|
So wontfix? |
|
I don't mind either way. The few single bytes of flash that this adds is insignificant on most cortex m mcu. What is your opinion, Ludwig? |
We could, though it's gonna look ugly, surround the affected line with push/disable warning/pop pragmas... |
|
I was thinking of a text comment meant for the user to see when they open
the source after getting a compile failure, not any pragmas or anything
like that.
|
Yeah, good idea. Let's do that. |
|
Which GCC are we talking about? Is a standard compiler from a stable release of a major distribution affected? |
|
@LudwigKnuepfer I encountered this with debian. (don't know wich gcc version, I'm not at home) |
|
@mali Are you referring to debian stable? old-stable? |
|
@LudwigKnuepfer root@paddy:~# apt-cache policy gcc-arm-none-eabi laurent@paddy:~$ arm-none-eabi-gcc -v |
|
OK, so both ubuntu lts and debian stable will keep this problem around until at least 2018. I'd tend to not force these users to pass compile flags manually. |
|
Regarding the comment of @gebart (#5727 (comment)) this PR adds 2 I would propose to keep the initialization and add a statement in the code why it has been introduced. |
|
I agree with your proposal 👍 On Oct 4, 2016 1:50 PM, "BytesGalore" [email protected] wrote:
|
|
@kaspar030: would you mind to add the comment as proposed by @BytesGalore? Then we can merge this finally... |
e25f461 to
3dfafde
Compare
|
|
ping |
Some gcc complain (wrongly) about possibly uninitialized variables.
Fixes #5726.