This is an archive of the discontinued LLVM Phabricator instance.

[flang] Change complex type define in runtime for clang-cl
ClosedPublic

Authored by rovka on Sep 21 2021, 2:37 AM.

Details

Summary

When compiling the runtime with a version of clang-cl newer than 12, we
define CMPLXF as __builtin_complex, which returns a float _Complex type.
This errors out in contexts where the result of CMPLXF is expected to be
a float_Complex_t. This is defined as _Fcomplex whenever _MSC_VER is
defined and as float _Complex otherwise.

This patch defines float_Complex_t & friends as _Fcomplex only when
we're using "true" MSVC, and not just clang-pretending-to-be-MSVC. This
should only affect clang-cl >= 12.

Diff Detail

Event Timeline

rovka created this revision.Sep 21 2021, 2:37 AM
rovka requested review of this revision.Sep 21 2021, 2:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2021, 2:37 AM

pre-merge check fails because disk is full.

flang/runtime/complex-reduction.h
23

! has a higher precedence than >=

With "true" msvc, __clang_major__ will not be defined and evaluate to 0, so it turns out to work. Still consider checking for whether __clang_major__ is defined to make intention clear.

rovka updated this revision to Diff 373874.Sep 21 2021, 5:27 AM

Thanks for the review, I've updated all relevant sites to check if clang_major is defined.

This revision is now accepted and ready to land.Sep 21 2021, 6:00 AM
This revision was landed with ongoing or failed builds.Sep 21 2021, 11:55 PM
This revision was automatically updated to reflect the committed changes.