Bug 37207 - [4.4 Regression] ice at tree-ssa-ifcombine.c:222 for -Os
Summary: [4.4 Regression] ice at tree-ssa-ifcombine.c:222 for -Os
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2008-08-23 03:33 UTC by John Regehr
Modified: 2008-09-02 15:16 UTC (History)
1 user (show)

See Also:
Host:
Target: i686-*-*, x86_64-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-08-28 15:18:07


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2008-08-23 03:33:05 UTC
Seen using r139506 on Ubuntu Hardy.

regehr@john-home:~/volatile/tmp12$ current-gcc -Os small.c
small.c: In function ‘func_18’:
small.c:18: internal compiler error: tree check: expected ssa_name, have integer_cst in recognize_single_bit_test, at tree-ssa-ifcombine.c:222
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

regehr@john-home:~/volatile/tmp12$ 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
Thread model: posix
gcc version 4.4.0 20080823 (experimental) (GCC) 

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

typedef short int int16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
static inline unsigned long int
mod_rhs (long int rhs)
{
  if (rhs == 0)
    return 1;
  return rhs;
}

int32_t g_711;
uint32_t g_768;
int32_t func_52 (uint32_t p_53, uint32_t p_54, int16_t p_55, int32_t p_56,
		 int32_t p_58);
int32_t
func_18 (uint32_t p_19, uint32_t p_20, uint32_t p_22, uint32_t p_23)
{
  uint32_t l_26;
  int32_t l_893;
  uint32_t l_889;
  int32_t l_895 = 1;
  for (0; 1; ++l_889)
    {
      func_98 ((((func_81 (1)
		  && (1 &
		      (func_52 (g_768, g_711, l_26, l_893, 1) %
		       mod_rhs (l_895)))))));
      l_895 = 0;
    }
}

int32_t
func_52 (uint32_t p_53, uint32_t p_54, int16_t p_55, int32_t p_56,
	 int32_t p_58)
{
}
Comment 1 Andrew Pinski 2008-08-24 22:40:19 UTC
Confirmed.  One issue is that VRP does not look again at some % statements when it knows it can be a constant so we produce:
  D.1962_10 = 0;
  D.1963_11 = (int) D.1962_10;

Here is a more reduced testcase:
func_18 ( int t )
{
  unsigned l_889;
  int l_895 = 1;
  for (0; 1; ++l_889)
    {
      int t1 = 0;
      if (func_81 (1))
        {
          int rhs = l_895;
	  if (rhs == 0)
	    rhs = 1;
          if (1 & (t % rhs))
	    t1 = 1;
        }
      func_98 (t1);
      l_895 = 0;
    }
}

Comment 2 Richard Biener 2008-08-28 15:18:07 UTC
Mine.
Comment 3 Richard Biener 2008-08-28 15:27:36 UTC
Subject: Bug 37207

Author: rguenth
Date: Thu Aug 28 15:26:13 2008
New Revision: 139714

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139714
Log:
2008-08-28  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/37207
	* tree-ssa-ifcombine.c (recognize_single_bit_test): Fix
	tuplification bug.

	* gcc.c-torture/compile/pr37207.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr37207.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-ifcombine.c

Comment 4 Richard Biener 2008-08-29 08:37:34 UTC
Subject: Bug 37207

Author: rguenth
Date: Fri Aug 29 08:36:10 2008
New Revision: 139754

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139754
Log:
2008-08-29  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/37207
	* tree-vrp.c (extract_range_from_binary_expr): Also try
	to constant fold if only one of the operands is a constant.

	* gcc.dg/tree-ssa/vrp46.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/vrp46.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c

Comment 5 Richard Biener 2008-09-02 15:16:51 UTC
Fixed.