On Tue, 2025-03-11 at 18:43 +0100, Basile Starynkevitch wrote: > On Tue, 2025-03-11 at 18:18 +0100, Hans Åberg via Gcc-help wrote: > > > > For showing the effects of optimization, perhaps there should be a tool or > > compiler option that compiles source code directly into C++ code. > > That cannot exist, but you could use the GCC developer options, GCC (almost) does not directly optimize on the C++ code. The C++ code is first translated to some intermediate language, then the optimizer runs on the intermediate form. So the developer does not need to implement the same optimization again and again for all supported languages. Also some optimizations are not able to be represented in C++. I.e. even if the IL happens to satisfy the C++ grammar, it may still invoke undefined behavior if you really compile it as C++. Thus this is not possible for GCC (and all real compilers intended for compiling real software, instead of toys or educational tools) to do this. -- Xi Ruoyao <xry111@xxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University