diff --git a/src/mapleall/maple_ir/src/debug_info.cpp b/src/mapleall/maple_ir/src/debug_info.cpp index 15464543988797287708637552bf6ac3b554549c..20f1e03b1c92b6829a5ceea09449fc96d4519aff 100644 --- a/src/mapleall/maple_ir/src/debug_info.cpp +++ b/src/mapleall/maple_ir/src/debug_info.cpp @@ -843,7 +843,12 @@ DBGDie *DebugInfo::GetOrCreateArrayTypeDie(const MIRArrayType *arraytype) { DBGDie *rangedie = module->GetMemPool()->New(module, DW_TAG_subrange_type); (void)GetOrCreatePrimTypeDie(GlobalTables::GetTypeTable().GetUInt32()); rangedie->AddAttr(DW_AT_type, DW_FORM_ref4, PTY_u32); - rangedie->AddAttr(DW_AT_upper_bound, DW_FORM_data4, arraytype->GetSizeArrayItem(0)); + if (theMIRModule->IsCModule() || theMIRModule->IsJavaModule()) { + // The default lower bound value for C, C++, or Java is 0 + rangedie->AddAttr(DW_AT_upper_bound, DW_FORM_data4, arraytype->GetSizeArrayItem(0) - 1); + } else { + rangedie->AddAttr(DW_AT_upper_bound, DW_FORM_data4, arraytype->GetSizeArrayItem(0)); + } die->AddSubVec(rangedie);