Skip to content

Commit

Permalink
add test_value by @jschueller
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Sep 17, 2023
1 parent b6647a0 commit 1990a70
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ xtes%: FC = ifx -ftrapuv -init=snan,array -fpe0 -fpe-all=0 -assume ieee_fpe_flag
####################################################################################################
# Making a specific test

test_value: test_value.f90
flang -c test_value.f90 && ./a.out

test_eqv: test_eqv.f90
gfortran -Ofast test_eqv.f90 && ./a.out

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ that develops optimization solvers.
* :negative_squared_cross_mark: [毕昇编译器](https://support.huaweicloud.com/ug-bisheng-kunpengdevps/kunpengbisheng_06_0006.html) ([Bisheng Compiler, based on the Classic flang](https://support.huaweicloud.com/intl/en-us/ug-bisheng-kunpengdevps/kunpengbisheng_06_0001.html)) 1.3.3.b023 (fail: `Array`, `Alloc`, `Implied do`)
* :ballot_box_with_check: [Absoft `af95`](https://www.absoft.com) in Absoft 64-bit Pro Fortran 22.0.2 with patch 3
* :negative_squared_cross_mark: [AOCC `flang`](https://developer.amd.com/amd-aocc/) 4.0.0 (fail: `solve`, `Array`, `Alloc`, `Implied do`)
* :negative_squared_cross_mark: [Classic `flang`](https://github.com/flang-compiler/flang) 15.0.3 (fail: `solve`, `Count`, `Alloc`)
* :negative_squared_cross_mark: [Classic `flang`](https://github.com/flang-compiler/flang) 15.0.3 (fail: `test_value`, `solve`, `Count`, `Alloc`)
* :negative_squared_cross_mark: [G95 `g95`](https://www.g95.org/downloads.shtml) 0.94 (insufficient support for F03 constructs)
* :negative_squared_cross_mark: [GNU `gfortran`](https://gcc.gnu.org/fortran/) 13.1.0 (fail: `test_eqv`)
* :ballot_box_with_check: [Intel `ifort`](https://www.intel.com/content/www/us/en/developer/tools/oneapi/fortran-compiler.html) 2021.9.0
Expand Down
8 changes: 4 additions & 4 deletions test_eqv.f90
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
! This is file : test
! Author= zaikunzhang
! Started at: 07.09.2023
! Last Modified: Friday, September 08, 2023 AM01:35:05
! Last Modified: Sunday, September 17, 2023 PM03:07:45

program test_eqv
implicit none
real :: x, y
character(len=100) :: str
x = huge(x)
x = x**2 / x**3
x = x**2 / x**3 ! Evaluates to NaN. Intended.
write (str, *) x
read (str, *) y
write (*, *) x, y, str
write (*, *) 'x <= 0.0, y <= 0.0', ' x <= 0.0 .eqv. y <= 0.0', ' x <= 0.0 .neqv. y <= 0.0'
write (*, *) 'x <= 0.0, y <= 0.0', ', (x <= 0.0 .eqv. y <= 0.0)', ', (x <= 0.0 .neqv. y <= 0.0)'
write (*, *) x <= 0.0, y <= 0.0, (x <= 0.0 .eqv. y <= 0.0), (x <= 0.0 .neqv. y <= 0.0)

if ((x <= 0.0 .eqv. y <= 0.0) .or. (x <= 0.0 .neqv. y <= 0.0)) then
if (x <= 0.0 .eqv. y <= 0.0) then
write (*, *) 'Right.'
else
write (*, *) 'Wrong!'
Expand Down
32 changes: 32 additions & 0 deletions test_value.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
!--------------------------------------------------------------------------------------------------!
! This is an example by Julien Schueller ( https://github.com/jschueller ).
! See https://github.com/flang-compiler/flang/issues/1419.
! Syndrome:
! $ uname -a && flang --version && flang -c test_value.f90
! Linux zX11 6.2.0-32-generic #32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
! flang version 15.0.3
! Target: x86_64-unknown-linux-gnu
! Thread model: posix
! InstalledDir: /home/zaikunzhang/local/flang/bin
! /tmp/test_value-48c7df.ll:10:149: error: expected '('
! define void @mod1_routn1_(i32 %_V_x1.arg, i32 %_V_x2.arg, i32 %_V_x3.arg, i32 %_V_x4.arg, i32 %_V_x5.arg, i32 %_V_x6.arg, %struct.c_funptr.1* byval %_V_fp1.arg) !dbg !20 {
! ^
! 1 error generated.
!--------------------------------------------------------------------------------------------------!

module mod1
contains

subroutine routn1(x1, x2, x3, x4, x5, x6, fp1)
use, intrinsic :: iso_c_binding, only : C_INT, C_FUNPTR
implicit none
integer(C_INT), intent(in), value :: x1
integer(C_INT), intent(in), value :: x2
integer(C_INT), intent(in), value :: x3
integer(C_INT), intent(in), value :: x4
integer(C_INT), intent(in), value :: x5
integer(C_INT), intent(in), value :: x6
type(C_FUNPTR), intent(in), value :: fp1
end subroutine routn1

end module mod1

0 comments on commit 1990a70

Please sign in to comment.