[Bug c/125252] [15/16/17 regression] TBAA vs struct type in C23 (notmuch miscompiled)
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 3 21:53:26 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125252
--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Martin Uecker
<uecker@gcc.gnu.org>:
https://gcc.gnu.org/g:a882b00403b809d2d69c87bb471afe17beb0c3e4
commit r15-11251-ga882b00403b809d2d69c87bb471afe17beb0c3e4
Author: Martin Uecker <uecker@tugraz.at>
Date: Sun May 10 20:21:40 2026 +0200
c23: fix TBAA error for function returning structure [PR125252]
To fix PR122572 we globbed pointers to structure or union types nested
within other structure or union types to a void pointer when computing
the TYPE_CANONICAL. But when doing this for function return types this
then leads to wrong aliasing decisions, because for some reason function
derivation behaves differently than pointer and array derivation. Instead
of globbing to void, replace the nested structure or union type with an
incomplete type instead.
PR c/125252
gcc/c/ChangeLog:
* c-typeck.cc (ptr_to_tagged_member): Return type of member.
(c_type_canonical): Use incomplete type.
gcc/testsuite/ChangeLog:
* gcc.dg/pr125252.c
More information about the Gcc-bugs
mailing list