diff --git a/src/CGOptions.h b/src/CGOptions.h index 188b22afa..9c4dd8211 100644 --- a/src/CGOptions.h +++ b/src/CGOptions.h @@ -53,7 +53,7 @@ using namespace std; #define CGOPTIONS_DEFAULT_MAX_STRUCT_FIELDS (10) #define CGOPTIONS_DEFAULT_MAX_UNION_FIELDS (5) #define CGOPTIONS_DEFAULT_MAX_NESTED_STRUCT_LEVEL (3) -#define CGOPTIONS_DEFAULT_MAX_INDIRECT_LEVEL (2) +#define CGOPTIONS_DEFAULT_MAX_INDIRECT_LEVEL (5) #define CGOPTIONS_DEFAULT_MAX_ARRAY_DIMENSIONS (3) #define CGOPTIONS_DEFAULT_MAX_ARRAY_LENGTH_PER_DIMENSION (10) #define CGOPTIONS_DEFAULT_MAX_ARRAY_LENGTH (256) diff --git a/src/VariableSelector.cpp b/src/VariableSelector.cpp index 7e13f81cc..00cb1574f 100644 --- a/src/VariableSelector.cpp +++ b/src/VariableSelector.cpp @@ -1230,11 +1230,14 @@ VariableSelector::select_deref_pointer(Effect::Access access, const CGContext &c vars.insert(vars.end(), f->param.begin(), f->param.end()); Variable* var = choose_var(vars, access, cg_context, type, qfer, eDereference, invalid_vars); - ERROR_GUARD(NULL); if (var == 0) { - Type* ptr_type = Type::find_pointer_type(type, true); - ERROR_GUARD(NULL); - assert(ptr_type); + Type* ptr_type = 0; + if (type->get_indirect_level() < CGOptions::max_indirect_level()) { + ptr_type = Type::find_pointer_type(type, true); + } + if (!ptr_type) { + return 0; + } CVQualifiers ptr_qfer = (!qfer || qfer->wildcard) ? CVQualifiers::random_qualifiers(ptr_type, access, cg_context, true) //: qfer->indirect_qualifiers(-1);