From 258bbf955b78fd9838c23b1d3e36c8ce6f90f6cc Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 7 Aug 2018 06:26:25 +0200 Subject: orth/llvm4: handle unreachable variable declarations. --- src/ortho/llvm4-nodebug/ortho_llvm.adb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/ortho') 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)); -- cgit v1.2.3