Bug 41661 - [4.5 Regression] ICE due to IPCP trying to create/fold a REAL typed comparision
Summary: [4.5 Regression] ICE due to IPCP trying to create/fold a REAL typed comparision
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Martin Jambor
URL:
Keywords: ice-on-valid-code
: 41147 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-10-10 16:08 UTC by Andrew Pinski
Modified: 2009-10-14 04:57 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-10-10 19:46:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2009-10-10 16:08:22 UTC
gcc.dg/vmx/bug-2.c fails at -O3 with the following ICE:
/home/apinski/src/local/gcc/gcc/testsuite/gcc.dg/vmx/bug-2.c:24:1: internal compiler error: in build_int_cst_wide, at tree.c:1147

Which is caused by the fold_binary call here:
#10 0x109fe834 in ipcp_lattice_from_jfunc (info=0x1119b3b0, lat=0xff90c4ec, jfunc=0x1119bc98) at /home/apinski/src/local/gcc/gcc/ipa-cp.c:302
302             cst = fold_binary (jfunc->value.pass_through.operation,

(gdb) p debug_generic_expr (cst)
1.0e+0
$1 = void
(gdb) p debug_generic_expr (jfunc->value.pass_through.operand)
1.0e+0

I will see if I can get a non PowerPC specific testcase soon.
Comment 1 Andrew Pinski 2009-10-10 16:27:14 UTC
Here is a testcase that fails also on x86_64 (but it also fails most likely everywhere):
check (int result, const char *name)
{
  if (!result)
      printf ("fail %s\n", name);
}
#define vector __attribute__((vector_size(16) ))
static vector unsigned char value =
  { 0x7c, 0x12, 0x1, 0xd5,
    0x39, 0x66, 0xa8, 0x87 };
int g(int, vector unsigned char, vector unsigned char);
void initn_c (
 double p5 ,
       vector unsigned char p6)
{
  check(p5 == 1, "p5");
  check(g (2, (p6), (value)), "p6");
}
void test(int a)
{
  initn_c (1, value);
}
Comment 2 Martin Jambor 2009-10-10 19:46:12 UTC
Thanks, I'll have a look at it early next week.
Comment 3 Martin Jambor 2009-10-12 17:34:46 UTC
Proposed patch: http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00771.html
Comment 4 Martin Jambor 2009-10-13 11:31:23 UTC
Subject: Bug 41661

Author: jamborm
Date: Tue Oct 13 11:31:08 2009
New Revision: 152702

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152702
Log:
2009-10-13  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/41661
	* ipa-prop.c (compute_complex_pass_through): Allow only operations
	that are tcc_comparisons or do not change the type in any
	un-usleless way.
	* ipa-cp.c (ipcp_lattice_from_jfunc): Request boolean type when
	folding tcc_comparison operations.

	* testsuite/gcc.c-torture/compile/pr41661.c: New test.



Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr41661.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-cp.c
    trunk/gcc/ipa-prop.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Martin Jambor 2009-10-13 11:32:49 UTC
Fixed.
Comment 6 Andrew Pinski 2009-10-14 04:57:31 UTC
*** Bug 41147 has been marked as a duplicate of this bug. ***