aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-08-07 06:26:25 +0200
committerTristan Gingold <tgingold@free.fr>2018-08-07 06:27:18 +0200
commit258bbf955b78fd9838c23b1d3e36c8ce6f90f6cc (patch)
treeb023f45ef74887ffbc0c97d5db3050e9394294fa /src/ortho
parent5f3b43dcd3a63638f81a897ace8efa7c9e57d6a3 (diff)
downloadghdl-258bbf955b78fd9838c23b1d3e36c8ce6f90f6cc.tar.gz
ghdl-258bbf955b78fd9838c23b1d3e36c8ce6f90f6cc.tar.bz2
ghdl-258bbf955b78fd9838c23b1d3e36c8ce6f90f6cc.zip
orth/llvm4: handle unreachable variable declarations.
Diffstat (limited to 'src/ortho')
-rw-r--r--src/ortho/llvm4-nodebug/ortho_llvm.adb11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ortho/llvm4-nodebug/ortho_llvm.adb b/src/ortho/llvm4-nodebug/ortho_llvm.adb
index c79fa1c62..15090e216 100644
--- a/src/ortho/llvm4-nodebug/ortho_llvm.adb
+++ b/src/ortho/llvm4-nodebug/ortho_llvm.adb
@@ -1541,10 +1541,13 @@ package body Ortho_LLVM is
Decl : ValueRef;
begin
if Storage = O_Storage_Local then
- Res := (Kind => ON_Local_Decl,
- LLVM => BuildAlloca
- (Decl_Builder, Get_LLVM_Type (Atype), Get_Cstring (Ident)),
- Dtype => Atype);
+ if Unreach then
+ Decl := Null_ValueRef;
+ else
+ Decl := BuildAlloca
+ (Decl_Builder, Get_LLVM_Type (Atype), Get_Cstring (Ident));
+ end if;
+ Res := (Kind => ON_Local_Decl, LLVM => Decl, Dtype => Atype);
else
if Storage = O_Storage_External then
Decl := GetNamedGlobal (Module, Get_Cstring (Ident));