1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-23 09:10:43 +00:00
freebsd-ports/lang/gcc-ooo/files/patch-enumfix
David E. O'Brien 9b308410a8 Unbreak 'make patch'.
Approved by:	portmgr(kris)
2005-01-01 02:49:41 +00:00

21 lines
697 B
Plaintext

http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00968.html
http://blog.janik.cz/archives/2004-11-23T22_37_37.html
--- gcc/fold-const.c.orig Tue Jun 1 08:15:12 2004
+++ gcc/fold-const.c Wed Nov 24 16:39:02 2004
@@ -3535,7 +3535,13 @@
HOST_WIDE_INT hi;
int prec;
- prec = TYPE_PRECISION (etype);
+ /* For enums the comparison will be done in the underlying type,
+ so using enum's precision is wrong here.
+ Consider e.g. enum { A, B, C, D, E }, low == B and high == D. */
+ if (TREE_CODE (etype) == ENUMERAL_TYPE)
+ prec = GET_MODE_BITSIZE (TYPE_MODE (etype));
+ else
+ prec = TYPE_PRECISION (etype);
if (prec <= HOST_BITS_PER_WIDE_INT)
{
hi = 0;