[Bug c/111884] unsigned char no longer aliases anything under -std=c2x

2023-10-19 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111884

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Marek Polacek  ---
Thanks, I can test

--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -3828,8 +3828,9 @@ c_common_get_alias_set (tree t)
   if (!TYPE_P (t))
 return -1;

-  /* Unlike char, char8_t doesn't alias. */
-  if (flag_char8_t && t == char8_type_node)
+  /* Unlike char, char8_t doesn't alias in C++.  (In C, char8_t is not
+ a distinct type.)  */
+  if (flag_char8_t && t == char8_type_node && c_dialect_cxx ())
 return -1;

   /* The C standard guarantees that any object may be accessed via an

[Bug c/111884] unsigned char no longer aliases anything under -std=c2x

2023-10-19 Thread joseph at codesourcery dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111884

--- Comment #2 from joseph at codesourcery dot com  ---
I'm going to guess this was introduced by the char8_t changes ("C: 
Implement C2X N2653 char8_t and UTF-8 string literal changes", commit 
703837b2cc8ac03c53ac7cc0fb1327055acaebd2).

  /* Unlike char, char8_t doesn't alias. */
  if (flag_char8_t && t == char8_type_node)
return -1;

is not correct for C, where char8_t is not a distinct type.

[Bug c/111884] unsigned char no longer aliases anything under -std=c2x

2023-10-19 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111884

Sam James  changed:

   What|Removed |Added

 CC||jsm28 at gcc dot gnu.org,
   ||sjames at gcc dot gnu.org

--- Comment #1 from Sam James  ---
Originally reported at
https://inbox.sourceware.org/gcc-help/e18818e9-396c-41fe-6c4a-9ac86c564...@ispras.ru/T/#m147d6322a26e2bc094dd5e0935b7f2223bc910ac.
Curious indeed..