-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Summary
Fortfront hangs during first pass transformation on 20 test cases from GCC testsuite. These are distinct from roundtrip_timeout (which hangs on second pass).
Standard vs Lazy Fortran Behavior
This issue affects: BOTH standard and lazy Fortran (.f90 and .lf files)
Parser hangs are independent of file type - they occur during AST construction regardless of whether type inference is needed.
Standard Fortran (.f90):
- Parser hangs during first pass (parse → AST construction)
- Affects files with complex intrinsic calls and array expressions
- Should parse and emit code without modification
Lazy Fortran (.lf):
- Same parser hang during first pass
- Type inference never runs (parser doesn't complete)
- Same root cause as standard Fortran parsing
CRITICAL: This is a parser correctness issue, not a type inference issue. Both .f90 and .lf files would hang on the same constructs.
Frequency
20 cases (1.3% of all failures)
Root Cause Analysis
Based on test patterns, likely causes:
- Intrinsic function calls with complex arguments:
maxloc,minloc,spread,reshapewith masks/dimensions - Deeply nested allocatable components: Deep copy operations with nested allocatable types
- Complex array expressions: Array slices with multiple dimensions and function calls
ISO Standard Compliance
NON-COMPLIANT with ISO/IEC 1539-1:2018:
- Section 16.9 specifies all intrinsic function definitions and their requirements (e.g., 16.9.94 MAXLOC, 16.9.160 RESHAPE, 16.9.195 SPREAD). Parser must handle references to these intrinsics with keyword arguments and complex expressions.
- Section 9.7.3.3: Parser must handle complex array constructor expressions
- Section 6.5.3.2: Parser must handle arbitrarily deep type definitions
Evidence (Fresh GCC Roundtrip Testing)
From logs/gfortran_verify_issues.jsonl:
- Status:
timeout(first pass timeout) - Duration: All cases timeout during first fortfront invocation
- Common keywords:
any,dim,mask,minloc,maxloc,reshape,pointer_attr
Top keywords across 20 cases:
any(frequent)dim(array dimension operations)mask(masked array operations)minloc/maxloc(intrinsics with complex arguments)reshape,spread(array manipulation)pointer_attr(pointer/allocatable deep structures)
Independent Test Case
! Minimal reproducer for parser hang with complex intrinsic calls
program test_complex_intrinsic
implicit none
integer :: arr(3,3), result(2)
arr = reshape([1,2,3,4,5,6,7,8,9], [3,3])
result = maxloc(arr, dim=1, mask=arr > 5)
print *, result
end programTest Case Requirements
Create independent minimal examples that trigger the hang (DO NOT copy GCC files):
- Complex intrinsic calls (
maxloc,minlocwithdimandmask) - Array constructor with
reshape - Nested allocatable type definitions
References
- Discovery: gfortran roundtrip testing
- Status: timeout (20 cases, first pass)