diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/c-typeck.cc | 16 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/pr106981.c | 9 |
2 files changed, 19 insertions, 6 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 0e55fd1..5ad4947 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -15922,14 +15922,10 @@ c_tree_equal (tree t1, tree t2) if (!t1 || !t2) return false; - for (code1 = TREE_CODE (t1); - CONVERT_EXPR_CODE_P (code1) - || code1 == NON_LVALUE_EXPR; + for (code1 = TREE_CODE (t1); code1 == NON_LVALUE_EXPR; code1 = TREE_CODE (t1)) t1 = TREE_OPERAND (t1, 0); - for (code2 = TREE_CODE (t2); - CONVERT_EXPR_CODE_P (code2) - || code2 == NON_LVALUE_EXPR; + for (code2 = TREE_CODE (t2); code2 == NON_LVALUE_EXPR; code2 = TREE_CODE (t2)) t2 = TREE_OPERAND (t2, 0); @@ -15940,6 +15936,9 @@ c_tree_equal (tree t1, tree t2) if (code1 != code2) return false; + if (CONSTANT_CLASS_P (t1) && !comptypes (TREE_TYPE (t1), TREE_TYPE (t2))) + return false; + switch (code1) { case INTEGER_CST: @@ -16059,6 +16058,11 @@ c_tree_equal (tree t1, tree t2) return true; } + CASE_CONVERT: + if (!comptypes (TREE_TYPE (t1), TREE_TYPE (t2))) + return false; + break; + default: break; } diff --git a/gcc/testsuite/c-c++-common/gomp/pr106981.c b/gcc/testsuite/c-c++-common/gomp/pr106981.c new file mode 100644 index 0000000..a21d3c2 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr106981.c @@ -0,0 +1,9 @@ +/* PR c/106981 */ +/* { dg-do compile } */ + +void +foo (int a, double *b, double *c, double *d, long long e) +{ +#pragma omp atomic capture + c[a] = d[((int) (e / 10 + 1))] = b[a] + d[((int) e / 10 + 1)]; /* { dg-error "invalid form" } */ +} |