https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111500
Bug ID: 111500 Summary: [arm-none-eabi-gcc] / suboptimal optimization Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gnu.arne at wgboome dot org Target Milestone: --- Hi! For my STM32G030K6T I need thumb2 machine code. arm-none-eabi-gcc can convert my C code quite nicely. When I inspected the resulting disassembled machine code, I found some funny artifacts. Is it worth making&sending minimal source code and/or that corresponding "preprocessed file *.i*"? I mean: Is somebody able/willing to do something about it? Here are the 4 artifacts (when using "-O3 -g"): 1. a "subs r2, #1" instruction is followed by a "cmp r2, #0 / bne.n" instruction, although the "subs" already leaves the zero flag properly, doesn't it? 2. a "b.n" instruction jumps to a "bx lr" instruction, although both have the same length... i mean: instead of "b.n" it could have written "bx lr"... 3. a "uxth r2, r2" is followed by a "strh r2, [r3]", although "strh" doesn't look at the high half-word of r2, does it? 4. when i use single bits in a struct (e. g.: "struct A { int a:1; int b:7; }"), gcc reserves 16 bytes on the stack and sometimes writes into this area, without ever reading from there... when i do it myself with "struct A { int ab; }" and "if (S.ab&128)..." and "if (S.ab&127)..." then it doesnt touch the stack... Thx. Bye.