Closed coti closed 4 years ago
The error messages that you quote are from gfortran, not from f18, and I think that they're due to gfortran being run without its -fbackslash
option that enables the use of backslash escape sequences in CHARACTER literals.
Interesting, thanks a lot.
However:
Hello, I have isolated a problematic character from this test and pushed minimal use-cases here: https://github.com/E4S-Project/testsuite/tree/master/validation_tests/llvm/f18/simple
you can run them with the script run.sh
or with:
make FC=gfortran
make clean
make FC=f18
All three programs compile with gfortran, but the one that contains a special character fails with f18.
Sorry, the problematic character is not visible in GitHub's code display mode. In vim it appears as ^A
and the error message shows it as \001
.
Camille
So the problem is not with Unicode characters identified by number, but rather the non-standard use of control characters in CHARACTER literals?
It seems like it, although the error message is displaying the unicode with \ and a number...
Does it work with -flatin
to disable UTF-8 source?
Same error:
$ f18 -flatin -o characters_wrong.o -c characters_wrong.f90
/tmp/f18-39d5.f90:3:12:
p = iachar("\001")
1
Error: Argument of IACHAR at (1) must be of length one
Ok, thanks, that helps narrow the problem down.
So here's what I think the problem is: when f18 emits "unparsed" code for another Fortran compiler, it uses octal escape sequences for non-ASCII characters ("\001"
). PGI Fortran accepts octal escapes, but not hex escapes ("\x01"
). GNU Fortran accepts hex escapes but not octal escapes.
Hello,
Thank you for the modification. I git pull'ed this morning and am now at revision 74617f1. I compiled and I am still using gfortran 8.1.0.
Unfortunately, I still get
f18 -o characters_wrong.o -c characters_wrong.f90
/tmp/f18-49f7f.f90:3:12:
p = iachar("\001")
1
Error: Argument of IACHAR at (1) must be of length one
Can it compile on your side?
No, it doesn't (now), and I don't know why. I'll look at it further.
The difference seems to be that I always run with semantic analysis enabled; it's not the default mode yet in f18, but will be soon. You can enable it today with -fdebug-semantics
.
I'll make sure that the compiler's unparsed output avoids octal/hex escape sequences for control characters when semantic analysis is not performed, as well.
Please check when convenient whether you can confirm in your environment that the problem has been resolved or persists; thanks for the bug report!
Dear Peter,
I just pulled and recompiled f18, and: yes, it compiles! And the corresponding test in the gfortran.dg testsuite passes.
thanks! Camille
Please close this bug report if you believe it should be closed. Thanks again.
Hello,
I have tried to run the gfortran testsuite with f18.
I have recompiled f18 this morning, using llvm 9.0
A few tests fail. Here is the list:
I guess the
coarray
ones are expected to fail. I don't know what is wrong withliteral_character_constant_1_x.F
andcpp5.F
, because I compiled and ran them manually with f18 without any problem.The last problematic test is
achar_2.f90
. I have tried separately with gfortran and f18:So it looks like the character constants given by their unicode number are not treated as single characters. This is very specific to these characters (starting with
\
), because the source codeachar_2.f90
starts with things like:and there is no problem with them.
So my question is: is it expected that giving characters under this form is not handled?
Thanks, Camille