From 20845d35828c2d166550453b14b6e52c5f3b2826 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sun, 19 Apr 2009 21:19:54 +0100 Subject: re PR c/19771 (VLA deallocation) PR c/19771 * c-semantics.c (pop_stmt_list): Propagate STATEMENT_LIST_HAS_LABEL to parent statement list. testsuite: * gcc.c-torture/execute/vla-dealloc-1.c: New test. From-SVN: r146358 --- gcc/ChangeLog | 6 ++++++ gcc/c-semantics.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ .../gcc.c-torture/execute/vla-dealloc-1.c | 22 ++++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/vla-dealloc-1.c (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a7dcc8e..01488bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-04-19 Joseph Myers + + PR c/19771 + * c-semantics.c (pop_stmt_list): Propagate + STATEMENT_LIST_HAS_LABEL to parent statement list. + 2009-04-19 Adam Nemet * config/mips/mips.h (mips_tune_attr): New macro. diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index 3c7b241..b6c3a27 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -70,6 +70,8 @@ pop_stmt_list (tree t) { chain = TREE_CHAIN (u); TREE_CHAIN (u) = NULL_TREE; + if (chain) + STATEMENT_LIST_HAS_LABEL (chain) |= STATEMENT_LIST_HAS_LABEL (u); if (t == u) break; u = chain; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd41b32..a3e266b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2009-04-19 Joseph Myers + PR c/19771 + * gcc.c-torture/execute/vla-dealloc-1.c: New test. + +2009-04-19 Joseph Myers + PR c/38243 * gcc.dg/c99-restrict-3.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/vla-dealloc-1.c b/gcc/testsuite/gcc.c-torture/execute/vla-dealloc-1.c new file mode 100644 index 0000000..f2291ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vla-dealloc-1.c @@ -0,0 +1,22 @@ +/* VLAs should be deallocated on a jump to before their definition, + including a jump to a label in an inner scope. PR 19771. */ + +void *volatile p; + +int +main (void) +{ + int n = 0; + if (0) + { + lab:; + } + int x[n % 1000 + 1]; + x[0] = 1; + x[n % 1000] = 2; + p = x; + n++; + if (n < 1000000) + goto lab; + return 0; +} -- cgit v1.1