the code reads: static inline size_t VEC_OP (T,base,embedded_size) \ (int alloc_) \ { \ return offsetof (VEC(T,base),vec) + alloc_ * sizeof(T); \ } \ ^--- this makes it hardly compileable
offsetof (VEC(T,base),vec) I see this: typedef struct VEC(T,B) \ { \ unsigned num; \ unsigned alloc; \ T vec[1]; \ } VEC(T,B) There forgo this is invalid, we are looking for the offsetof of the vec element in VEC(T, base).
Subject: Re: gcc/vec.h line 538 references "vec" which is undefined (should be vec_) If its already spec'd - why are we "calculating" it? Did something change between when it was defined and vec.h 538? Since the offset is inherent - is it possible that this routine is never used (it is unnecessarily obfuscated in macro-ese). --- pinskia at gcc dot gnu dot org <gcc-bugzilla@gcc.gnu.org> wrote: > > > ------- Comment #1 from pinskia at gcc dot gnu dot > org 2006-12-08 21:33 ------- > offsetof (VEC(T,base),vec) > > I see this: > typedef struct VEC(T,B) > \ > { > \ > unsigned num; > \ > unsigned alloc; > \ > T vec[1]; > \ > } VEC(T,B) > > > There forgo this is invalid, we are looking for the > offsetof of the vec element > in VEC(T, base). > > > -- > > pinskia at gcc dot gnu dot org changed: > > What |Removed > |Added > ---------------------------------------------------------------------------- > Status|UNCONFIRMED > |RESOLVED > Resolution| > |INVALID > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30124 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. > ____________________________________________________________________________________ Cheap talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. http://voice.yahoo.com
(In reply to comment #2) > If its already spec'd - why are we "calculating" it? Because the layout of the struct dependens on the the target so you don't know the exact offset until compile time. What exact problem are you running into which modified you to file this bug? embedded_size is used in tree.c: tree.c: + VEC_embedded_size (tree, BINFO_N_BASE_BINFOS (node))); tree.c: + VEC_embedded_size (tree, base_binfos));