* [PATCH PR66449]Fix ICE by using POINTER_PLUS_EXPR for pointers.
@ 2015-06-18 10:14 Bin Cheng
2015-06-18 10:16 ` Bin Cheng
0 siblings, 1 reply; 3+ messages in thread
From: Bin Cheng @ 2015-06-18 10:14 UTC (permalink / raw)
To: gcc-patches
Hi,
This patch fixes ICE in PR66449 by using POINTER_PLUS_EXPR for pointers.
Bootstrap and test on x86_64. Is it OK trunk?
Thanks,
bin
2015-06-18 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/66449
* tree-ssa-loop-niter.c (loop_exits_before_overflow): Use
POINTER_PLUS_EXPR for pointers.
gcc/testsuite/ChangeLog
2015-06-18 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/66449
* gcc.dg/vect/pr66449.c: New.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH PR66449]Fix ICE by using POINTER_PLUS_EXPR for pointers.
2015-06-18 10:14 [PATCH PR66449]Fix ICE by using POINTER_PLUS_EXPR for pointers Bin Cheng
@ 2015-06-18 10:16 ` Bin Cheng
2015-06-18 11:11 ` Richard Biener
0 siblings, 1 reply; 3+ messages in thread
From: Bin Cheng @ 2015-06-18 10:16 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
And the patch...
Thanks,
bin
> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Bin Cheng
> Sent: Thursday, June 18, 2015 6:13 PM
> To: gcc-patches@gcc.gnu.org
> Subject: [PATCH PR66449]Fix ICE by using POINTER_PLUS_EXPR for pointers.
>
> Hi,
> This patch fixes ICE in PR66449 by using POINTER_PLUS_EXPR for pointers.
> Bootstrap and test on x86_64. Is it OK trunk?
>
> Thanks,
> bin
>
> 2015-06-18 Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/66449
> * tree-ssa-loop-niter.c (loop_exits_before_overflow): Use
> POINTER_PLUS_EXPR for pointers.
>
> gcc/testsuite/ChangeLog
> 2015-06-18 Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/66449
> * gcc.dg/vect/pr66449.c: New.
>
[-- Attachment #2: pr66449-20150618.txt --]
[-- Type: text/plain, Size: 1242 bytes --]
Index: gcc/testsuite/gcc.dg/tree-ssa/pr66449.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/pr66449.c (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/pr66449.c (revision 0)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+void *fn1(void *p1, void *p2, long p3)
+{
+ long a = (long)p1, b = (long)p2, c = p3;
+
+ while (c)
+ {
+ int d = ((int *)b)[0];
+
+ c--;
+ ((char *)a)[0] = d;
+ a++;
+ }
+ return 0;
+}
+
Index: gcc/tree-ssa-loop-niter.c
===================================================================
--- gcc/tree-ssa-loop-niter.c (revision 224020)
+++ gcc/tree-ssa-loop-niter.c (working copy)
@@ -3902,7 +3902,12 @@ loop_exits_before_overflow (tree base, tree step,
by proving the reverse conditions are false using loop's initial
condition. */
- stepped = fold_build2 (PLUS_EXPR, TREE_TYPE (base), base, step);
+ if (POINTER_TYPE_P (TREE_TYPE (base)))
+ code = POINTER_PLUS_EXPR;
+ else
+ code = PLUS_EXPR;
+
+ stepped = fold_build2 (code, TREE_TYPE (base), base, step);
if (operand_equal_p (stepped, civ->base, 0))
{
if (tree_int_cst_sign_bit (step))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH PR66449]Fix ICE by using POINTER_PLUS_EXPR for pointers.
2015-06-18 10:16 ` Bin Cheng
@ 2015-06-18 11:11 ` Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2015-06-18 11:11 UTC (permalink / raw)
To: Bin Cheng; +Cc: GCC Patches
On Thu, Jun 18, 2015 at 12:14 PM, Bin Cheng <bin.cheng@arm.com> wrote:
> And the patch...
>
> Thanks,
> bin
>
>> -----Original Message-----
>> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
>> owner@gcc.gnu.org] On Behalf Of Bin Cheng
>> Sent: Thursday, June 18, 2015 6:13 PM
>> To: gcc-patches@gcc.gnu.org
>> Subject: [PATCH PR66449]Fix ICE by using POINTER_PLUS_EXPR for pointers.
>>
>> Hi,
>> This patch fixes ICE in PR66449 by using POINTER_PLUS_EXPR for pointers.
>> Bootstrap and test on x86_64. Is it OK trunk?
Ok.
Thanks,
Richard.
>> Thanks,
>> bin
>>
>> 2015-06-18 Bin Cheng <bin.cheng@arm.com>
>>
>> PR tree-optimization/66449
>> * tree-ssa-loop-niter.c (loop_exits_before_overflow): Use
>> POINTER_PLUS_EXPR for pointers.
>>
>> gcc/testsuite/ChangeLog
>> 2015-06-18 Bin Cheng <bin.cheng@arm.com>
>>
>> PR tree-optimization/66449
>> * gcc.dg/vect/pr66449.c: New.
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-18 11:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 10:14 [PATCH PR66449]Fix ICE by using POINTER_PLUS_EXPR for pointers Bin Cheng
2015-06-18 10:16 ` Bin Cheng
2015-06-18 11:11 ` Richard Biener
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).