Bug 66707 - Endless compilation on wrong usage of common
Summary: Endless compilation on wrong usage of common
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 5.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-30 16:42 UTC by Gerhard Steinmetz
Modified: 2016-01-30 21:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-09-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Steinmetz 2015-06-30 16:42:28 UTC
After printing some correct and helpful error messages,
compilation of the following snippets (wrong code) will not end.
Tested with gfortran 5.1.1, 4.9.0, 4.8.3 (on SUSE Linux 13.2, 64 bit).


$ cat zlctc_1.f90
program p
   c = 1
   common // c
   common // c
end


$ cat zlctc_2.f90
program p
   integer, pointer :: a
   common a, a
   common a
end


$ cat zlctc_3.f90
program p
   integer, pointer :: a
   common a => null()
   common a => null()
end


$ time gfortran zlctc_1.f90
zlctc_1.f90:3.14:

   common // c
              1
Error: Unexpected COMMON statement at (1)
zlctc_1.f90:4.14:

   common // c
              1
Error: Unexpected COMMON statement at (1)

# ^C after a few minutes
Comment 1 Dominique d'Humieres 2015-09-10 09:09:04 UTC
Confirmed with 4.9.3 and 5.2. This seems to have been fixed on trunk between revision r226476 (2015-08-02, endless compilation) and r227016 (2015-08-19, tests compiled in a fraction of second).
Comment 2 Dominique d'Humieres 2015-11-19 08:37:04 UTC
> Confirmed with 4.9.3 and 5.2. This seems to have been fixed on trunk between
> revision r226476 (2015-08-02, endless compilation) and r227016 (2015-08-19,
> tests compiled in a fraction of second).

Can someone confirms that the tests compile on recent trunk (post r227016)? A finer range would be nice too!
Comment 3 Dominique d'Humieres 2016-01-25 16:31:17 UTC
> > Confirmed with 4.9.3 and 5.2. This seems to have been fixed on trunk between
> > revision r226476 (2015-08-02, endless compilation) and r227016 (2015-08-19,
> > tests compiled in a fraction of second).
>
> Can someone confirms that the tests compile on recent trunk (post r227016)?
> A finer range would be nice too!

Back porting r226732 to the gcc5 branch "fixes" the issue.
Comment 4 dominiq 2016-01-30 14:07:51 UTC
Author: dominiq
Date: Sat Jan 30 14:07:19 2016
New Revision: 233008

URL: https://gcc.gnu.org/viewcvs?rev=233008&root=gcc&view=rev
Log:
2016-01-30  Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR fortran/66707
	gfortran.dg/common_23.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/common_23.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 5 dominiq 2016-01-30 17:14:01 UTC
Author: dominiq
Date: Sat Jan 30 17:13:29 2016
New Revision: 233009

URL: https://gcc.gnu.org/viewcvs?rev=233009&root=gcc&view=rev
Log:
2016-01-30  Bud Davis  <jmdavis@link.com>
	    Mikael Morin  <mikael@gcc.gnu.org>

	Backport from trunk.
	PR fortran/59746
	* symbol.c (gfc_restore_last_undo_checkpoint): Delete
	a common block symbol if it was put in the list.

2016-01-30  Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR fortran/66707
	gfortran.dg/common_23.f90: New test.

	Backport from trunk.
	2015-08-08  Bud Davis  <jmdavis@link.com>
		    Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/59746
	* gfortran.dg/common_22.f90: New.


Added:
    branches/gcc-5-branch/gcc/testsuite/gfortran.dg/common_22.f90
    branches/gcc-5-branch/gcc/testsuite/gfortran.dg/common_23.f90
Modified:
    branches/gcc-5-branch/gcc/fortran/ChangeLog
    branches/gcc-5-branch/gcc/fortran/symbol.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
Comment 6 Dominique d'Humieres 2016-01-30 21:55:50 UTC
Closing as FIXED.