public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] tree-optimization/94163 constrain alignment set by PRE
Date: Thu, 17 Sep 2020 16:51:03 +0000 (GMT)	[thread overview]
Message-ID: <20200917165103.9B650398C823@sourceware.org> (raw)

https://gcc.gnu.org/g:96757464c3d07e727767fe11d198c07151971135

commit 96757464c3d07e727767fe11d198c07151971135
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Mar 13 13:56:26 2020 +0100

    tree-optimization/94163 constrain alignment set by PRE
    
    This avoids HWI -> unsigned truncation to end up with zero alignment
    which set_ptr_info_alignment ICEs on.
    
    2020-03-13  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/94163
            * tree-ssa-pre.c (create_expression_by_pieces): Check
            whether alignment would be zero.

Diff:
---
 gcc/ChangeLog      | 6 ++++++
 gcc/tree-ssa-pre.c | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 45670c3e20d..2f80eff858a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-13  Richard Biener  <rguenther@suse.de>
+
+	PR tree-optimization/94163
+	* tree-ssa-pre.c (create_expression_by_pieces): Check
+	whether alignment would be zero.
+
 2019-03-13  Eric Botcazou  <ebotcazou@adacore.com>
 
 	PR rtl-optimization/94119
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 5f9dc50eef6..7f7e4173302 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2797,7 +2797,8 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
 	      unsigned HOST_WIDE_INT hmisalign
 		= args.length () == 3 ? tree_to_uhwi (args[2]) : 0;
 	      if ((halign & (halign - 1)) == 0
-		  && (hmisalign & ~(halign - 1)) == 0)
+		  && (hmisalign & ~(halign - 1)) == 0
+		  && (unsigned int)halign != 0)
 		set_ptr_info_alignment (get_ptr_info (forcedname),
 					halign, hmisalign);
 	    }


                 reply	other threads:[~2020-09-17 16:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200917165103.9B650398C823@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@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).