re PR rtl-optimization/43438 (possible wrong code bug)

2010-03-20  Richard Guenther  <rguenther@suse.de>

	PR rtl-optimization/43438
	* combine.c (make_extraction): Properly zero-/sign-extend an
	extraction of the low part of a CONST_INT.  Also handle
	CONST_DOUBLE.

	* gcc.c-torture/execute/pr43438.c: New testcase.

From-SVN: r157592
This commit is contained in:
Richard Guenther 2010-03-20 13:44:18 +00:00 committed by Richard Biener
parent 39bac0102c
commit d491d2af31
4 changed files with 39 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2010-03-20 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/43438
* combine.c (make_extraction): Properly zero-/sign-extend an
extraction of the low part of a CONST_INT. Also handle
CONST_DOUBLE.
2010-03-19 Mike Stump <mikestump@comcast.net>
* config/i386/darwin.h (SUBTARGET32_DEFAULT_CPU): Add.

View File

@ -6793,8 +6793,10 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
if (mode == tmode)
return new_rtx;
if (CONST_INT_P (new_rtx))
return gen_int_mode (INTVAL (new_rtx), mode);
if (CONST_INT_P (new_rtx)
|| GET_CODE (new_rtx) == CONST_DOUBLE)
return simplify_unary_operation (unsignedp ? ZERO_EXTEND : SIGN_EXTEND,
mode, new_rtx, tmode);
/* If we know that no extraneous bits are set, and that the high
bit is not set, convert the extraction to the cheaper of

View File

@ -1,3 +1,8 @@
2010-03-20 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/43438
* gcc.c-torture/execute/pr43438.c: New testcase.
2010-03-20 Dodji Seketeli <dodji@redhat.com>
PR c++/43375

View File

@ -0,0 +1,23 @@
extern void abort (void);
static unsigned char g_2 = 1;
static int g_9;
static int *l_8 = &g_9;
static void func_12(int p_13)
{
int * l_17 = &g_9;
*l_17 &= 0 < p_13;
}
int main(void)
{
unsigned char l_11 = 254;
*l_8 |= g_2;
l_11 |= *l_8;
func_12(l_11);
if (g_9 != 1)
abort ();
return 0;
}