* [PATCH] Fix ICE on #pragma omp atomic (PR c/35738)
@ 2008-04-03 21:37 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2008-04-03 21:37 UTC (permalink / raw)
To: gcc-patches
Hi!
c_parser_omp_atomic wasn't applying default_function_array_conversion,
which caused ICE in default_conversion and/or errors about invalid
use of vars with ARRAY_TYPE. Fixed thusly, regtested on x86_64-linux.
Committed trunk and will commit soon to 4.3 branch.
2008-04-03 Jakub Jelinek <jakub@redhat.com>
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.
--- gcc/c-parser.c.jj 2008-04-03 09:41:42.000000000 +0200
+++ gcc/c-parser.c 2008-04-03 21:15:45.000000000 +0200
@@ -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);
--- gcc/testsuite/gcc.dg/gomp/pr35738.c.jj 2008-04-03 21:22:07.000000000 +0200
+++ gcc/testsuite/gcc.dg/gomp/pr35738.c 2008-04-03 21:21:37.000000000 +0200
@@ -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" } */
+}
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-03 21:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-03 21:37 [PATCH] Fix ICE on #pragma omp atomic (PR c/35738) Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).