cancel
Showing results for 
Search instead for 
Did you mean: 

I want to see the effect of -fgcse flag in STM32 gcc.? Is there any way I can check? I tried generating assembly code for a simple code with and without -fgcse flag with O0 optimization and both files look the same! Is the flag supported?

gits007
Associate

I am using GNU tools for STM32 (10.3-2021.10).

STM32CubeIDE

Version: 1.9.0

Build: 12015_20220302_0855 (UTC)

2 REPLIES 2
Danish1
Lead II

For those (like me) who didn’t know,

-fgcse Performs a global common subexpression elimination pass. This pass also performs global constant and copy propagation.

So your simple code must have global common subexpressions (whatever they are) for the optimizer to eliminate any duplication.

That said, gcc says the last option in the command-line overrides any previous options. Have you checked the command-line that invoked gcc to see if ogcse came before or after o0?

Semer CHERNI
ST Employee

Hello @gits007​ 

Could you please confirm if the issue is resolved or you are in need of further support.

Kind regards,

Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.