Re: Guidance on Decompiling GCC 11.4.0 Optimized Code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux