From 0305d3bce25c17a6361f98f953d15058cc67df07 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 15 Jun 2013 23:22:34 +0200 Subject: [PATCH] Never make external variables something else than external. Fixes crash in DMD testcase 'mangle'. --- gen/llvmhelpers.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 1339dc1b..4d71b928 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -1546,6 +1546,13 @@ bool mustDefineSymbol(Dsymbol* s) } } + if (VarDeclaration* vd = s->isVarDeclaration()) + { + // Never define 'extern' variables. + if (vd->storage_class & STCextern) + return false; + } + // Inlining checks may create some variable and class declarations // we don't need to emit. if (global.inExtraInliningSemantic)