From: Jakub Jelinek Date: Thu, 3 Apr 2008 21:03:54 +0000 (+0200) Subject: re PR c/35738 (ICE with #pragma omp atomic and conversion from pointer to int) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=79addd1f3581896333c5437c10ae7a5202acc2ae;p=gcc.git re PR c/35738 (ICE with #pragma omp atomic and conversion from pointer to int) PR c/35738 * c-parser.c (c_parser_omp_atomic): Call default_function_array_conversion on the RHS. * gcc.dg/gomp/pr35738.c: New test. From-SVN: r133876 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29a3cce9711..a9aad3268d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2008-04-03 Jakub Jelinek + PR c/35738 + * c-parser.c (c_parser_omp_atomic): Call + default_function_array_conversion on the RHS. + PR middle-end/35818 * omp-low.c (scan_sharing_clauses) : Don't call is_variable_sized if decl has incomplete type. diff --git a/gcc/c-parser.c b/gcc/c-parser.c index d638a0b2537..09b635990ee 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -7381,6 +7381,7 @@ c_parser_omp_atomic (c_parser *parser) tree lhs, rhs; tree stmt; enum tree_code code; + struct c_expr rhs_expr; c_parser_skip_to_pragma_eol (parser); @@ -7443,7 +7444,9 @@ c_parser_omp_atomic (c_parser *parser) } c_parser_consume_token (parser); - rhs = c_parser_expression (parser).value; + rhs_expr = c_parser_expression (parser); + rhs_expr = default_function_array_conversion (rhs_expr); + rhs = rhs_expr.value; break; } stmt = c_finish_omp_atomic (code, lhs, rhs); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1bad997c7fa..c89aa300f22 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2008-04-03 Jakub Jelinek + PR c/35738 + * gcc.dg/gomp/pr35738.c: New test. + PR middle-end/35818 * gcc.dg/gomp/pr35818.c: New test. diff --git a/gcc/testsuite/gcc.dg/gomp/pr35738.c b/gcc/testsuite/gcc.dg/gomp/pr35738.c new file mode 100644 index 00000000000..0b3866eae3b --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr35738.c @@ -0,0 +1,18 @@ +/* PR c/35738 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void foo (void); + +void +bar (void *p) +{ + int i = 0; + char q[10]; +#pragma omp atomic + i += q; /* { dg-warning "makes integer from pointer without a cast" } */ +#pragma omp atomic + i += foo; /* { dg-warning "makes integer from pointer without a cast" } */ +#pragma omp atomic + i += p; /* { dg-warning "makes integer from pointer without a cast" } */ +}