From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [testsuite patch] Fix false FAIL in stap-probe.exp
Date: Sun, 11 Sep 2016 17:56:00 -0000 [thread overview]
Message-ID: <20160911175615.GA3517@host1.jankratochvil.net> (raw)
In-Reply-To: <87inu2miwi.fsf@redhat.com>
On Sun, 11 Sep 2016 19:43:41 +0200, Sergio Durigan Junior wrote:
> Thanks for the patch. While it does fix the problem, I'd prefer a
> "compiler-agnostic" patch. The problem is that m1 and m2 (the two
> functions where probe 'two' is being defined) are exactly the same, so
> they get optimized by GCC's ICF pass. Since the contents of each
> function are irrelevant (as long as there's a probe 'two' inside them),
> I think declaring a dummy variable in one of the functions (probably
> volatile) would solve the issue. WDYT?
The problem is there are tons of optimizations the compiler can do. If you
change anything there the compiler can do partial inlining, tail calls etc.
An unused dummy variable gets optimized out and so the problem remains.
A dummy variable would need to have __attribute__((used)) but (1) for a reason
unknown to me it does not work anyway
gdb.base/stap-probe.c:56:2: warning: 'used' attribute ignored [-Wattributes]
and besides that (2) __attribute__ is also not much "compiler-agnostic" IMO.
My feeling from such cases is that if you try to outsmart the compiler the
next version of compiler will outsmart you some other way again.
Sure there are many ways to workaround it, I have proposed one of them.
If you want a different one you can either submit a different patch or to be
more specific how I should code the patch. But given you should test your
idea first I guess it is more straighforward to just submit some other your
patch if you do not like the patch of mine.
Jan
next prev parent reply other threads:[~2016-09-11 17:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-11 14:04 Jan Kratochvil
2016-09-11 17:43 ` Sergio Durigan Junior
2016-09-11 17:56 ` Jan Kratochvil [this message]
2016-09-11 20:57 ` Sergio Durigan Junior
2016-09-11 21:15 ` Jan Kratochvil
2016-09-12 4:22 ` Sergio Durigan Junior
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=20160911175615.GA3517@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=sergiodj@redhat.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