public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/51644] [4.7 Regression] va_list vs. warning: ‘noreturn’ function does return is not fixable
Date: Wed, 21 Dec 2011 09:53:00 -0000	[thread overview]
Message-ID: <bug-51644-4-1iFBYrdsu9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51644-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51644

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-21 09:51:45 UTC ---
Caused by r181172 aka TREE_CLOBBER_P.  The problem is that we have before
*.cfg:
  __builtin_va_start (&args, 0);
  b (s, &args);
  __builtin_va_end (&args);
  finally_tmp.0 = 1;
  <D.2917>:
  args = {CLOBBER};
  switch (finally_tmp.0) <default: <D.2921>, default: <D.2921>, case 1:
<D.2918>>
  <D.2918>:
  goto <D.2919>;
  <D.2919>:
  return;
  <D.2920>:
  finally_tmp.0 = 0;
  goto <D.2917>;
  <D.2921>:
  resx 1
and *.cfg pass obviously optimizes away anything after the noreturn call:
<bb 2>:
  __builtin_va_start (&args, 0);
  b (s, &args);
<L5>:
  return;
<L3>:
  finally_tmp.0 = 0;
  args = {CLOBBER};
  switch (finally_tmp.0) <default: <L4>, case 1: <L5>>
<L4>:
  resx 1
but the warn_function_return pass is immediately after that (and, this is -O0
anyway), so nothing optimizes the switch away into simple fall through into the
resx 1 block.  At -O and above we don't warn, because the *.eh pass before
*.cfg pass optimizes this.

So, IMHO to fix this, we need to do 2 things:
1) in decide_copy_try_finally reconsider
     if (!optimize)
    return ndests == 1;
   if finally contains only gimple_clobber_p stmts
2) estimate_num_insns should return 0 for gimple_clobber_p stmts


  parent reply	other threads:[~2011-12-21  9:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20 21:36 [Bug c/51644] New: " jan.kratochvil at redhat dot com
2011-12-21  9:18 ` [Bug c/51644] " burnus at gcc dot gnu.org
2011-12-21  9:52 ` [Bug middle-end/51644] " rguenth at gcc dot gnu.org
2011-12-21  9:53 ` jakub at gcc dot gnu.org [this message]
2011-12-21  9:54 ` jakub at gcc dot gnu.org
2011-12-21 11:41 ` jakub at gcc dot gnu.org
2011-12-21 15:00 ` jakub at gcc dot gnu.org
2011-12-21 15:33 ` jakub at gcc dot gnu.org
2011-12-21 15:33 ` jakub at gcc dot gnu.org

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=bug-51644-4-1iFBYrdsu9@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).