Skip to content

Commit 87be52a

Browse files
krystophnyclaude
andcommitted
fix: resolve critical linking failures in decomposed modules
Fixed symbol visibility issues preventing proper module linking: 1. Fixed mlir_backend.f90 re-export module to use explicit imports - Changed from generic 'use module' to 'use module, only: symbols' - Ensures all symbols are properly imported and re-exported - Resolves "undefined reference to generate_mlir_module" error 2. Fixed fortran_backend.f90 re-export module similarly - Applied same explicit import pattern for consistency - Prevents future linking issues 3. Fixed format string syntax error in hlfir_dialect.f90 - Corrected write statement format specifier - Removed extra 'A' from '(A,L1,A,L1,A,L1,A)' -> '(A,L1,A,L1,A,L1)' 4. Fixed performance_benchmarks.f90 test - Replaced non-existent destroy_memory_tracker() call - Changed to tracker%cleanup() method call All changes maintain API compatibility while ensuring proper symbol export. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 209230d commit 87be52a

File tree

4 files changed

+40
-11
lines changed

4 files changed

+40
-11
lines changed

src/backend/fortran/fortran_backend.f90

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
module fortran_backend
2-
use fortran_backend_core
3-
use fortran_backend_statements
4-
use fortran_backend_expressions
2+
use fortran_backend_core, only: fortran_backend_t, generate_code_from_arena, generate_code_program, &
3+
generate_code_function_def, generate_code_subroutine_def
4+
use fortran_backend_statements, only: generate_code_assignment, generate_code_print_statement, &
5+
generate_code_declaration, generate_code_parameter_declaration, &
6+
generate_code_if, generate_code_do_loop, generate_code_do_while, &
7+
generate_code_select_case, generate_code_stop, generate_code_return, &
8+
generate_code_cycle, generate_code_exit, generate_code_where, &
9+
generate_code_use_statement, generate_code_subroutine_call, &
10+
generate_grouped_body, can_group_declarations, can_group_parameters, &
11+
generate_grouped_declaration, build_param_name_with_dims
12+
use fortran_backend_expressions, only: generate_code_literal, generate_code_identifier, &
13+
generate_code_binary_op, generate_code_call_or_subscript, &
14+
generate_code_array_literal, find_node_index_in_arena, same_node
515
implicit none
616
private
717

src/backend/mlir/mlir_backend.f90

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
module mlir_backend
2-
use mlir_backend_core
3-
use mlir_backend_helpers
4-
use mlir_backend_functions
5-
use mlir_backend_statements
6-
use mlir_backend_operators
7-
use mlir_backend_output
2+
use mlir_backend_core, only: generate_mlir_program, generate_mlir_node, generate_mlir_module, &
3+
generate_mlir_interface_block, generate_mlir_function_declaration, &
4+
generate_mlir_subroutine_declaration, generate_mlir_module_node, &
5+
generate_mlir_use_statement, resolve_module_symbols, &
6+
generate_mlir_where_construct, generate_mlir_derived_type
7+
use mlir_backend_helpers, only: format_string_to_array, generate_hlfir_constant, generate_hlfir_load, &
8+
generate_hlfir_string_literal, int_to_char
9+
use mlir_backend_functions, only: generate_mlir_program_functions, generate_mlir_function, &
10+
generate_mlir_subroutine, generate_function_parameter_list, &
11+
generate_function_call_with_args, is_function_name
12+
use mlir_backend_statements, only: generate_mlir_declaration, generate_mlir_assignment, &
13+
generate_mlir_pointer_assignment, is_pointer_variable, &
14+
generate_mlir_subroutine_call, generate_mlir_return, &
15+
generate_mlir_exit, generate_mlir_cycle, &
16+
generate_mlir_allocate_statement, generate_array_size_calculation, &
17+
generate_mlir_deallocate_statement
18+
use mlir_backend_operators, only: is_generic_procedure_call, generate_mlir_generic_procedure_call, &
19+
find_interface_block, resolve_generic_procedure, &
20+
is_operator_overloaded, generate_mlir_operator_overload_call, &
21+
generate_mlir_assignment_overload_call, resolve_operator_procedure, &
22+
resolve_assignment_procedure, get_procedure_name_from_node
23+
use mlir_backend_output, only: generate_string_runtime_output, generate_integer_runtime_output, &
24+
generate_real_runtime_output, generate_logical_runtime_output, &
25+
generate_variable_runtime_output, generate_expression_runtime_output, &
26+
generate_call_runtime_output
827
implicit none
928
private
1029

src/dialects/hlfir_dialect.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function create_hlfir_fortran_attrs(context, contiguous, target, optional) resul
194194
character(len=64) :: attr_str
195195

196196
! Create a string representation of attributes
197-
write(attr_str, '(A,L1,A,L1,A,L1,A)') &
197+
write(attr_str, '(A,L1,A,L1,A,L1)') &
198198
'contiguous=', contiguous, &
199199
',target=', target, &
200200
',optional=', optional

test/performance_benchmarks.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ function benchmark_memory_patterns() result(passed)
277277
print '(A,F8.3,A)', " Rate: ", real(iterations)/elapsed, " operations/second"
278278
print '(A,I0)', " Peak tracked allocations: ", tracker%get_peak_usage()
279279

280-
call destroy_memory_tracker(tracker)
280+
call tracker%cleanup()
281281

282282
passed = elapsed < 10.0 ! Should complete in under 10 seconds
283283
end function benchmark_memory_patterns

0 commit comments

Comments
 (0)