Skip to content

[flang] Interpret 'Q' exponent letter as kind=16 even on x86 #124158

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

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions flang/lib/Common/default-kinds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@

namespace Fortran::common {

IntrinsicTypeDefaultKinds::IntrinsicTypeDefaultKinds() {
#if __x86_64__
quadPrecisionKind_ = 10;
#endif
}
IntrinsicTypeDefaultKinds::IntrinsicTypeDefaultKinds() {}

IntrinsicTypeDefaultKinds &IntrinsicTypeDefaultKinds::set_defaultIntegerKind(
int k) {
Expand Down
3 changes: 0 additions & 3 deletions flang/lib/Frontend/CompilerInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ bool CompilerInstance::executeAction(FrontendAction &act) {
CompilerInvocation &invoc = this->getInvocation();

llvm::Triple targetTriple{llvm::Triple(invoc.getTargetOpts().triple)};
if (targetTriple.getArch() == llvm::Triple::ArchType::x86_64) {
invoc.getDefaultKinds().set_quadPrecisionKind(10);
}

// Set some sane defaults for the frontend.
invoc.setDefaultFortranOpts();
Expand Down
13 changes: 4 additions & 9 deletions flang/test/Semantics/kinds04_q10.f90
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
! RUN: %python %S/test_errors.py %s %flang_fc1 -triple x86_64-unknown-linux-gnu
! RUN: %python %S/test_errors.py %s %flang_fc1
! C716 If both kind-param and exponent-letter appear, exponent-letter
! shall be E. (As an extension we also allow an exponent-letter which matches
! the kind-param)
! C717 The value of kind-param shall specify an approximation method that
! exists on the processor.
!
! This test is for x86_64, where exponent-letter 'q' is for
! 10-byte extended precision
! UNSUPPORTED: system-windows, system-aix
! REQUIRES: x86-registered-target

subroutine s(var)
real :: realvar1 = 4.0E6_4
real :: realvar2 = 4.0D6
real :: realvar3 = 4.0Q6
!PORTABILITY: Explicit kind parameter together with non-'E' exponent letter is not standard
real :: realvar4 = 4.0D6_8
!PORTABILITY: Explicit kind parameter together with non-'E' exponent letter is not standard
real :: realvar5 = 4.0Q6_10
!WARNING: Explicit kind parameter on real constant disagrees with exponent letter 'q'
real :: realvar5 = 4.0Q6_10
!PORTABILITY: Explicit kind parameter together with non-'E' exponent letter is not standard
real :: realvar6 = 4.0Q6_16
real :: realvar7 = 4.0E6_8
real :: realvar8 = 4.0E6_10
Expand All @@ -31,7 +26,7 @@ subroutine s(var)
double precision :: doublevar3 = 4.0Q6
!PORTABILITY: Explicit kind parameter together with non-'E' exponent letter is not standard
double precision :: doublevar4 = 4.0D6_8
!WARNING: Explicit kind parameter on real constant disagrees with exponent letter 'q'
!PORTABILITY: Explicit kind parameter together with non-'E' exponent letter is not standard
double precision :: doublevar5 = 4.0Q6_16
double precision :: doublevar6 = 4.0E6_8
double precision :: doublevar7 = 4.0E6_10
Expand Down
Loading