From: Jakub Jelinek Date: Thu, 10 Nov 2011 15:40:34 +0000 (+0100) Subject: vec.h (VEC_BASE): If base is at offset 0 in the structure, use &(P)->base even if... X-Git-Tag: releases/gcc-4.7.0~2269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8bf99b4e84b9b0783aca23ecc85425cb3569f16;p=thirdparty%2Fgcc.git vec.h (VEC_BASE): If base is at offset 0 in the structure, use &(P)->base even if P is NULL. * vec.h (VEC_BASE): If base is at offset 0 in the structure, use &(P)->base even if P is NULL. From-SVN: r181258 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index faea63af24d5..86515365d217 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2011-11-10 Jakub Jelinek + * vec.h (VEC_BASE): If base is at offset 0 in the structure, + use &(P)->base even if P is NULL. + PR rtl-optimization/51023 * combine.c (simplify_comparison) : Don't use val_signbit_known_clear_p for signed comparison narrowing diff --git a/gcc/vec.h b/gcc/vec.h index 789e8e2d4df6..d47795879f18 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -549,7 +549,12 @@ typedef struct VEC(T,A) \ } VEC(T,A) /* Convert to base type. */ +#if GCC_VERSION >= 4000 +#define VEC_BASE(P) \ + ((offsetof (__typeof (*P), base) == 0 || (P)) ? &(P)->base : 0) +#else #define VEC_BASE(P) ((P) ? &(P)->base : 0) +#endif /* Vector of integer-like object. */ #define DEF_VEC_I(T) \