[cfe-dev] Problems in __builtin_offsetof locations

Abramo Bagnara abramobagnara at tin.it
Wed Nov 4 01:07:31 PST 2009


The attached C source show two different problems:

$ llvm_new/Debug/bin/clang-cc -W -Wall bug_clang2.c
bug_clang2.c:11:7: error: too many arguments to function call
  fun(333);
  ~~~ ^~~
bug_clang2.c:12:7: error: too many arguments to function call
  fun(__builtin_offsetof(struct s, g));
  ~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bug_clang2.c:13:7: error: too many arguments to function call
  fun(__builtin_offsetof(struct s, f));
  ~~~ ^
3 diagnostics generated.


1) As seen in diagnostic for line 12, the end location of
__builtin_offsetof is not the right paren but the end of location of
subexpression (like in all other prefix unary operators). This is wrong
for __builtin_offsetof.

2) Worse in diagnostic for line 13, the end location of
__builtin_offsetof is invalid (here I don't fully understand how this
happens).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug_clang2.c
Type: text/x-c++
Size: 197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091104/f8f5c4eb/attachment.bin>


More information about the cfe-dev mailing list