Bug 37663 - [4.4 Regression] ice in simplify_truth_ops_using_ranges, at tree-vrp.c:6335
Summary: [4.4 Regression] ice in simplify_truth_ops_using_ranges, at tree-vrp.c:6335
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:43 UTC by John Regehr
Modified: 2008-10-28 20:09 UTC (History)
5 users (show)

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


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:43:31 UTC
Seen using r140721.

regehr@john-home:~/volatile/tmp45$ current-gcc -O3 small.c
small.c: In function ‘func_91’:
small.c:3: internal compiler error: in simplify_truth_ops_using_ranges, at tree-vrp.c:6335
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

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

int func_99 (signed char p_100);
int
func_91 (int p_93)
{
  func_99 (1 >= p_93);
}

int
func_99 (signed char p_100)
{
  int l_102 = 0x8F9F05BBL;
  int l_108;
  p_100 = p_100 + (p_100 != l_102 * l_102) & -1;
  if (p_100)
    {
      if (func_50 (1, 1, func_50 (func_28 (1), l_108, 1, 1), 1))
	{
	}
    }
}

regehr@john-home:~/volatile/tmp45$ 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)
Comment 1 Andrew Pinski 2008-09-28 18:23:24 UTC
Reduced testcase:
int
func_99 (int p_100)
{
  p_100 = 1 >= p_100;
  int l_102 = -1885403717;
  int l_108;
  p_100 = p_100 + (p_100 != l_102 * l_102);
  if (p_100)
   func_50 ();
}


--- CUT ---
I think this comes down to TREE_OVERFLOW being set.
Comment 2 Jakub Jelinek 2008-09-30 17:02:19 UTC
Subject: Bug 37663

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 3 Jakub Jelinek 2008-09-30 17:03:08 UTC
Fixed.
Comment 4 Eric Weddington 2008-10-28 19:56:24 UTC
Reopening bug.
New test case gcc.dg/pr37663.c fails for AVR with:
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr37663.c: In function 'foo':

/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr37663.c:11: warning: overflow in implicit constant conversion


Line 11:
  int y = -1885403717;

This test case assumes that an int is 32 bits. An int is 16 bits on AVR.
Comment 5 Jakub Jelinek 2008-10-28 20:07:34 UTC
Subject: Bug 37663

Author: jakub
Date: Tue Oct 28 20:06:08 2008
New Revision: 141414

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141414
Log:
	PR tree-optimization/37663
	* gcc.dg/pr37663.c: Require int32plus.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/pr37663.c

Comment 6 Jakub Jelinek 2008-10-28 20:09:38 UTC
Next time, please don't reopen the original PR.  Whether the test fails on avr or not doesn't have anything to do with the fact that the original bug has been fixed.  IMHO either open a new PR and link it to the original PR, or (preferrably) just submit a patch to gcc-patches to modify the testcase.