Skip to content

Commit 75d74d9

Browse files
committed
Revert "[flang] IEEE_ARITHMETIC must imply USE IEEE_EXCEPTIONS"
This reverts commit b6a7600. It caused the following build failure: ``` ninja: error: dependency cycle: include/flang/__fortran_ieee_exceptions.mod -> include/flang/__fortran_ieee_exceptions.mod ``` See e.g.: * https://lab.llvm.org/buildbot/#/builders/172/builds/9595 To reproduce: ``` cmake -G Ninja \ -DLLVM_TARGETS_TO_BUILD=host \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_PROJECTS="clang;flang" \ ../../llvm ninja check-flang ```
1 parent a44aeab commit 75d74d9

File tree

5 files changed

+116
-142
lines changed

5 files changed

+116
-142
lines changed

flang/lib/Semantics/check-do-forall.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ class DoConcurrentBodyEnforce {
279279
" CONCURRENT"_err_en_US,
280280
doConcurrentSourcePosition_);
281281
}
282-
if (name->symbol &&
283-
fromScope(*name->symbol, "__fortran_ieee_exceptions"s)) {
282+
if (name->symbol && fromScope(*name->symbol, "ieee_exceptions"s)) {
284283
if (name->source == "ieee_set_halting_mode") {
285284
SayWithDo(context_, currentStatementSourcePosition_,
286285
"IEEE_SET_HALTING_MODE is not allowed in DO "

flang/module/__fortran_ieee_exceptions.f90

Lines changed: 0 additions & 129 deletions
This file was deleted.

flang/module/ieee_arithmetic.f90

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ module ieee_arithmetic
2929
ieee_support_subnormal => __builtin_ieee_support_subnormal, &
3030
ieee_support_underflow_control => __builtin_ieee_support_underflow_control
3131

32-
! 17.1: "The module IEEE_ARITHMETIC behaves as if it contained a USE statement
33-
! for IEEE_EXCEPTIONS; everything that is public in IEEE_EXCEPTIONS is public
34-
! in IEEE_ARITHMETIC."
35-
use __Fortran_ieee_exceptions
36-
3732
implicit none
3833

3934
type :: ieee_class_type

flang/module/ieee_exceptions.f90

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,120 @@
66
!
77
!===------------------------------------------------------------------------===!
88

9+
! See Fortran 2018, clause 17
910
module ieee_exceptions
10-
use __Fortran_ieee_exceptions
11+
12+
type :: ieee_flag_type ! Fortran 2018, 17.2 & 17.3
13+
private
14+
integer(kind=1) :: flag = 0
15+
end type ieee_flag_type
16+
17+
type(ieee_flag_type), parameter :: &
18+
ieee_invalid = ieee_flag_type(1), &
19+
ieee_overflow = ieee_flag_type(2), &
20+
ieee_divide_by_zero = ieee_flag_type(4), &
21+
ieee_underflow = ieee_flag_type(8), &
22+
ieee_inexact = ieee_flag_type(16), &
23+
ieee_denorm = ieee_flag_type(32) ! PGI extension
24+
25+
type(ieee_flag_type), parameter :: &
26+
ieee_usual(*) = [ &
27+
ieee_overflow, ieee_divide_by_zero, ieee_invalid ], &
28+
ieee_all(*) = [ &
29+
ieee_usual, ieee_underflow, ieee_inexact, ieee_denorm ]
30+
31+
type :: ieee_modes_type ! Fortran 2018, 17.7
32+
private
33+
end type ieee_modes_type
34+
35+
type :: ieee_status_type ! Fortran 2018, 17.7
36+
private
37+
end type ieee_status_type
38+
39+
private :: ieee_support_flag_2, ieee_support_flag_3, &
40+
ieee_support_flag_4, ieee_support_flag_8, ieee_support_flag_10, &
41+
ieee_support_flag_16
42+
interface ieee_support_flag
43+
module procedure :: ieee_support_flag, &
44+
ieee_support_flag_2, ieee_support_flag_3, &
45+
ieee_support_flag_4, ieee_support_flag_8, ieee_support_flag_10, &
46+
ieee_support_flag_16
47+
end interface
48+
49+
contains
50+
elemental subroutine ieee_get_flag(flag, flag_value)
51+
type(ieee_flag_type), intent(in) :: flag
52+
logical, intent(out) :: flag_value
53+
end subroutine ieee_get_flag
54+
55+
elemental subroutine ieee_get_halting_mode(flag, halting)
56+
type(ieee_flag_type), intent(in) :: flag
57+
logical, intent(out) :: halting
58+
end subroutine ieee_get_halting_mode
59+
60+
subroutine ieee_get_modes(modes)
61+
type(ieee_modes_type), intent(out) :: modes
62+
end subroutine ieee_get_modes
63+
64+
subroutine ieee_get_status(status)
65+
type(ieee_status_type), intent(out) :: status
66+
end subroutine ieee_get_status
67+
68+
pure subroutine ieee_set_flag(flag, flag_value)
69+
type(ieee_flag_type), intent(in) :: flag
70+
logical, intent(in) :: flag_value
71+
end subroutine ieee_set_flag
72+
73+
pure subroutine ieee_set_halting_mode(flag, halting)
74+
type(ieee_flag_type), intent(in) :: flag
75+
logical, intent(in) :: halting
76+
end subroutine ieee_set_halting_mode
77+
78+
subroutine ieee_set_modes(modes)
79+
type(ieee_modes_type), intent(in) :: modes
80+
end subroutine ieee_set_modes
81+
82+
subroutine ieee_set_status(status)
83+
type(ieee_status_type), intent(in) :: status
84+
end subroutine ieee_set_status
85+
86+
pure logical function ieee_support_flag(flag)
87+
type(ieee_flag_type), intent(in) :: flag
88+
ieee_support_flag = .true.
89+
end function
90+
pure logical function ieee_support_flag_2(flag, x)
91+
type(ieee_flag_type), intent(in) :: flag
92+
real(kind=2), intent(in) :: x(..)
93+
ieee_support_flag_2 = .true.
94+
end function
95+
pure logical function ieee_support_flag_3(flag, x)
96+
type(ieee_flag_type), intent(in) :: flag
97+
real(kind=3), intent(in) :: x(..)
98+
ieee_support_flag_3 = .true.
99+
end function
100+
pure logical function ieee_support_flag_4(flag, x)
101+
type(ieee_flag_type), intent(in) :: flag
102+
real(kind=4), intent(in) :: x(..)
103+
ieee_support_flag_4 = .true.
104+
end function
105+
pure logical function ieee_support_flag_8(flag, x)
106+
type(ieee_flag_type), intent(in) :: flag
107+
real(kind=8), intent(in) :: x(..)
108+
ieee_support_flag_8 = .true.
109+
end function
110+
pure logical function ieee_support_flag_10(flag, x)
111+
type(ieee_flag_type), intent(in) :: flag
112+
real(kind=10), intent(in) :: x(..)
113+
ieee_support_flag_10 = .true.
114+
end function
115+
pure logical function ieee_support_flag_16(flag, x)
116+
type(ieee_flag_type), intent(in) :: flag
117+
real(kind=16), intent(in) :: x(..)
118+
ieee_support_flag_16 = .true.
119+
end function
120+
121+
pure logical function ieee_support_halting(flag)
122+
type(ieee_flag_type), intent(in) :: flag
123+
end function ieee_support_halting
124+
11125
end module ieee_exceptions

flang/tools/f18/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ set(LLVM_LINK_COMPONENTS
66

77
set(MODULES
88
"__fortran_builtins"
9-
"__fortran_ieee_exceptions"
109
"__fortran_type_info"
1110
"ieee_arithmetic"
1211
"ieee_exceptions"
@@ -28,10 +27,6 @@ foreach(filename ${MODULES})
2827
if(NOT ${filename} MATCHES "__fortran_type_info")
2928
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_type_info.mod)
3029
endif()
31-
if(${filename} MATCHES "ieee_arithmetic" OR
32-
${filename} MATCHES "ieee_exceptions")
33-
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_ieee_exceptions.mod)
34-
endif()
3530
endif()
3631
add_custom_command(OUTPUT ${base}.mod
3732
COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR}

0 commit comments

Comments
 (0)