]> gcc.gnu.org Git - gcc.git/commitdiff
vec.h (VEC_BASE): If base is at offset 0 in the structure, use &(P)->base even if...
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Nov 2011 15:40:34 +0000 (16:40 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 10 Nov 2011 15:40:34 +0000 (16:40 +0100)
* vec.h (VEC_BASE): If base is at offset 0 in the structure,
use &(P)->base even if P is NULL.

From-SVN: r181258

gcc/ChangeLog
gcc/vec.h

index faea63af24d56887866e1d8900cbfeccc411c1dc..86515365d217a1c65baeb16e1cb27836d3998c9a 100644 (file)
@@ -1,5 +1,8 @@
 2011-11-10  Jakub Jelinek  <jakub@redhat.com>
 
+       * 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) <case SIGN_EXTEND>: Don't use
        val_signbit_known_clear_p for signed comparison narrowing
index 789e8e2d4df6444cf89d2b3dbbbd276ce32f5dba..d47795879f1834f0e6c2eec97ce888ec08b0b999 100644 (file)
--- 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)                                                     \
This page took 0.104803 seconds and 5 git commands to generate.