public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Andrew Pinski" <pinskia@gmail.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [Commited] Fix PR 32988 ICE in build2_stat with POINTER_PLUS_EXP
Date: Mon, 06 Aug 2007 03:21:00 -0000	[thread overview]
Message-ID: <de8d50360708052021vbca18e8ya89ccbe76d632d0e@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 750 bytes --]

Hi,
  The problem here is that sizetype is compatiable with an enum type
but build2_stat is overly rejecting types other than INTEGER_TYPEs.
Tthe normal CFG verifier did not check if the second operand was an
INTEGER_TYPE, just if it was compatiable to sizetype.  The check for
INTEGER_TYPE in build2_stat is too strict, it really should be
INTEGRAL_TYPE_P instead.  The reason behind the check in build2_stat
was because at one point, it would not check for compatibility with
sizetype.

Committed as obvious after a bootstrap/test on i386-apple-darwin8.10
with no regressions.

Thanks,
Andrew Pinski

ChangeLog:

* tree.c (build2_stat): Instead of checking for INTEGER_TYPE, check
for INTEGRAL_TYPE_P.

* gcc.c-torture/compile/pr32988.c: New test.

[-- Attachment #2: fixpr32988.diff.txt --]
[-- Type: text/plain, Size: 1339 bytes --]

Index: tree.c
===================================================================
--- tree.c	(revision 127226)
+++ tree.c	(working copy)
@@ -3077,7 +3077,7 @@ build2_stat (enum tree_code code, tree t
 
   if (code == POINTER_PLUS_EXPR && arg0 && arg1 && tt)
     gcc_assert (POINTER_TYPE_P (tt) && POINTER_TYPE_P (TREE_TYPE (arg0))
-		&& TREE_CODE (TREE_TYPE (arg1)) == INTEGER_TYPE
+		&& INTEGRAL_TYPE_P (TREE_TYPE (arg1))
 		&& useless_type_conversion_p (sizetype, TREE_TYPE (arg1)));
 
   t = make_node_stat (code PASS_MEM_STAT);
Index: testsuite/gcc.c-torture/compile/pr32988.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr32988.c	(revision 0)
+++ testsuite/gcc.c-torture/compile/pr32988.c	(revision 0)
@@ -0,0 +1,20 @@
+enum zone_type {
+  ZONE_DMA,
+  ZONE_NORMAL,
+  ZONE_MOVABLE,
+  MAX_NR_ZONES
+};
+static unsigned long arch_zone_lowest_possible_pfn[MAX_NR_ZONES];
+static unsigned long arch_zone_highest_possible_pfn[MAX_NR_ZONES];
+void free_area_init_nodes(unsigned long *max_zone_pfn)
+{
+  enum zone_type i;
+  for (i = 1; i < MAX_NR_ZONES; i++)
+  {
+    if (i == ZONE_MOVABLE)
+      continue;
+    unsigned long _x = max_zone_pfn[i];
+    unsigned long _y = arch_zone_lowest_possible_pfn[i];
+    arch_zone_highest_possible_pfn[i] = _x > _y ? _x : _y;
+  }
+}

                 reply	other threads:[~2007-08-06  3:21 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=de8d50360708052021vbca18e8ya89ccbe76d632d0e@mail.gmail.com \
    --to=pinskia@gmail.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).