summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-12 13:12:08 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-12 13:12:08 +0000
commit77617136472b9fb91976eab7167f550b94b8ea9b (patch)
tree50c5349162dd02d3c472fa9ef829d8c3ee475883
parent2a1d5c987aa4cf03e8ed0bb3747ddf605528c5b2 (diff)
downloadppe42-gcc-77617136472b9fb91976eab7167f550b94b8ea9b.tar.gz
ppe42-gcc-77617136472b9fb91976eab7167f550b94b8ea9b.zip
PR c/28280
* c-parser.c (c_parser_typeof_specifier): Don't use c_finish_expr_stmt, open code desired semantics instead. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115369 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/c-parser.c14
-rw-r--r--gcc/testsuite/gcc.dg/vla-9.c9
3 files changed, 26 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b2cca5c35b9..e5e82e6c36e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2006-07-12 Mike Stump <mrs@apple.com>
+ PR c/28280
+ * c-parser.c (c_parser_typeof_specifier): Don't use
+ c_finish_expr_stmt, open code desired semantics instead.
+
* protoize.c (edit_fn_definition): Add volatile to clean_text_p.
2006-07-10 Eric Christopher <echristo@apple.com>
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 32d2c5108bf..d59128480c8 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -2164,7 +2164,19 @@ c_parser_typeof_specifier (c_parser *parser)
is evaluated, this can be evaluated. For now, we avoid
evaluation when the context might. */
if (!skip_evaluation && was_vm)
- c_finish_expr_stmt (expr.value);
+ {
+ tree e = expr.value;
+
+ /* If the expression is not of a type to which we cannot assign a line
+ number, wrap the thing in a no-op NOP_EXPR. */
+ if (DECL_P (e) || CONSTANT_CLASS_P (e))
+ e = build1 (NOP_EXPR, void_type_node, e);
+
+ if (EXPR_P (e))
+ SET_EXPR_LOCATION (e, input_location);
+
+ add_stmt (e);
+ }
pop_maybe_used (was_vm);
}
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
diff --git a/gcc/testsuite/gcc.dg/vla-9.c b/gcc/testsuite/gcc.dg/vla-9.c
new file mode 100644
index 00000000000..0b623b39da7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vla-9.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic-errors -W -Wall" } */
+/* PR c/28280 */
+
+void f(__SIZE_TYPE__ d)
+{
+ typedef int t[d];
+ t *g = (__typeof (g)) d;
+}
OpenPOWER on IntegriCloud