Bug 21302 - Max line length in free form mode
Summary: Max line length in free form mode
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 enhancement
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-30 19:27 UTC by Andrew Pinski
Modified: 2005-12-02 00:57 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-08 03:07:35


Attachments
allow -ffixed-line-length in free form (521 bytes, patch)
2005-08-08 08:35 UTC, Bernhard Fischer
Details | Diff
add -ffree-line-length-none -ffree-line-length-<n> (2.19 KB, patch)
2005-11-09 21:58 UTC, Bernhard Fischer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-04-30 19:27:02 UTC
I don't know if this is not a bug but I found this will looking into 21300, take the following Fortran free 
formed code:
 if 
(abs(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).gt.999.d0.or.abs(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb).gt.99
9.d0.or.abs(cccccccccccccccccccc).gt.999.d0) THEN
endif
 
 end program

Note the if is all on the same line.
We get an error (and a warning with -Wline-truncation) but I don't think free form should have a line 
lenght limit.
Comment 1 kargls 2005-05-01 18:05:44 UTC
(In reply to comment #0)
> We get an error (and a warning with -Wline-truncation) but I don't think
> free form should have a line lenght limit.

See 3.3.1 from the Standard.  "In free source form, each source line may 
contain fomr zero to 132 characters and there are restrictions on where
a statement (or portion of a statement) may appear within a line"

I suppose we could implement a -fline-length=N type option.

Comment 2 Andrew Pinski 2005-05-01 18:47:53 UTC
(In reply to comment #1)
> I suppose we could implement a -fline-length=N type option.

Then lets call this an enhancement  but note it blocks compiling OrbFit which works on XLF, Intel's and 
others.
Comment 3 Tobias Schlüter 2005-05-11 23:05:22 UTC
Actually, we already have this, but only for fixed form.  It should be no
problem to generalize this to free form as well.
Comment 4 Bernhard Fischer 2005-08-08 08:35:31 UTC
Created attachment 9444 [details]
allow -ffixed-line-length in free form

Is it ok to reuse -ffixed-line-length instead of introducing a new
-fline-length or should -ffixed-line-length be renamed to -fline-length and
-ffixed-line-length be made an alias for the then newly introduced
-fline-length ?
Comment 5 Bernhard Fischer 2005-08-08 14:33:14 UTC
Comment on attachment 9444 [details]
allow -ffixed-line-length in free form

correct description: it's about free form, not fixed form.
Comment 6 Bernhard Fischer 2005-11-09 21:58:00 UTC
Created attachment 10199 [details]
add -ffree-line-length-none -ffree-line-length-<n>

http://gcc.gnu.org/ml/fortran/2005-10/msg00559.html

2005-09-11 Bernhard Fischer <rep.nop@aon.at>

        PR fortran/21302
        * lang.opt: New options -ffree-line-length- and -ffree-line-length-none.
        * gfortran.h: Add free_line_length.
        * c-opts.c (c_common_handle_option): Ignore OPT_ffree_form and
        OPT_ffree_line_length_ when preprocessing.
        * options.c (gfc_init_options, gfc_handle_option): Initialize
        and set free_line_length and fixed_line_length.
        * scanner.c (load_line): Set free_line_length to 132 and
        fixed_line_length to 72 or user requested values. A line either
        starts with '#' thus is a preprocessor-line or is an include, so
        use "else".
        * scanner.c: Typo in comment.
        * invoke.texi: Document -ffree-line-length- and
        -ffree-line-length-none
Comment 7 Bernhard Fischer 2005-11-20 20:13:45 UTC
updated patch:
http://gcc.gnu.org/ml/fortran/2005-11/msg00551.html
Comment 8 Bernhard Fischer 2005-11-25 19:02:54 UTC
updated patch:

http://gcc.gnu.org/ml/fortran/2005-11/msg00612.html

ACK by stevenb:
http://gcc.gnu.org/ml/fortran/2005-11/msg00631.html
Comment 9 Bernhard Fischer 2005-11-27 14:46:27 UTC
(In reply to comment #8)
> updated patch:
> 
> http://gcc.gnu.org/ml/fortran/2005-11/msg00612.html
> 
> ACK by stevenb:
> http://gcc.gnu.org/ml/fortran/2005-11/msg00631.html
> 
And each a testcase for -ffree-line-length-none and -ffixed-line-length-none here:
http://gcc.gnu.org/ml/fortran/2005-11/msg00676.html

Please apply,
thank you
Comment 10 kargls 2005-11-30 23:57:48 UTC
Subject: Bug 21302

Author: kargl
Date: Wed Nov 30 23:57:44 2005
New Revision: 107745

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107745
Log:
2005-11-30  Bernhard Fischer <rep.nop@aon.at>
	PR fortran/21302
	* lang.opt: New options -ffree-line-length- and -ffree-line-length-none.
	* gfortran.h: Add free_line_length and add description of
	free_line_length and fixed_line_length.
	* options.c (gfc_init_options, gfc_handle_option): Initialize
	and set free_line_length and fixed_line_length.
	* scanner.c (load_line): Set free_line_length to 132 and
	fixed_line_length to 72 or user requested values.
	* scanner.c: Typo in comment.
	* invoke.texi: Document -ffree-line-length- and
	-ffree-line-length-none

	gfortran.dg/line_length_1.f: New test:
	gfortran.dg/line_length_2.f90: Ditto.

Added:
    trunk/gcc/testsuite/gfortran.dg/line_length_1.f
    trunk/gcc/testsuite/gfortran.dg/line_length_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/options.c
    trunk/gcc/fortran/scanner.c
    trunk/gcc/testsuite/ChangeLog

Comment 11 kargls 2005-12-02 00:35:47 UTC
Subject: Bug 21302

Author: kargl
Date: Fri Dec  2 00:35:41 2005
New Revision: 107850

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107850
Log:
	PR fortran/21302
	* lang.opt: New options -ffree-line-length- and -ffree-line-length-none.
	* gfortran.h: Add free_line_length and add description of
	free_line_length and fixed_line_length.
	* options.c (gfc_init_options, gfc_handle_option): Initialize
	and set free_line_length and fixed_line_length.
	* scanner.c (load_line): Set free_line_length to 132 and
	fixed_line_length to 72 or user requested values.
	* scanner.c: Typo in comment.
	* invoke.texi: Document -ffree-line-length- and
	-ffree-line-length-none

	PR fortran/21302
	* gfortran.dg/line_length_1.f: New test.
	* gfortran.dg/line_length_2.f90: Ditto.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/line_length_1.f
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/line_length_2.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/gfortran.h
    branches/gcc-4_1-branch/gcc/fortran/invoke.texi
    branches/gcc-4_1-branch/gcc/fortran/lang.opt
    branches/gcc-4_1-branch/gcc/fortran/options.c
    branches/gcc-4_1-branch/gcc/fortran/scanner.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 12 kargls 2005-12-02 00:57:46 UTC
Fixed.