User account creation filtered due to spam.

Bug 48305 - [4.7 Regression] ice at -O0: verify_gimple failed
Summary: [4.7 Regression] ice at -O0: verify_gimple failed
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-27 20:45 UTC by John Regehr
Modified: 2011-03-30 12:39 UTC (History)
2 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: 2011-03-28 07:44:54


Attachments
gcc47-pr48305.patch (640 bytes, patch)
2011-03-28 10:55 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2011-03-27 20:45:13 UTC
regehr@home:~/volatile/bugs/tmp006$ current-gcc -O0 -c small.c
small.c: In function ‘func_18’:
small.c:36:15: error: type mismatch in comparison expression
unsigned int
int
unsigned int
D.1991 = D.1979 == D.1990;

small.c:36:15: internal compiler error: verify_gimple failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

regehr@home:~/volatile/bugs/tmp006$ current-gcc -v

Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/mnt/z/z/compiler-install/gcc-r171573-install/libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/mnt/z/z/compiler-install/gcc-r171573-install --program-prefix=r171573- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20110327 (experimental) (GCC) 

regehr@home:~/volatile/bugs/tmp006$ cat small.c


static signed char foo (signed char si1, unsigned char si2)
{
  return si2 || si1 && si2 ? : si1 + si2;
}

static unsigned char bar (unsigned ui1, unsigned char ui2)
{
  return ui1 + ui2;
}

static unsigned char baz (unsigned ui1, unsigned char ui2)
{
  return ui2 ? : ui1 + ui2;
}

struct S0
{
  unsigned char f0;
  const unsigned char f2;
  unsigned char f3;
};

struct S1
{
  const unsigned f7:54 > 1 * 8 ? : 0;
};

struct S1 g_99[9][1][5] = {
};

struct S0 g_244[10][3][1] = {
};

unsigned char func_127 (const unsigned char);

unsigned char func_18 (struct S0 p_19, unsigned char p_20)
{
  unsigned char l_605[4];
  p_20 |=
    baz (bar
	 ((func_127 (0) ^ p_19.f3 > l_605[2] >= 0) ==
	  (1U ^
	   foo (p_19.f0,
		l_605[1]) &
	   g_244[1][2][0].f2), g_244[1][2][0].f3), 1);
  return g_99[4][0][0].f7;
}
Comment 1 Jakub Jelinek 2011-03-28 07:44:54 UTC
Shorter testcase:
int
foo (int x, char y)
{
  return (x ^ 7U > y >= 0) == (1U ^ x);
}
Comment 2 Jakub Jelinek 2011-03-28 10:55:56 UTC
Created attachment 23790 [details]
gcc47-pr48305.patch

Untested fix.
Comment 3 Jakub Jelinek 2011-03-30 12:36:27 UTC
Author: jakub
Date: Wed Mar 30 12:36:18 2011
New Revision: 171723

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171723
Log:
	PR c/48305
	* fold-const.c (fold_binary_loc) <case EQ_EXPR, NE_EXPR>: Make sure
	arg10/arg11 in (X ^ Y) == (Z ^ W) are always fold converted to
	matching arg00/arg01 types.

	* gcc.c-torture/compile/pr48305.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr48305.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Jakub Jelinek 2011-03-30 12:39:46 UTC
Fixed, thanks for the report.