Bug 37305 - [4.4 Regression] ice in set_value_range, at tree-vrp.c:397
Summary: [4.4 Regression] ice in set_value_range, at tree-vrp.c:397
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-31 21:18 UTC by John Regehr
Modified: 2008-09-01 13:40 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.2
Known to fail:
Last reconfirmed: 2008-09-01 09:50:29


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2008-08-31 21:18:57 UTC
Seen on Ubuntu Hardy.

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

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

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

typedef int int32_t;
typedef unsigned int uint32_t;
static inline int
safe_add_s_s (int si1, int si2)
{
  if ((si1 > 0) && (si2 > 0) && (si1 > (si2)) || (si1 < 0) && (si2 < 0)
      && (si1 < ((-2147483647 - 1) - si2)))
    return si1;
}

uint32_t g_8;
uint32_t
func_24 (int32_t p_25)
{
  uint32_t l_30 = -1L;
  if ((safe_mod_u_u (1, 1)) | (safe_add_s_s (g_8, l_30)))
    return 1;
}
Comment 1 Richard Biener 2008-09-01 09:50:05 UTC
Confirmed.
Comment 2 Richard Biener 2008-09-01 09:50:29 UTC
Mine.
Comment 3 Richard Biener 2008-09-01 11:02:16 UTC
Grrr, this crap "overflow infinity" hits again...  we try to set the value-range
to [-INF, -INF(OVF)].

Which is because the overflow flag is set on -2147483647 in the assert expression
ASSERT_EXPR <D.1628_23, D.1628_23 < -2147483647>.

Which is because propagating constants in

  l_30_1 = 4294967295;
  l_30.0_3 = (int) l_30_1;

causes l_30.0_3 to become -1(OVF).  Duh.
Comment 4 Richard Biener 2008-09-01 13:40:03 UTC
Fixed.
Comment 5 Richard Biener 2008-09-01 13:41:07 UTC
Subject: Bug 37305

Author: rguenth
Date: Mon Sep  1 13:39:42 2008
New Revision: 139864

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

	PR tree-optimization/37305
	* tree-ssa-ccp.c (ccp_fold): Do not set TREE_OVERFLOW on
	the result of constant conversions.
	(fold_gimple_assign): Likewise.

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

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr37305.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-ccp.c