0ffeb6ec02
don't undefine C99 math macros, if !_GLIBCPP_USE_C99, so that we can use these functions in C++. espie@ agrees
47 lines
1.7 KiB
Plaintext
47 lines
1.7 KiB
Plaintext
$OpenBSD: patch-gcc_fold-const_c,v 1.2 2008/07/25 20:50:26 martynas Exp $
|
|
--- gcc/fold-const.c.orig Sun Aug 8 21:55:28 2004
|
|
+++ gcc/fold-const.c Fri Jul 25 12:34:58 2008
|
|
@@ -1036,7 +1036,11 @@ int_const_binop (code, arg1, arg2, notrunc)
|
|
= (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type));
|
|
int overflow = 0;
|
|
int no_overflow = 0;
|
|
+ int sizeof_flag = 0;
|
|
|
|
+ if (SIZEOF_PTR_DERIVED (arg1) == 1 || SIZEOF_PTR_DERIVED (arg2) == 1)
|
|
+ sizeof_flag = 1;
|
|
+
|
|
int1l = TREE_INT_CST_LOW (arg1);
|
|
int1h = TREE_INT_CST_HIGH (arg1);
|
|
int2l = TREE_INT_CST_LOW (arg2);
|
|
@@ -1203,6 +1207,10 @@ int_const_binop (code, arg1, arg2, notrunc)
|
|
TREE_CONSTANT_OVERFLOW (t) = (TREE_OVERFLOW (t)
|
|
| TREE_CONSTANT_OVERFLOW (arg1)
|
|
| TREE_CONSTANT_OVERFLOW (arg2));
|
|
+
|
|
+ if (sizeof_flag == 1)
|
|
+ SIZEOF_PTR_DERIVED (t) = 1;
|
|
+
|
|
return t;
|
|
}
|
|
|
|
@@ -5039,6 +5047,9 @@ fold (expr)
|
|
| force_fit_type (t, overflow && !TREE_UNSIGNED (type)));
|
|
TREE_CONSTANT_OVERFLOW (t)
|
|
= TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg0);
|
|
+ /* If arg0 was calculated from sizeof(ptr), record this */
|
|
+ if (SIZEOF_PTR_DERIVED (arg0))
|
|
+ SIZEOF_PTR_DERIVED (t) = 1;
|
|
}
|
|
else if (TREE_CODE (arg0) == REAL_CST)
|
|
t = build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
|
|
@@ -5082,6 +5093,9 @@ fold (expr)
|
|
| force_fit_type (t, overflow));
|
|
TREE_CONSTANT_OVERFLOW (t)
|
|
= TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg0);
|
|
+ /* If arg0 was calculated from sizeof(ptr), record this */
|
|
+ if (SIZEOF_PTR_DERIVED (arg0))
|
|
+ SIZEOF_PTR_DERIVED (t) = 1;
|
|
}
|
|
}
|
|
else if (TREE_CODE (arg0) == REAL_CST)
|