Skip to content

Conversation

@clementval
Copy link
Contributor

No description provided.

@clementval clementval requested a review from vzakhari April 15, 2025 03:23
// specific ABI requirements
extern "C" float _Complex RTNAME(cpowi)(float _Complex base, std::int32_t exp) {
extern "C" RT_API_ATTRS CppTypeFor<TypeCategory::Complex, 4> RTNAME(cpowi)(
CppTypeFor<TypeCategory::Complex, 4> base, std::int32_t exp) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I do not know where we stand with passing the complex values from Flang to the runtime, but the C complex was used here to match the ABI of pure C complex. The discussion was here: https://reviews.llvm.org/D134889

This change may be unsafe, but this needs to be investigated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I'm a bit confused since lots of other runtime functions use the CppType and only complex-powi.cpp and complex-reduction.h use the C complex. I'll have a deeper look when I have more time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the other APIs are passing args as references/pointers, and the memory layout is assumed to be the same for C and C++ complex. The problem (or not) is passing it by value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh right! I missed that part. Thanks. I'll gonna keep a look on that.

@clementval clementval marked this pull request as draft April 16, 2025 16:27
@clementval clementval closed this Apr 24, 2025
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