Skip to content
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

Fix build failures when using Clang 19 #1454

Merged
merged 5 commits into from
Oct 7, 2024

Conversation

bryanpkc
Copy link
Collaborator

@bryanpkc bryanpkc commented Oct 2, 2024

When building Classic Flang with Clang 19, the compiler produces numerous -Wcast-function-type-mismatch warnings. Also, libflangrti.so fails to link and tests fail to run, since the OpenMP library libomp.so is now installed in a different location by default. This PR fixes these issues, in a way that should be compatible with the release_18x branch.

By default, LLVM 19 installs libomp and libompd under
$CMAKE_INSTALL_PREFIX/lib/$LLVM_HOST_TARGET/. This patch updates CMake
and llvm-lit configurations to add the new location to the linker and
the loader's search paths.
Reduction helpers in the Classic Flang runtime for different data types have
different function signatures, yet they are stored in tables with generic
types (e.g. void (*)())and are often compared with each other in contexts
requiring explicit casts. As of Clang 19, this type of code has resulted in
new compile-time warnings. This patch fixes the cases where the generic
void (*)() type is not used, and explicit casts are no longer sufficient to
silence the compiler.
Wrapper functions exists for the gather/scatter runtime functions which have
an additional argument, but the wrappers are used interchangeably with the
actual gather/scatter runtime functions. This patch fixes the runtime function
types to declare the optional argument, so that the runtime functions and their
helpers have the same types.
__abort_sig_hand() resets signal handlers before printing an error message
and calling abort(). The code used to set the sa_sigaction field to SIG_DFL,
requiring an explicit cast which now causes a warning. It is actually not
necessary to use sa_sigaction in this case; setting sa_handler to SIG_DFL
is the idiomatic way which also avoids the warning.
This patch fixes the type declaration for file I/O helpers to match
those of fread and rwrite.
@bryanpkc bryanpkc merged commit 1d69d8d into flang-compiler:master Oct 7, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants