This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: unterminated character constant error
- From: Tobias Burnus <burnus at net-b dot de>
- To: Kamaraju S Kusumanchi <kamaraju at bluebottle dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 17 Dec 2007 08:46:42 +0100
- Subject: Re: unterminated character constant error
- References: <fk58bl$hpu$1@ger.gmane.org>
Kamaraju S Kusumanchi wrote:
> This has recently been brought up on Debian mailing list while making a
> transition from g77 to gfortran of libhdf4 package. I am not very familiar
> with F77, so I thought I would ask here if this is a bug in gfortran.
>
> Consider the attached code (test case is reduced as much as possible)
>
> $g77 -c test_file.f
>
> $gfortran -c test_file.f
> test_file.f:4.20:
>
> print *, 'Try one of "Skip", "Test", "Verbosity" or "Cleanup"
> 1
> Error: Unterminated character constant beginning at (1)
>
In such cases it helps to use -Wall; the last warning is the important one,
$ gfortran -Wall aaa.f
Warning: Nonconforming tab character in column 1 of line 1
Warning: Nonconforming tab character in column 1 of line 2
Warning: Nonconforming tab character in column 1 of line 3
Warning: Nonconforming tab character in column 1 of line 4
Warning: Nonconforming tab character in column 1 of line 6
aaa.f:4.20:
print *, 'Try one of "Skip", "Test", "Verbosity" or "Cleanup"
1
Error: Unterminated character constant beginning at (1)
aaa.f:4.72:
print *, 'Try one of "Skip", "Test", "Verbosity" or "Cleanup"
1
Warning: Line truncated at (1)
Fixed-form Fortran has only 72 characters per line. What happens with
longer lines is implementation dependent. However, many
programmers/programs assume that everything after column 72 is ignored
(which gfortran does).
Solution: Fix the program by splitting the line or by using the
-ffixed-line-length-n (n is a non-negative integer).
For that example program I would simply remove the space in "*, 'Try".
Tobias