[LLVMbugs] [Bug 4095] New: transparent_union modeled wrong
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Tue Apr 28 11:22:29 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4095
Summary: transparent_union modeled wrong
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Semantic Analyzer
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: clattner at apple.com
CC: llvmbugs at cs.uiuc.edu
It looks like we handle transparent union arguments by claiming a function
takes a void*, which leads to sema problems. Here's a simple testcase:
struct d_object_s {
int x;
};
typedef union {
struct d_object_s *_do;
} d_object_t __attribute__((transparent_union));
void test(d_object_t _head) {
d_object_t x;
x;
struct d_object_s *head = _head._do;
}
---
We reject the "head =" line with:
t.c:13:35: error: member reference base type 'd_object_t' (aka 'void *const')
is not a structure or union
struct d_object_s *head = _head._do;
~~~~~ ^
Looking at the -ast-dump, it looks like dispatch_object_t is just a typedef for
void* in the AST (!):
void _dispatch_queue_push_list(dispatch_object_t _head)
(CompoundStmt 0x26037d0 <t.c:10:1, line:14:1>
(DeclStmt 0x26040e0 <line:11:3, col:22>
0x2604040 "dispatch_object_t x"
(DeclRefExpr 0x2604100 <line:12:3> 'dispatch_object_t':'void *' Var='x'
0x2604040)
(DeclStmt 0x2604190 <line:13:3, col:41>
0x2604120 "struct dispatch_object_s *head =
(ImplicitCastExpr 0x2604170 <col:36> 'struct dispatch_object_s *'
(DeclRefExpr 0x2604150 <col:36> 'dispatch_object_t':'void *'
ParmVar='_head' 0x2603fd0))")
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list