Bug 30124 - gcc/vec.h line 538 references "vec" which is undefined (should be vec_)
Summary: gcc/vec.h line 538 references "vec" which is undefined (should be vec_)
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-08 21:30 UTC by Daniel Kilsdonk
Modified: 2006-12-13 07:12 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Kilsdonk 2006-12-08 21:30:04 UTC
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
Comment 1 Andrew Pinski 2006-12-08 21:33:27 UTC
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).
Comment 2 Daniel Kilsdonk 2006-12-12 13:52:28 UTC
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
Comment 3 Andrew Pinski 2006-12-13 07:12:42 UTC
(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));