Patchwork [PR43513,3/3] Replace vla with array - Adapt mudflap testcase.

login
register
mail settings
Submitter Tom de Vries
Date July 27, 2011, 10:57 a.m.
Message ID <4E2FEF2A.7010200@codesourcery.com>
Download mbox | patch
Permalink /patch/107025/
State New
Headers show

Comments

Tom de Vries - July 27, 2011, 10:57 a.m.
On 07/27/2011 01:50 PM, Tom de Vries wrote:
> Hi Richard,
> 
> I have a patch set for bug 43513 - The stack pointer is adjusted twice.
> 
> 01_pr43513.3.patch
> 02_pr43513.3.test.patch
> 03_pr43513.3.mudflap.patch
> 
> The patch set has been bootstrapped and reg-tested on x86_64.
> 
> I will sent out the patches individually.
> 

The testcase
http://gcc.gnu.org/svn/gcc/trunk/libmudflap/testsuite/libmudflap.c/fail31-frag.c
contains a vla and a dead and illegal store to that vla.
Dead because the contents of the array is not read during it's lifetime, illegal
because it writes past the array end.

Normally, the store is not removed by pass_cd_dce because
is_hidden_global_store.  With the alloca folded into an array declaration, this
is no longer the case, the store is removed and mudflap no longer complains.

Adding the attribute ensures that the alloca is not folded.

OK for trunk?

Thanks,
- Tom

2011-07-27  Tom de Vries  <tom@codesourcery.com>

	PR middle-end/43513
	* testsuite/libmudflap.c/fail31-frag.c: Adapt testcase to prevent
	folding of alloca.

Patch

Index: libmudflap/testsuite/libmudflap.c/fail31-frag.c
===================================================================
--- libmudflap/testsuite/libmudflap.c/fail31-frag.c	(revision 176554)
+++ libmudflap/testsuite/libmudflap.c/fail31-frag.c	(working copy)
@@ -9,6 +9,7 @@  int main ()
   return 0;
 }
 int *p;
+__attribute__((noinline))
 int h (int i, int j)
 {
   int k[i];