Skip to content

Conversation

@kkwli
Copy link
Collaborator

@kkwli kkwli commented Mar 5, 2025

The clang 20 compiler gives the following errors in descriptor.cpp and assign.cpp.

/scratch/kli/llvm-project/flang-rt/lib/runtime/assign.cpp:266:19: error: first argument in call to 'memcpy' is a pointer to non-trivially copyable type 'Descriptor' [-Werror,-Wnontrivial-memcall]
  266 |       std::memcpy(deferDeallocation, &to, to.SizeInBytes());
      |                   ^
/scratch/kli/llvm-project/flang-rt/lib/runtime/assign.cpp:266:19: note: explicitly cast the pointer to silence this warning
  266 |       std::memcpy(deferDeallocation, &to, to.SizeInBytes());
      |                   ^
      |                   (void*)
/scratch/kli/llvm-project/flang-rt/lib/runtime/assign.cpp:274:19: error: first argument in call to 'memcpy' is a pointer to non-trivially copyable type 'Descriptor' [-Werror,-Wnontrivial-memcall]
  274 |       std::memcpy(&newFrom, &from, descBytes);
      |                   ^
/scratch/kli/llvm-project/flang-rt/lib/runtime/assign.cpp:274:19: note: explicitly cast the pointer to silence this warning
  274 |       std::memcpy(&newFrom, &from, descBytes);
      |                   ^
      |                   (void*)
2 errors generated.

This patch is to add the explicit cast to the first argument of std::memcpy.

@kkwli kkwli self-assigned this Mar 5, 2025
@kkwli kkwli merged commit a7a65a8 into llvm:main Mar 6, 2025
10 checks passed
@kkwli kkwli deleted the memcpy-error-msg branch March 6, 2025 21:09
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.

2 participants