* [Committed] Fix PR middle-end/32920
@ 2007-07-28 18:35 Krister Walfridsson
0 siblings, 0 replies; only message in thread
From: Krister Walfridsson @ 2007-07-28 18:35 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 369 bytes --]
I have committed the following per request of Richard Guenther.
Bootstrapped and regtested on i386-unknown-netbsdelf3.1.
/Krister
2007-07-28 Richard Guenther <rguenther@suse.de>
PR middle-end/32920
* fold-const.c (fold_cond_expr_with_comparison): Convert
operand zero of MIN/MAX_EXPR to correct type.
* gcc.c-torture/compile/pr32920.c: New testcase.
[-- Attachment #2: Type: TEXT/PLAIN, Size: 2643 bytes --]
Index: fold-const.c
===================================================================
*** fold-const.c (revision 127015)
--- fold-const.c (working copy)
*************** fold_cond_expr_with_comparison (tree typ
*** 4958,4964 ****
build_int_cst (type, 1), 0),
OEP_ONLY_CONST))
return pedantic_non_lvalue (fold_build2 (MIN_EXPR,
! type, arg1, arg2));
break;
case LE_EXPR:
--- 4958,4966 ----
build_int_cst (type, 1), 0),
OEP_ONLY_CONST))
return pedantic_non_lvalue (fold_build2 (MIN_EXPR,
! type,
! fold_convert (type, arg1),
! arg2));
break;
case LE_EXPR:
*************** fold_cond_expr_with_comparison (tree typ
*** 4970,4976 ****
build_int_cst (type, 1), 0),
OEP_ONLY_CONST))
return pedantic_non_lvalue (fold_build2 (MIN_EXPR,
! type, arg1, arg2));
break;
case GT_EXPR:
--- 4972,4980 ----
build_int_cst (type, 1), 0),
OEP_ONLY_CONST))
return pedantic_non_lvalue (fold_build2 (MIN_EXPR,
! type,
! fold_convert (type, arg1),
! arg2));
break;
case GT_EXPR:
*************** fold_cond_expr_with_comparison (tree typ
*** 4982,4988 ****
build_int_cst (type, 1), 0),
OEP_ONLY_CONST))
return pedantic_non_lvalue (fold_build2 (MAX_EXPR,
! type, arg1, arg2));
break;
case GE_EXPR:
--- 4986,4994 ----
build_int_cst (type, 1), 0),
OEP_ONLY_CONST))
return pedantic_non_lvalue (fold_build2 (MAX_EXPR,
! type,
! fold_convert (type, arg1),
! arg2));
break;
case GE_EXPR:
*************** fold_cond_expr_with_comparison (tree typ
*** 4994,5000 ****
build_int_cst (type, 1), 0),
OEP_ONLY_CONST))
return pedantic_non_lvalue (fold_build2 (MAX_EXPR,
! type, arg1, arg2));
break;
case NE_EXPR:
break;
--- 5000,5008 ----
build_int_cst (type, 1), 0),
OEP_ONLY_CONST))
return pedantic_non_lvalue (fold_build2 (MAX_EXPR,
! type,
! fold_convert (type, arg1),
! arg2));
break;
case NE_EXPR:
break;
Index: testsuite/gcc.c-torture/compile/pr32920.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr32920.c (revision 0)
+++ testsuite/gcc.c-torture/compile/pr32920.c (revision 0)
@@ -0,0 +1,7 @@
+int a;
+void
+foo(void)
+{
+ char buf[10];
+ a = a < sizeof(buf) ? a : sizeof (buf);
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-07-28 16:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-28 18:35 [Committed] Fix PR middle-end/32920 Krister Walfridsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).