Code Monkey home page Code Monkey logo

Comments (3)

certik avatar certik commented on June 2, 2024 1

You have to use --fast, it still doesn't work as of 1b3204f:

$ lfortran a.f90 
7.50000000000000000e+01 7.50000000000000000e+01 
7.50000000000000000e+01 7.50000000000000000e+01 

7.50000000000000000e+01 7.50000000000000000e+01 
7.50000000000000000e+01 7.50000000000000000e+01 

$ lfortran a.f90 --fast
7.50000000000000000e+01 7.50000000000000000e+01 
7.50000000000000000e+01 7.50000000000000000e+01 

2.12955623347515187e-314 2.12955623347515187e-314 
2.12955623347515187e-314 2.12955623347515187e-314 

from lfortran.

certik avatar certik commented on June 2, 2024

Thanks for the bug report! Indeed, there is some bug, here is a minimal example:

program main
implicit none
integer(kind=4), parameter :: m = 2
integer(kind=4) i, j
real(kind=8) :: mean = 75.0
real(kind=8) u(m, m)
real(kind=8) w(m, m)

w = mean

! fails
do j = 1, m
do i = 1, m
    u(i,j) = w(i,j)
end do
end do

print *, w
print *, u

do j = 1, m
do i = 1, m
    if (u(i,j) /= w(i,j)) error stop
end do
end do

end

This gives:

$ lfortran x.f90 
7.50000000000000000e+01 7.50000000000000000e+01 
7.50000000000000000e+01 7.50000000000000000e+01 

7.50000000000000000e+01 7.50000000000000000e+01 
7.50000000000000000e+01 7.50000000000000000e+01 

$ lfortran x.f90 --fast
7.50000000000000000e+01 7.50000000000000000e+01 
7.50000000000000000e+01 7.50000000000000000e+01 

2.13924567501028306e-314 2.13924567501028306e-314 
2.13924567501028306e-314 2.13924567501028306e-314 

Note that the error condition failed as well, so there are two bugs.

from lfortran.

Pranavchiku avatar Pranavchiku commented on June 2, 2024

This now works well:

% lfortran a.f90 
7.50000000000000000e+01 7.50000000000000000e+01 
7.50000000000000000e+01 7.50000000000000000e+01 

7.50000000000000000e+01 7.50000000000000000e+01 
7.50000000000000000e+01 7.50000000000000000e+01 

% gfortran a.f90 && ./a.out
ld: warning: ignoring duplicate libraries: '-lemutls_w', '-lgcc'
   75.000000000000000        75.000000000000000        75.000000000000000        75.000000000000000     
   75.000000000000000        75.000000000000000        75.000000000000000        75.000000000000000  

from lfortran.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.