diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-01-23 11:17:47 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-01-23 11:17:47 +0100 |
commit | b02c061bb84c0a2dbf3987e9ff77243d089cbd7a (patch) | |
tree | ae1f30fec66eb5b4b5532c9e0a0ea945bc92565b /gcc/omp-low.cc | |
parent | dd14b08e2caba952c0d8ff756a84e15d83aebeff (diff) | |
download | gcc-b02c061bb84c0a2dbf3987e9ff77243d089cbd7a.zip gcc-b02c061bb84c0a2dbf3987e9ff77243d089cbd7a.tar.gz gcc-b02c061bb84c0a2dbf3987e9ff77243d089cbd7a.tar.bz2 |
c++: Fix build_omp_array_section for type dependent array_expr [PR118590]
As can be seen on the testcase, when array_expr is type dependent, assuming
it has non-NULL TREE_TYPE is just wrong, it can often have NULL type, and even
if not, blindly assuming it is a pointer or array type is also wrong.
So, like in many other spots in the C++ FE, for type dependent expressions
we want to create something which will survive until instantiation and can be
redone at that point.
Unfortunately, build_omp_array_section is called before we actually do any
kind of checking what array_expr really is, and on invalid code it can be e.g.
a TYPE_DECL on which type_dependent_expression_p ICEs (as can be seen on the
pr67522.C testcase). So, I've hacked this by checking it is not TYPE_DECL,
I hope a TYPE_P can't make it through there when we just lookup an identifier.
Anyway, this patch is not enough, we can ICE e.g. on __uint128_t[0:something]
during instantiation, so I think something needs to be done for this in pt.cc
as well.
2025-01-23 Jakub Jelinek <jakub@redhat.com>
PR c++/118590
* typeck.cc (build_omp_array_section): If array_expr is type dependent
or a TYPE_DECL, build OMP_ARRAY_SECTION with NULL type.
* g++.dg/goacc/pr118590.C: New test.
Diffstat (limited to 'gcc/omp-low.cc')
0 files changed, 0 insertions, 0 deletions