public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Diego Novillo <dnovillo@google.com>
To: Delesley Hutchins <delesley@google.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, Ollie Wild <aaw@google.com>
Subject: Re: [PATCH] [Annotalysis] Fix ICE caused by ipa-sra optimization.
Date: Thu, 03 Nov 2011 16:27:00 -0000	[thread overview]
Message-ID: <CAD_=9DQ8LeOc8ZRc_wT1t5TM+-PozEq0-5f17koB-BAFZSvPcg@mail.gmail.com> (raw)
In-Reply-To: <CAF6KqwWaO1=1iBMe9KNjxejqGdMwkxpgtL-ekx8ULOoyn9ai6g@mail.gmail.com>

On Thu, Nov 3, 2011 at 12:09, Delesley Hutchins <delesley@google.com> wrote:
> Let's try this again; perhaps I should learn to use e-mail.  :-)

Well, all you really need is upload-gcc-patch.py from
http://gcc.gnu.org/wiki/rietveld.  We have an internal copy, I'll send
you the location.

> This patch fixes an ICE caused when the ipa-sra optimization deletes
> function arguments that are referenced from within a thread safety
> attribute.  It will attempt to detect this situation and recover
> gracefully.  Since a graceful recovery is not always possible, an
> optional warning (-Wwarn-thread-optimization) can be turned on to
> inform the user that certain attributes have been removed by
> optimization.
>
> Bootstrapped and passed gcc regression testsuite on
> x86_64-unknown-linux-gnu.  Okay for google/gcc-4_6?
>
>  -DeLesley
>
> Changelog.google-4_6:
> 2011-11-02  DeLesley Hutchins  <delesley@google.com>
>    * tree-threadsafe-analyze.c:
>      Ignores invalid attributes, issues a warning, recovers gracefully.
>   * common.opt:
>     Adds new thread safety warning.
>
> testsuite/Changelog.google-4_6:
> 2011-11-02  DeLesley Hutchins <delesley@google.com>
>    * g++.dg/thread-ann/thread_annot_lock-82.C:
>     Expanded regression test
>
> --
> DeLesley Hutchins | Software Engineer | delesley@google.com | 505-206-0315
>

+        {
+          /* Add the universal lock to the lockset to suppress subsequent
+             errors.  */
+          if (is_exclusive_lock)
+            pointer_set_insert(live_excl_locks, error_mark_node);
+          else
+            pointer_set_insert(live_shared_locks, error_mark_node);

Space before '('.


+          if (!lockable) {
+            if (warn_thread_optimization)
+              warning_at (*locus, OPT_Wthread_safety,
+                          G_("Unlock attribute has been removed by "
+                             "optimization."));

Brace on the line below.


+      /* If ipa-sra has killed arguments, then base_obj may be NULL.
+         Attempt to recover gracefully by leaving the lock in the lockset. */
+      if (!base_obj) {
+        if (warn_thread_optimization)
+          warning_at (*locus, OPT_Wthread_safety,
+                      G_("Unlock attribute has been removed by "
+                         "optimization."));

Likewise.  Diagnostics should not end in '.'.  Comments should end in
'.  */' (two spaces after '.').

I wonder... how about disabling IPA-SRA when annotalysis is enabled?
Though I think I like this approach better.  The comments state that
these warnings are due to IPA-SRA.  I think I would leave the asserts
in, and only try the recovery if IPA-SRA is enabled.

Also, why not turn OPT_Wthread_safety on by default?



Diego.

  reply	other threads:[~2011-11-03 16:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02 20:52 Delesley Hutchins
2011-11-03 15:59 ` Diego Novillo
2011-11-03 16:24 ` Delesley Hutchins
2011-11-03 16:27   ` Diego Novillo [this message]
2011-11-03 16:53     ` Delesley Hutchins
2011-11-03 18:13       ` Diego Novillo
2011-11-03 19:42         ` Delesley Hutchins
2011-11-03 20:00           ` Diego Novillo
2011-11-04 10:56   ` Martin Jambor
2011-11-04 15:26     ` Delesley Hutchins
2011-11-11 15:25       ` Martin Jambor

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='CAD_=9DQ8LeOc8ZRc_wT1t5TM+-PozEq0-5f17koB-BAFZSvPcg@mail.gmail.com' \
    --to=dnovillo@google.com \
    --cc=aaw@google.com \
    --cc=delesley@google.com \
    --cc=gcc-patches@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).