> -----Ursprüngliche Nachricht----- > Von: Alexander Monakov <amonakov@xxxxxxxxx> > Gesendet: Sonntag, 2. August 2020 20:41 > An: Stefan Franke <stefan@xxxxxxxxx> > Cc: gcc-help@xxxxxxxxxxx > Betreff: Re: C and C++ parser performing optimizations > > On Sun, 2 Aug 2020, Stefan Franke wrote: > > > So the parser performs unwanted and uncontrollable optimizations, > > which I consider bogus. > > On occasion they are also incorrect. > > My (possibly wrong or incomplete) understanding is that GCC does not have > internal separation of mandatory simplifications that need to be done in the > frontend (like constant folding in the context of integer constant > expressions) vs. optional simplifications (optimizing substitutions). > So it just does both at the same time. > > Alexander Here is an example where gcc creates wrong code: test.c: int foo() { const char * const txt = "hello"; register const char * const p asm("ecx") = txt; register int dx asm("edx"); asm(" call _faa" :"=r" (dx) :"rf" (p)); } gcc -O1 -S test.c -fdump-tree-original The variable p gets replaced and the asm input parameters are wrong: __asm__(" call _faa":"=r" dx:"rf" (const char * const) "hello"); Uh - oh! Stefan