From: Marek Polacek Date: Fri, 19 Oct 2012 17:03:07 +0000 (+0000) Subject: re PR middle-end/54945 (Too strong non-aliasing analysis?) X-Git-Tag: releases/gcc-4.6.4~314 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29717ee27bed01ff9b30397972051b945cd49fa7;p=thirdparty%2Fgcc.git re PR middle-end/54945 (Too strong non-aliasing analysis?) PR54945 From-SVN: r192619 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e83d0f38f73..e4ec7ab5ef27 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2012-10-19 Marek Polacek + + Backported from mainline + 2012-10-19 Marek Polacek + + PR middle-end/54945 + * fold-const.c (fold_sign_changed_comparison): Punt if folding + pointer/non-pointer comparison. + 2012-10-19 Alan Modra * configure.ac (HAVE_LD_NO_DOT_SYMS): Set if using gold. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 4bf10de8af8d..5b4fc1fed45b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6771,12 +6771,14 @@ fold_sign_changed_comparison (location_t loc, enum tree_code code, tree type, && TREE_TYPE (TREE_OPERAND (arg1, 0)) == inner_type)) return NULL_TREE; - if ((TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type) - || POINTER_TYPE_P (inner_type) != POINTER_TYPE_P (outer_type)) + if (TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type) && code != NE_EXPR && code != EQ_EXPR) return NULL_TREE; + if (POINTER_TYPE_P (inner_type) != POINTER_TYPE_P (outer_type)) + return NULL_TREE; + if (TREE_CODE (arg1) == INTEGER_CST) arg1 = force_fit_type_double (inner_type, tree_to_double_int (arg1), 0, TREE_OVERFLOW (arg1));