Bug 28900 - [4.1 regression] ICE verify_stmts failed (invalid operand to unary operator)
Summary: [4.1 regression] ICE verify_stmts failed (invalid operand to unary operator)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.2.0
: P1 normal
Target Milestone: 4.1.2
Assignee: Richard Biener
URL:
Keywords: ice-checking, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-08-30 11:37 UTC by Martin Michlmayr
Modified: 2006-09-18 10:14 UTC (History)
8 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.3 4.2.0
Known to fail: 4.1.1
Last reconfirmed: 2006-09-03 11:32:35


Attachments
test case (256 bytes, text/plain)
2006-08-30 11:38 UTC, Martin Michlmayr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2006-08-30 11:37:40 UTC
ICE verify_stmts failed (invalid operand to unary operator) with -ftree-vectorize and -O:

(sid)105:tbm@usurper: ~] /usr/lib/gcc-snapshot/bin/gcc -ftree-vectorize -O1 -c linphone-synths.c
linphone-synths.c: In function 'synths_':
linphone-synths.c:9: error: invalid operand to unary operator
iftmp.0D.1919_15 <= 9.900000095367431640625e-1;


linphone-synths.c:9: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
(sid)106:tbm@usurper: ~] /usr/lib/gcc-snapshot/bin/gcc -ftree-vectorize -c linphone-synths.c
(sid)107:tbm@usurper: ~] /usr/lib/gcc-snapshot/bin/gcc -O3 -c linphone-synths.c
(sid)108:tbm@usurper: ~] gcc-4.1 -O3 -c linphone-synths.c
(sid)109:tbm@usurper: ~]
Comment 1 Martin Michlmayr 2006-08-30 11:38:32 UTC
Created attachment 12153 [details]
test case

Testcase from application "linphone".
Comment 2 Andrew Pinski 2006-08-30 12:37:11 UTC
I bet this is tree-ifcvt that is causing it and not really the vectorizer, I will check later today.
Comment 3 Andrew Pinski 2006-08-30 15:15:07 UTC
And I was correct.
4.1.2 has the bug too:
  _ifc_.33_28 = !(r__2_11 <= 9.900000095367431640625e-1) || _ifc_.30_3;
that is invalid gimple.
Comment 4 Andrew Pinski 2006-08-30 15:23:02 UTC
Confirmed, reduced testcase:
int synths_ ( float * rc)
{
  float r1, r2;
  int i;
  for (i = 0; i < 128; ++i)
    {
      r2 = rc[i];
      r1 = ((r2) <= (.99f) ? (r2) : (.99f));
      rc[i] = ((r1) >= (-.99f) ? (r1) : (-.99f));
    }
}
----
Janis,
  Could you run a regression hunt on this bug?
Thanks,
Andrew
Comment 5 Janis Johnson 2006-08-31 20:27:43 UTC
A regression hunt on powerpc-linux identified this patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=99691

    r99691 | kazu | 2005-05-14 00:46:12 +0000 (Sat, 14 May 2005)
Comment 6 Andrew Pinski 2006-08-31 20:28:58 UTC
(In reply to comment #5)
> A regression hunt on powerpc-linux identified this patch:

That means it is a latent bug :) oh well, nothing useful really.
Comment 7 Richard Biener 2006-09-03 11:32:35 UTC
I have a patch.  The vectorizer oughts to use more of the infrastructure we have.
Comment 8 Andrew Pinski 2006-09-03 14:24:30 UTC
(In reply to comment #7)
> I have a patch.  The vectorizer oughts to use more of the infrastructure we
> have.
This has nothing to do with the vectorizer really, yes tree-ifcvt is only enabled with -ftree-vectorize but it could be made even more generic.

Comment 9 patchapp@dberlin.org 2006-09-03 14:35:18 UTC
Subject: Bug number PR28900

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00068.html
Comment 10 Richard Biener 2006-09-05 08:39:51 UTC
Subject: Bug 28900

Author: rguenth
Date: Tue Sep  5 08:39:42 2006
New Revision: 116697

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116697
Log:
2006-09-05  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/28900
	* tree-if-conv.c (find_phi_replacement_condition): Gimplify
	compound conditional before creating COND_EXPR condition.

	* gcc.dg/torture/pr28900.c: New testcase

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr28900.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-if-conv.c

Comment 11 Richard Biener 2006-09-05 08:40:29 UTC
Fixed on the mainline.
Comment 12 Richard Biener 2006-09-18 10:13:53 UTC
Subject: Bug 28900

Author: rguenth
Date: Mon Sep 18 10:13:42 2006
New Revision: 117021

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117021
Log:
2006-09-18  Richard Guenther  <rguenther@suse.de>

        Backport from mainline:
	PR tree-optimization/28900
	* tree-if-conv.c (find_phi_replacement_condition): Gimplify
	compound conditional before creating COND_EXPR condition.

	* gcc.dg/torture/pr28900.c: New testcase

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/torture/pr28900.c
      - copied unchanged from r116697, trunk/gcc/testsuite/gcc.dg/torture/pr28900.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/tree-if-conv.c

Comment 13 Richard Biener 2006-09-18 10:14:34 UTC
Fixed.