Skip to content

Conversation

AaronRobinsonMSFT
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT commented Oct 15, 2025

In clang-20 there is a known breaking change to -fwrapv that impacted us. Details can be found at https://releases.llvm.org/20.1.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes.

Add the -fno-strict-aliasing to match our MSVC usage as well.

Fixes #119706

In clang-20 there is a known breaking change to -fwrapv that impacted us.
Details can be found at https://releases.llvm.org/20.1.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes.

Add the -fno-strict-aliasing to match our MSVC usage as well.
@AaronRobinsonMSFT
Copy link
Member Author

/cc @rnkovacs

Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

Copy link
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of these days I'll get UBSAN working..

@jkotas
Copy link
Member

jkotas commented Oct 16, 2025

We should have a build image with clang 21 now: dotnet/dotnet-buildtools-prereqs-docker#1516

You can try updating all mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0 under eng to mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0 in this PR to check what the CI tests think about it.

@am11
Copy link
Member

am11 commented Oct 18, 2025

Last CI run still used clang 20:

  -- The C compiler identification is Clang 20.1.8
  -- The CXX compiler identification is Clang 20.1.8

New images were built a few hours ago dotnet/dotnet-buildtools-prereqs-docker#1516 (comment) (it doesn't automatically rebuild the subtree).

@am11
Copy link
Member

am11 commented Oct 18, 2025

@jkotas, looks like we need to apply:

--- a/src/native/libs/System.Security.Cryptography.Native/pal_x509.c
+++ b/src/native/libs/System.Security.Cryptography.Native/pal_x509.c
@@ -1250,6 +1250,7 @@ static int32_t X509ChainVerifyOcsp(X509_STORE_CTX* storeCtx, X509* subject, X509
             {
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wcast-qual"
+#pragma clang diagnostic ignored "-Wimplicit-void-ptr-cast"
                 if (i2d_OCSP_RESPONSE_bio(bio, resp))
 #pragma clang diagnostic pop
                 {

@am11
Copy link
Member

am11 commented Oct 18, 2025

FreeBSD build fix:

--- a/src/native/libs/System.Native/pal_interfaceaddresses.c
+++ b/src/native/libs/System.Native/pal_interfaceaddresses.c
@@ -561,7 +561,7 @@ int32_t SystemNative_EnumerateGatewayAddressesForInterface(void* context, uint32
         return -1;
     }
 
-    uint8_t* buffer = malloc(byteCount);
+    uint8_t* buffer = (uint8_t*)malloc(byteCount);
     if (buffer == NULL)
     {
         errno = ENOMEM;
@@ -587,7 +587,7 @@ int32_t SystemNative_EnumerateGatewayAddressesForInterface(void* context, uint32
 
         byteCount = tmpEstimatedSize;
         free(buffer);
-        buffer = malloc(byteCount);
+        buffer = (uint8_t*)malloc(byteCount);
         if (buffer == NULL)
         {
             errno = ENOMEM;

@am11
Copy link
Member

am11 commented Oct 18, 2025

It would be nice to update tables in https://github.com/dotnet/runtime/blob/f0db8f9d9668ba03897739152d02623acbd04466/docs/workflow/using-docker.md at the same time (replace net10 with net11). It can be done in a follow-up PR. :)

@Copilot Copilot AI review requested due to automatic review settings October 20, 2025 01:23
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a breaking change in clang-20 related to the -fwrapv flag by updating compiler flags and adding explicit casts to resolve warnings. The changes ensure compatibility with clang-20 while maintaining consistent behavior with MSVC by adding -fno-strict-aliasing.

Key Changes:

  • Updated compiler flags in CMake configuration to use -fno-strict-overflow instead of -fwrapv for clang-20 compatibility
  • Added explicit casts to suppress implicit void pointer cast warnings in native code
  • Updated Docker container images from net10.0 to net11.0 across build infrastructure

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
eng/native/configurecompiler.cmake Replaced -fwrapv with -fno-strict-overflow and added -fno-strict-aliasing to match MSVC behavior
src/native/libs/System.Security.Cryptography.Native/pal_x509.c Added pragma to ignore -Wimplicit-void-ptr-cast warning
src/native/libs/System.Security.Cryptography.Native/opensslshim.h Added explicit X509* cast to sk_X509_pop macro return value
src/native/libs/System.Native/pal_interfaceaddresses.c Added explicit uint8_t* casts to malloc calls
eng/pipelines/common/templates/pipeline-with-resources.yml Updated Docker images from net10.0 to net11.0
docs/workflow/using-docker.md Updated Docker image references in documentation from net10.0 to net11.0

@AaronRobinsonMSFT
Copy link
Member Author

/azp list

Copy link

CI/CD Pipelines for this repository:

@AaronRobinsonMSFT
Copy link
Member Author

/azp run runtime-coreclr outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET crashes when compiled with clang 21.1

4 participants