[llvm-commits] [llvm-gcc-4.2] r108206 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Eric Christopher
echristo at apple.com
Mon Jul 12 16:02:56 PDT 2010
Author: echristo
Date: Mon Jul 12 18:02:56 2010
New Revision: 108206
URL: http://llvm.org/viewvc/llvm-project?rev=108206&view=rev
Log:
Make sure that the requested alignment isn't greater than the stack alignment
for a vla - we won't adhere to it anyways so make it an error.
Fixes rdar://7506902
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=108206&r1=108205&r2=108206&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jul 12 18:02:56 2010
@@ -39,6 +39,7 @@
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/DenseMap.h"
@@ -1755,6 +1756,15 @@
if (isGimpleTemporary(decl))
return;
+ /* If this is a vla type and we requested an alignment greater than the stack
+ alignment, error out since we're not going to dynamically realign
+ variable length array allocations. We're placing this here instead of
+ later in case it's a relatively unused variable. */
+ if (TREE_CODE (type) == ARRAY_TYPE && C_TYPE_VARIABLE_SIZE (type) &&
+ DECL_ALIGN(decl)/8u > TheTarget->getFrameInfo()->getStackAlignment())
+ error ("alignment for %q+D is greater than the stack alignment, "
+ "we cannot guarantee the alignment.", decl);
+
// If this is just the rotten husk of a variable that the gimplifier
// eliminated all uses of, but is preserving for debug info, ignore it.
if (TREE_CODE(decl) == VAR_DECL && DECL_VALUE_EXPR(decl))
More information about the llvm-commits
mailing list