-
Notifications
You must be signed in to change notification settings - Fork 111
fix: OpenMP flags incorrectly applied to C/C++ compilers that don't s… #1161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
krystophny
wants to merge
5
commits into
fortran-lang:main
Choose a base branch
from
krystophny:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+319
−22
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#2) * fix: OpenMP flags incorrectly applied to C/C++ compilers that don't support them - Add C and C++ compiler capability testing functions to fpm_compiler.F90 - Modify OpenMP metapackage to test OpenMP support per language individually - Only apply OpenMP flags to languages where the compiler actually supports them - Fixes issue where clang C compiler fails with unsupported -fopenmp flag Resolves fortran-lang#1159 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: Add missing temporary file cleanup in C/C++ compiler testing functions - Add cleanup code to check_c_source_runs() and check_cxx_source_runs() - Matches the cleanup pattern used in check_fortran_source_runs() - Prevents accumulation of temporary files during OpenMP capability testing Addresses review feedback from qodo-merge-pro 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * test: Add comprehensive test coverage for C/C++ compiler capability functions - Add test_check_c_source_runs() with tests for: - Valid C hello world program - Program that returns error code 1 - Invalid compile flags - check_c_flags_supported() wrapper - Add test_check_cxx_source_runs() with tests for: - Valid C++ hello world program - Program that returns error code 1 - Invalid compile flags - check_cxx_flags_supported() wrapper - Both test suites mirror the existing Fortran tests structure - Tests verify error detection and temporary file cleanup 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * test: Improve C/C++ test robustness and fix potential escaping issues - Skip C/C++ tests if compiler is not available - Use simpler test programs to avoid iostream complexities - Use cstdio instead of iostream for better compatibility - Gracefully handle missing or misconfigured C++ compilers These changes make the tests more robust across different environments where C/C++ compilers may not be properly configured. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Ensure the linker always receives OpenMP flags when OpenMP is requested, even if individual C/C++ compilers don't support OpenMP. The linker needs these flags to properly link OpenMP runtime libraries when any compiled objects contain OpenMP code. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Shared libraries were missing model%link_flags which include metapackage flags like OpenMP. This caused OpenMP shared libraries to fail linking as they didn't get the necessary OpenMP runtime library flags. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Nice work @krystophny - do you need help completing this PR? |
- Fix check_c_source_runs() to use C compiler (icx) instead of Fortran compiler (ifx) for linking - Fix check_cxx_source_runs() to use C++ compiler (icpx) instead of Fortran compiler for linking - Resolves "multiple definition of main" error with Intel Fortran compiler - Intel Fortran automatically links for_main.o which conflicts with C main() functions - This enables C/C++ compiler capability testing (e.g., OpenMP flag detection) to work correctly The previous approach of using Fortran compiler for linking pure C/C++ programs caused linker conflicts because Intel Fortran includes its own main entry point. Using the appropriate language compiler for pure language programs is the correct approach. Fixes test failures in check-c-source-runs and check-cxx-source-runs. Related to OpenMP metapackage C/C++ compiler capability detection. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Thanks, should be fine and ready to merge. New C test just uncovered another issue #1165 but that one is a future improvement for an edge case |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…… (#2)
Resolves #1159
🤖 Generated with Claude Code
Addresses review feedback from qodo-merge-pro
🤖 Generated with Claude Code
Add test_check_c_source_runs() with tests for:
Add test_check_cxx_source_runs() with tests for:
Both test suites mirror the existing Fortran tests structure
Tests verify error detection and temporary file cleanup
🤖 Generated with Claude Code
These changes make the tests more robust across different environments where C/C++ compilers may not be properly configured.
🤖 Generated with Claude Code