openmp: Check for PARM_DECL before using C_ARRAY_PARAMETER or DECL_ARRAY_PARAMETER_P...
authorJakub Jelinek <jakub@redhat.com>
Tue, 1 Sep 2020 07:17:58 +0000 (09:17 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 1 Sep 2020 07:17:58 +0000 (09:17 +0200)
commita37b0cccf4965f13006d2928f57a71e46e341cf8
tree60b49c420646686d12fd06653a7cb84d40b87007
parentef688fdfc614492210ae1b526602b97601444b8f
openmp: Check for PARM_DECL before using C_ARRAY_PARAMETER or DECL_ARRAY_PARAMETER_P [PR96867]

The C++ macro performs a PARM_DECL_CHECK, so will ICE if not tested on a PARM_DECL,
C_ARRAY_PARAMETER doesn't, but probably should, otherwise it is testing e.g.
C_DECL_VARIABLE_SIZE on VAR_DECLs.

2020-09-01  Jakub Jelinek  <jakub@redhat.com>

PR c++/96867
* c-typeck.c (handle_omp_array_sections_1): Test C_ARRAY_PARAMETER
only on PARM_DECLs.

* semantics.c (handle_omp_array_sections_1): Test
DECL_ARRAY_PARAMETER_P only on PARM_DECLs.

* c-c++-common/gomp/pr96867.c: New test.
gcc/c/c-typeck.c
gcc/cp/semantics.c
gcc/testsuite/c-c++-common/gomp/pr96867.c [new file with mode: 0644]