Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Luis Machado <lgustavo@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Prevent GCC from folding inline test functions
Date: Fri, 21 Aug 2015 16:03:00 -0000	[thread overview]
Message-ID: <55D74BCE.5020206@redhat.com> (raw)
In-Reply-To: <1440162341-26343-1-git-send-email-lgustavo@codesourcery.com>

On 08/21/2015 02:05 PM, Luis Machado wrote:

> The attached patch implements this by adding the new global variable z, set
> to 0, that gets added in different ways to marker and inlined_fn. Since it
> is 0, it doesn't affect any possible value checks that we may wish to do
> in the future (we currently only check for values changed by bar).
> 
> Ok?
> 

OK, though you should probably make z volatile as well.
Otherwise, soon enough, gcc with LTO sees that z is always 0:

> +int z = 0;

and then these compile down to the same again, and get folded:

> +  x += y - z;
> +  x += y + z;

Thanks,
Pedro Alves


  reply	other threads:[~2015-08-21 16:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 13:05 Luis Machado
2015-08-21 16:03 ` Pedro Alves [this message]
2015-08-24 15:49   ` Luis Machado
2015-08-24 15:54     ` Pedro Alves
2015-08-24 15:59       ` Luis Machado
2015-08-24 16:07         ` Pedro Alves
2015-08-24 16:11           ` Luis Machado

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=55D74BCE.5020206@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    /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