* BUG: Maybe fix reading global boolean variables.



git-svn-id: svn://localhost/gambas/trunk@4862 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Emil Lenngren 2012-06-26 21:08:37 +00:00
parent 001a5947bd
commit bded0d999a

View file

@ -1327,7 +1327,9 @@ llvm::Value* PushLastExpression::codegen_get_value(){
static llvm::Value* read_variable(TYPE type, char* addr){
llvm::Value* ret;
if (type < T_STRING || type == T_POINTER)
if (type == T_BOOLEAN)
ret = builder->CreateTrunc(read_global(addr, llvmType(getInt8Ty)), llvmType(getInt1Ty));
else if (type < T_STRING || type == T_POINTER)
ret = read_global(addr, TYPE_llvm(type));
else if (type == T_STRING){
llvm::Value* ad = read_global(addr);
@ -1394,7 +1396,9 @@ llvm::Value* ReadVariableExpression::codegen_get_value(){
//FIXME this is almost same as array_read, only difference is in variant
static llvm::Value* read_variable(TYPE type, llvm::Value* addr){
llvm::Value* ret;
if (type < T_STRING || type == T_POINTER)
if (type == T_BOOLEAN)
ret = builder->CreateTrunc(builder->CreateLoad(builder->CreateBitCast(addr, llvmType(getInt8PtrTy))), llvmType(getInt1Ty));
else if (type < T_STRING || type == T_POINTER)
ret = builder->CreateLoad(builder->CreateBitCast(addr, pointer_t(TYPE_llvm(type))));
else if (type == T_STRING){
llvm::Value* ad = builder->CreateLoad(builder->CreateBitCast(addr, charPP));