lfortran icon indicating copy to clipboard operation
lfortran copied to clipboard

Fix: Support derived-type component array sections in MAXLOC

Open srinjoy933 opened this issue 5 months ago • 2 comments

Fixes #11639

This pull request resolves a bug that caused the compiler to erroneously reject valid MAXLOC operations when evaluating array sections embedded inside arrays of derived types (such as top(:)%x(1)).

(ast_common_visitor.h): Refactored the array resolution logic. The compiler now actively detects and preserves the dimensionality of parent struct arrays, successfully outputting an ArraySection_t node rather than losing shape context and defaulting to a scalar item.

(asr_to_llvm.cpp & llvm_utils): Fixed how the compiler handles arrays that are nested inside custom data structures. We added a new helper function (load_pointer_element) so the compiler can safely find the exact memory addresses and figure out the correct shape and size of these nested arrays without crashing.

srinjoy933 avatar Jun 13 '26 09:06 srinjoy933

Hey @HarshitaKalani ,can you please have a look on this pr, Thank You!

srinjoy933 avatar Jun 16 '26 14:06 srinjoy933

Hey @HarshitaKalani , I have now removed the version specifications ,please have a look at this now.

srinjoy933 avatar Jun 30 '26 16:06 srinjoy933