public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PR tree-optimization/84225: do not pass non-integers to operation_no_trapping_overflow
@ 2018-02-06 15:43 Aldy Hernandez
  2018-02-06 15:52 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Aldy Hernandez @ 2018-02-06 15:43 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek

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

In this PR we are ICEing here:

bool
operation_no_trapping_overflow (tree type, enum tree_code code)
{
   gcc_checking_assert (ANY_INTEGRAL_TYPE_P (type));

...because we are being passed a pointer type from find_trapping_overflow.

Fixed by avoiding passing non-integrals from find_trapping_overflow.

Pre-approved by Jakub.  Committed.

Tested on x86-64 Linux.

[-- Attachment #2: curr.patch --]
[-- Type: text/x-patch, Size: 561 bytes --]

gcc/

	PR tree-optimization/84225
	* tree-eh.c (find_trapping_overflow): Only call
	operation_no_trapping_overflow when ANY_INTEGRAL_TYPE_P.

diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 75385f7b53f..9862ed9fdda 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2729,6 +2729,7 @@ static tree
 find_trapping_overflow (tree *tp, int *walk_subtrees, void *data)
 {
   if (EXPR_P (*tp)
+      && ANY_INTEGRAL_TYPE_P (TREE_TYPE (*tp))
       && !operation_no_trapping_overflow (TREE_TYPE (*tp), TREE_CODE (*tp)))
     return *tp;
   if (IS_TYPE_OR_DECL_P (*tp)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PR tree-optimization/84225: do not pass non-integers to operation_no_trapping_overflow
  2018-02-06 15:43 PR tree-optimization/84225: do not pass non-integers to operation_no_trapping_overflow Aldy Hernandez
@ 2018-02-06 15:52 ` Jakub Jelinek
  2018-02-06 17:10   ` Aldy Hernandez
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2018-02-06 15:52 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: gcc-patches

On Tue, Feb 06, 2018 at 10:43:21AM -0500, Aldy Hernandez wrote:
> In this PR we are ICEing here:
> 
> bool
> operation_no_trapping_overflow (tree type, enum tree_code code)
> {
>   gcc_checking_assert (ANY_INTEGRAL_TYPE_P (type));
> 
> ...because we are being passed a pointer type from find_trapping_overflow.
> 
> Fixed by avoiding passing non-integrals from find_trapping_overflow.
> 
> Pre-approved by Jakub.  Committed.
> 
> Tested on x86-64 Linux.

> gcc/
> 
> 	PR tree-optimization/84225
> 	* tree-eh.c (find_trapping_overflow): Only call
> 	operation_no_trapping_overflow when ANY_INTEGRAL_TYPE_P.

Can you please add a testcase too?
While the reported ICE was on an existing testcase, it was with
non-standard options on it.
So e.g.
gcc.dg/pr84225.c
that would contain:

/* PR tree-optimization/84225 */
/* { dg-do compile { target int32plus } } */
/* { dg-options "-Ofast -ftrapv" } */

#include "torture/pr69714.c"

or so should hopefully do the job, just test with cc1 before and after this
change to verify it ICEd and doesn't ICE anymore.

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PR tree-optimization/84225: do not pass non-integers to operation_no_trapping_overflow
  2018-02-06 15:52 ` Jakub Jelinek
@ 2018-02-06 17:10   ` Aldy Hernandez
  0 siblings, 0 replies; 3+ messages in thread
From: Aldy Hernandez @ 2018-02-06 17:10 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches



On 02/06/2018 10:52 AM, Jakub Jelinek wrote:
> On Tue, Feb 06, 2018 at 10:43:21AM -0500, Aldy Hernandez wrote:
>> In this PR we are ICEing here:
>>
>> bool
>> operation_no_trapping_overflow (tree type, enum tree_code code)
>> {
>>    gcc_checking_assert (ANY_INTEGRAL_TYPE_P (type));
>>
>> ...because we are being passed a pointer type from find_trapping_overflow.
>>
>> Fixed by avoiding passing non-integrals from find_trapping_overflow.
>>
>> Pre-approved by Jakub.  Committed.
>>
>> Tested on x86-64 Linux.
> 
>> gcc/
>>
>> 	PR tree-optimization/84225
>> 	* tree-eh.c (find_trapping_overflow): Only call
>> 	operation_no_trapping_overflow when ANY_INTEGRAL_TYPE_P.
> 
> Can you please add a testcase too?
> While the reported ICE was on an existing testcase, it was with
> non-standard options on it.
> So e.g.
> gcc.dg/pr84225.c
> that would contain:
> 
> /* PR tree-optimization/84225 */
> /* { dg-do compile { target int32plus } } */
> /* { dg-options "-Ofast -ftrapv" } */
> 
> #include "torture/pr69714.c"

Sorry for being sloppy on this.  I didn't even know we could #include 
other tests without the dg-do stuff being included and messing things up.

I have committed the code below, and have verified that it passes with 
the previous patch, and ICEs without the patch.

Thanks.

commit e783f8fb7d9a7b0972b4ebe4b86aa541904de692 (HEAD -> 
pr84225-jakub-trapv)
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Tue Feb 6 12:06:40 2018 -0500

     PR tree-optimization/84225
     Add test for previous commit for PR84225.

diff --git a/gcc/testsuite/gcc.dg/pr84225.c b/gcc/testsuite/gcc.dg/pr84225.c
new file mode 100644
index 00000000000..f57266c9a26
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84225.c
@@ -0,0 +1,5 @@
+/* PR tree-optimization/84225 */
+/* { dg-do compile { target int32plus } } */
+/* { dg-options "-Ofast -ftrapv" } */
+
+#include "torture/pr69714.c"

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-06 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 15:43 PR tree-optimization/84225: do not pass non-integers to operation_no_trapping_overflow Aldy Hernandez
2018-02-06 15:52 ` Jakub Jelinek
2018-02-06 17:10   ` Aldy Hernandez

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).