Bug 37662 - [4.4 Regression] ice: tree check: expected ssa_name, have integer_cst in get_value_range, at tree-vrp.c:612
Summary: [4.4 Regression] ice: tree check: expected ssa_name, have integer_cst in get_...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 4.4.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2008-09-27 18:34 UTC by John Regehr
Modified: 2008-09-30 19:06 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2008-09-30 12:29:56


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2008-09-27 18:34:55 UTC
regehr@john-home:~/volatile/tmp44$ current-gcc -Os small.c
small.c: In function ‘func_37’:
small.c:10: internal compiler error: tree check: expected ssa_name, have integer_cst in get_value_range, at tree-vrp.c:612
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

regehr@john-home:~/volatile/tmp44$ current-gcc -v

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion
Thread model: posix
gcc version 4.4.0 20080927 (experimental) (GCC) 

regehr@john-home:~/volatile/tmp44$ cat small.c

typedef int uint16_t;
typedef int uint32_t;
uint32_t
func_18 (uint16_t p_19)
{
  return 1;
}

uint32_t
func_37 (uint16_t p_38)
{
  func_39 (+mod_rhs (func_18 (1) >= 1 ^ (div_rhs (1) || 0) || 0)), 1;
}
Comment 1 John Regehr 2008-09-27 18:41:12 UTC
Seen using r140721.
Comment 2 Andrew Pinski 2008-09-28 18:37:03 UTC
Reduced testcase:
static int
func_18 (void)
{
  return 1;
}
int func_37 (int p_38)
{
   return (func_18 () >= 1 ^ (div_rhs (1) || 0) || 0);
}

--- CUT ---
Before VRP we have:
  D.1584_5 = 1 ^ D.1583_4;

which is wrong, it should have been
D.1583_4 ^ 1;

I don't know why ccp did not create 
D.1581_4 ^ 1 but it created 1 ^ D.1581_4;

Comment 3 Andrew Pinski 2008-09-28 18:43:49 UTC
4.3 also produced the bad IR but 4.3's VRP did not ICE.
Comment 4 Jakub Jelinek 2008-09-30 17:02:19 UTC
Subject: Bug 37662

Author: jakub
Date: Tue Sep 30 17:00:49 2008
New Revision: 140792

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140792
Log:
	PR tree-optimization/37662
	PR tree-optimization/37663
	* tree-vrp.c (simplify_truth_ops_using_ranges): Don't call
	get_value_range with non-SSA_NAME.  Don't assert operands have been
	folded, instead just bail out.

	* gcc.c-torture/compile/pr37662.c: New test.
	* gcc.dg/pr37663.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr37662.c
    trunk/gcc/testsuite/gcc.dg/pr37663.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c

Comment 5 Jakub Jelinek 2008-09-30 17:02:51 UTC
Fixed.
Comment 6 Paolo Bonzini 2008-09-30 19:06:03 UTC
Are you going to commit my tree-ssa-propagate.c patch separately, or should I wait for 4.5?
Comment 7 Paolo Bonzini 2008-10-01 12:23:42 UTC
Subject: Bug 37662

Author: bonzini
Date: Wed Oct  1 12:22:17 2008
New Revision: 140809

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140809
Log:
2008-09-30  Paolo Bonzini  <bonzini@gnu.org>

	PR tree-optimization/37662
	* tree-ssa-ccp.c (fold_gimple_assign): Invert the operands of a
	commutative binary operation if they are in the wrong order and
	fold_build2 produces non-GIMPLE.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa-ccp.c