public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Stefan Franke" <stefan@franke.ms>
To: <gcc-help@gcc.gnu.org>
Subject: C and C++ parser performing optimizations
Date: Sun, 2 Aug 2020 20:15:35 +0200	[thread overview]
Message-ID: <00cd01d668f8$eb26b950$c1742bf0$@franke.ms> (raw)

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


             reply	other threads:[~2020-08-02 18:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 18:15 Stefan Franke [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00cd01d668f8$eb26b950$c1742bf0$@franke.ms' \
    --to=stefan@franke.ms \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).