Skip to content
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

Implement internal write to a string #1848

Closed
certik opened this issue Jun 22, 2023 · 1 comment · Fixed by #4045
Closed

Implement internal write to a string #1848

certik opened this issue Jun 22, 2023 · 1 comment · Fixed by #4045
Labels
bug Something isn't working

Comments

@certik
Copy link
Contributor

certik commented Jun 22, 2023

 write (s, '(-1pe10.2,-2pe15.6,1pe010.2,2x,1pe9.2)') -a, b, -c, d

See #1847 that adds a GFortran test. We need to enable that test for LFortran as well.

@HarshitaKalani
Copy link
Contributor

program format_05

  real :: a,b,c,d
  character(100) :: s
  a = 123.456
  b = 123.45678
  c = 12.34
  d = 123.45
  
  print '(-1pe10.2,-2pe15.6,1pe010.2,2x,1pe9.2)', -a, b, -c, d
  write (s, '(-1pe10.2,-2pe15.6,1pe010.2,2x,1pe9.2)') -a, b, -c, d
  if (trim(s) /= " -0.01E+04   0.001235E+05 -1.23E+01   1.23E+02") error stop
end program
$ gfortran a.f90 && ./a.out
 -0.01E+04   0.001235E+05 -1.23E+01   1.23E+02
$ lfortran a.f90
code generation error: Only integer type is supported for string write(..) for now

Note: Please report unclear or confusing messages as bugs at
https://github.com/lfortran/lfortran/issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants