public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* C and C++ parser performing optimizations
@ 2020-08-02 18:15 Stefan Franke
  2020-08-02 18:40 ` Alexander Monakov
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Franke @ 2020-08-02 18:15 UTC (permalink / raw)
  To: gcc-help

Consider this simple example:

 

  const char * foo() {

    char const * const a = "test";

    char const * const b = a;

    return b;

  }

 

And compile it with

 

gcc -O1 -S test.c -fdump-tree-original

 

you get

 

;; Function foo (null)

;; enabled by -tree-original

 

 

{

  const char * const a = (const char * const) "test";

  const char * const b = (const char * const) "test";

 

    const char * const a = (const char * const) "test";

    const char * const b = (const char * const) "test";

  return (const char *) "test";

}

 

So the parser performs unwanted and uncontrollable optimizations, which I
consider bogus.

 

Any thoughts on this?

 

cheers

 

Stefan


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-24 19:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02 18:15 C and C++ parser performing optimizations Stefan Franke
2020-08-02 18:40 ` Alexander Monakov
2020-08-04  6:44   ` AW: " Stefan Franke
2020-08-04  7:13     ` Alexander Monakov
2020-08-04 15:33       ` Segher Boessenkool
2020-08-24 19:06     ` Gunther Nikl
2020-08-24 19:54       ` AW: " Stefan Franke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).