public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/61060] [4.9/4.10 Regression] ICE: in int_mode_for_mode, at stor-layout.c:400 with -free-ter
Date: Tue, 06 May 2014 09:34:00 -0000	[thread overview]
Message-ID: <bug-61060-4-kzpz0Z7ZXW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61060-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Jan Hubicka <hubicka at ucw dot cz> ---
> I'd say the backend should better deal with this.  Or we have to
> double-check (or delay) the zero-length check until after
> 
>   len_rtx = expand_normal (len);
> 
> sth like

This looks good to me indeed. Thanks for explanation concerning TER.
> 
> Index: gcc/builtins.c
> ===================================================================
> --- gcc/builtins.c      (revision 209890)
> +++ gcc/builtins.c      (working copy)
> @@ -3685,20 +3685,20 @@ expand_builtin_memset_args (tree dest, t
>    if (expected_align < dest_align)
>      expected_align = dest_align;
> 
> +  /* Stabilize the arguments in case we fail.  */
> +  dest = builtin_save_expr (dest);
> +  val = builtin_save_expr (val);
> +  len = builtin_save_expr (len);
> +
> +  len_rtx = expand_normal (len);
>    /* If the LEN parameter is zero, return DEST.  */
> -  if (integer_zerop (len))
> +  if (len_rtx == const0_rtx)
>      {
>        /* Evaluate and ignore VAL in case it has side-effects.  */
>        expand_expr (val, const0_rtx, VOIDmode, EXPAND_NORMAL);
>        return expand_expr (dest, target, mode, EXPAND_NORMAL);
>      }
> 
> -  /* Stabilize the arguments in case we fail.  */
> -  dest = builtin_save_expr (dest);
> -  val = builtin_save_expr (val);
> -  len = builtin_save_expr (len);
> -
> -  len_rtx = expand_normal (len);
>    determine_block_size (len, len_rtx, &min_size, &max_size,
>                         &probable_max_size);
>    dest_mem = get_memory_rtx (dest, len);
> 
> 
> probably applies to almost all builtin expansions.
> 
> But I'd say the backend should be more fault-tolerant here.  It can't
> simply reserve len == 0 for itself.

OK, I think I can just add early return to the expander functions then (or an
assert - still it seems more like middle-end's bug as it only wastes time even
at -O0)

Honza


  parent reply	other threads:[~2014-05-06  9:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-04 19:48 [Bug rtl-optimization/61060] New: " zsojka at seznam dot cz
2014-05-05  9:14 ` [Bug target/61060] " rguenth at gcc dot gnu.org
2014-05-05 18:17 ` ubizjak at gmail dot com
2014-05-05 19:27 ` ubizjak at gmail dot com
2014-05-05 19:47 ` hubicka at ucw dot cz
2014-05-06  8:45 ` rguenth at gcc dot gnu.org
2014-05-06  9:34 ` hubicka at ucw dot cz [this message]
2014-05-12  9:08 ` jakub at gcc dot gnu.org
2014-05-13  8:29 ` jakub at gcc dot gnu.org
2014-05-13  8:32 ` jakub at gcc dot gnu.org
2014-05-13  9:19 ` 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-61060-4-kzpz0Z7ZXW@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).