This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/71255] Implement #pragma may_alias
- From: "fw at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 27 May 2016 11:16:28 +0000
- Subject: [Bug c/71255] Implement #pragma may_alias
- Auto-submitted: auto-generated
- References: <bug-71255-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71255
--- Comment #16 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #15)
> Yeah, only the C++ side was changed. I think it's wrong that we reject the
> testcase in Comment 14 in C (I have a fix for that).
Good.
> But even with that fixed we still need the new #pragma because of the second
> testcase in Comment 13, right?
I'm surprised this is even valid C. The test case as-is does not seem relevant
to the glibc usage scenario because all completions would use the may_alias
attribute. Only some forward declarations would not. This could be a relevant
fringe case we need to support:
struct S s;
struct __attribute__((may_alias)) S { int i; };
Although it can only arise if there is a definition *before* including the
relevant header file.
I think the real question is whether it matters anywhere if a pointer to an
incomplete struct has the may_alias attribute or not.