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

Do we need a line truncation error? #4039

Open
HarshitaKalani opened this issue May 20, 2024 · 1 comment
Open

Do we need a line truncation error? #4039

HarshitaKalani opened this issue May 20, 2024 · 1 comment
Labels
error not reported The compiler should report an error but did not

Comments

@HarshitaKalani
Copy link
Contributor

HarshitaKalani commented May 20, 2024

#3416
Ref: #4036

program main
    implicit none
    print *, (unpack([23.12000084, 23.12000084, 23.12000084, 23.12000084], [.true., .false., .true., .false.], [1.00000000, 2.00000000, 3.00000000, 4.00000000]))
end program main
$ lfortran b.f90
2.31200008e+01 2.00000000e+00 2.31200008e+01 4.00000000e+00 
$ gfortran b.f90 && ./a.out
b.f90:6:132:

    6 |     print *, (unpack([23.12000084, 23.12000084, 23.12000084, 23.12000084], [.true., .false., .true., .false.], [1.00000000, 2.00000000, 3.00000000, 4.00000000]))
      |                                                                                                                                    1
Error: Line truncated at (1) [-Werror=line-truncation]
b.f90:6:132:

    6 |     print *, (unpack([23.12000084, 23.12000084, 23.12000084, 23.12000084], [.true., .false., .true., .false.], [1.00000000, 2.00000000, 3.00000000, 4.00000000]))
      |                                                                                                                                    1
Error: Syntax error in array constructor at (1)
f951: some warnings being treated as errors
@HarshitaKalani HarshitaKalani added the error not reported The compiler should report an error but did not label May 20, 2024
@HarshitaKalani
Copy link
Contributor Author

The above code is generated when we do the following

 program main
     print *, unpack([23.12, 23.12, 23.12, 23.12], [.true., .false., .true., .false.], [1.0, 2.0, 3.0, 4.0])
 end
$ lfortran b.f90 --show-fortran
program main
implicit none
print *, (unpack([23.12000084, 23.12000084, 23.12000084, 23.12000084], [.true., .false., .true., .false.], [1.00000000, 2.00000000, 3.00000000, 4.00000000]))
end program main

So we need to make sure that when we do --show-fortran, it also takes care that the length of one line of code does not exceed the standard length ( 132 characters I believe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error not reported The compiler should report an error but did not
Projects
None yet
Development

No branches or pull requests

1 participant