-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issue
Description
The following code when compiled with clang-19 (-O2):
struct s
{
struct
{
int a;
int b;
} __seg_gs *c;
int d;
};
struct s n;
void __seg_gs *t2 (void)
{
return n.c;
}
errors out with:
_.c:34:10: error: returning 'struct (unnamed struct at segstr.c:22:3) *' from a function with result type '__attribute__((address_space(256))) void *' changes address space of pointer.
The error is wrong, as the c member should be put into __seg_gs named address space. Equivalent code with named struct:
struct _r
{
int a;
int b;
};
struct r
{
struct _r __seg_gs *c;
int d;
};
struct r m;
void __seg_gs *t1 (void)
{
return m.c;
}
compiles OK.
GCC-14.2.1 is able to compile both testcases to the expected (the same) code.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issue