Bug 25106 - [4.0/4.1] statement label is zero
Summary: [4.0/4.1] statement label is zero
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: 4.1.0
Assignee: kargls
URL:
Keywords: patch
: 20855 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-11-26 18:10 UTC by Joost VandeVondele
Modified: 2005-12-31 19:05 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.0
Known to fail:
Last reconfirmed: 2005-11-28 05:08:48


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2005-11-26 18:10:43 UTC
using GNU Fortran 95 (GCC) 4.1.0 20051126 (prerelease)  with '-g -pedantic -std=f95', I get a bad / no diagnostic for the following invalid code:

0 CONTINUE
END
Comment 1 kargls 2005-11-27 05:49:14 UTC
I have a tentative patch for this.
Comment 2 Andrew Pinski 2005-11-28 05:08:48 UTC
Confirmed.
Comment 3 Francois-Xavier Coudert 2005-12-03 15:32:08 UTC
Subject: Bug 25106

Author: fxcoudert
Date: Sat Dec  3 15:32:04 2005
New Revision: 107999

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107999
Log:
	PR fortran/25106
	* parse.c (next_free): Use new prototype for gfc_match_st_label.
	Correctly emit hard error if a label is zero.
	* match.c (gfc_match_st_label): Never allow zero as a valid
	label.
	(gfc_match, gfc_match_do, gfc_match_goto): Use new prototype for
	gfc_match_st_label.
	* primary.c (): Use new prototype for gfc_match_st_label.
	* io.c (): Likewise.
	* match.h: Likewise.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/match.h
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/primary.c

Comment 4 Francois-Xavier Coudert 2005-12-03 15:33:16 UTC
Patch commited to mainline, waiting some time before commiting to 4.1.
Comment 5 kargls 2005-12-11 16:47:25 UTC
http://gcc.gnu.org/ml/fortran/2005-12/msg00215.html

This patch changes the handling of labels to catch
problems with too many digits from laeding zeros.
Comment 6 kargls 2005-12-16 23:32:38 UTC
Subject: Bug 25106

Author: kargl
Date: Fri Dec 16 23:32:29 2005
New Revision: 108692

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108692
Log:
2005-12-10  Steven G. Kargl <kargls@comcast.net>
 
        PR fortran/25106
        PR fortran/25055
        * match.c (gfc_match_small_literal_int): Add cnt argument;
        (gfc_match_st_label,gfc_match_stopcode): Account for cnt argument.
        * match.h (gfc_match_small_literal_int): Update prototype.
        * decl.c (match_char_length,gfc_match_old_kind_spec): Account for cnt.
        * parse.c (next_free): Ditto.
        * primary.c (match_kind_param): Ditto.

        gfortran.dg/label_1.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/label_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/match.h
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/primary.c
    trunk/gcc/testsuite/ChangeLog

Comment 7 Andrew Pinski 2005-12-30 19:32:44 UTC
*** Bug 20855 has been marked as a duplicate of this bug. ***
Comment 8 kargls 2005-12-31 18:55:35 UTC
Subject: Bug 25106

Author: kargl
Date: Sat Dec 31 18:55:30 2005
New Revision: 109199

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109199
Log:
2005-12-31  Steven G. Kargl <kargls@comcast.net>

    PR fortran/25106
    PR fortran/25055
    * io.c (match_dt_format): Remove second arg in gfc_match_st_label.
    * match.c (gfc_match_small_literal_int): Add cnt argument;
    (gfc_match_st_label,gfc_match_stopcode): Account for cnt argument.
    (gfc_match_st_label): Remove allow_zero (second argument), and use 
    cnt for errors. 
    (gfc_match_do,gfc_match_goto):  Remove second arg in gfc_match_st_label
    * match.h (gfc_match_small_literal_int,gfc_match_st_label):
    Update prototypes.
    * decl.c (match_char_length,gfc_match_old_kind_spec): Account for cnt.
    * parse.c (next_free): Account for cnt; Remove second arg in 
    gfc_match_st_label
    * primary.c (match_kind_param): Ditto.


    PR fortran/25106
    PR fortran/25055
    * gfortran.dg/label_1.f90: New test.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/label_1.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/decl.c
    branches/gcc-4_1-branch/gcc/fortran/io.c
    branches/gcc-4_1-branch/gcc/fortran/match.c
    branches/gcc-4_1-branch/gcc/fortran/match.h
    branches/gcc-4_1-branch/gcc/fortran/parse.c
    branches/gcc-4_1-branch/gcc/fortran/primary.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 9 kargls 2005-12-31 19:05:37 UTC
Fixed in 4.1 and trunk.  This will not be fixed (by me)
in 4.0.