diff options
author | Marek Polacek <polacek@redhat.com> | 2023-10-19 16:32:10 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2023-10-20 15:39:54 -0400 |
commit | 4f93c6027fb09c94ca8dc7fe13f92a3b9205b68a (patch) | |
tree | 6d9476126751117c0339364fd1cc72cd623d3d11 /libstdc++-v3 | |
parent | 3ce4e99303d01d348229cca22bf8d3dd63004e01 (diff) |
c-family: char8_t and aliasing in C vs C++ [PR111884]
In the PR, Joseph says that in C char8_t is not a distinct type. So
we should behave as if it can alias anything, like ordinary char.
In C, unsigned_char_type_node == char8_type_node, so with this patch
we return 0 instead of -1. And the following comment says:
/* The C standard guarantees that any object may be accessed via an
lvalue that has narrow character type (except char8_t). */
if (t == char_type_node
|| t == signed_char_type_node
|| t == unsigned_char_type_node)
return 0;
Which appears to be wrong, so I'm adjusting that as well.
PR c/111884
gcc/c-family/ChangeLog:
* c-common.cc (c_common_get_alias_set): Return -1 for char8_t only
in C++.
gcc/testsuite/ChangeLog:
* c-c++-common/alias-1.c: New test.
(cherry picked from commit 281699fbff6262766674ab13087d37db751cd40a)
Diffstat (limited to 'libstdc++-v3')
0 files changed, 0 insertions, 0 deletions