User account creation filtered due to spam.

Bug 21565 - namelist in block data is illegal
Summary: namelist in block data is illegal
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.0.3
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, diagnostic
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2005-05-14 08:50 UTC by Thomas Koenig
Modified: 2005-11-10 02:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-30 05:22:15


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2005-05-14 08:50:39 UTC
gfortran falsely accepts a namelist in a block
data:

$ cat block_d.f
      block data
      common /foo/ a
      namelist /foo_n/ a
      data a /1.0/
      end
$ gfortran -S block_d.f
$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1/configure --prefix=/home/ig25 --enable-languages=c,f95
Thread model: posix
gcc version 4.1.0 20050508 (experimental)

g77 correctly rejects it, although with a confusing error message:

$ g77 -S block_d.f
block_d.f: In block-data unit `_BLOCK_DATA__':
block_d.f:2:
         common /foo/ a
         1
block_d.f:3: (continued):
         namelist /foo_n/ a
         2
Statement at (2) invalid in context established by statement at (1)
Comment 1 Tobias Schlüter 2005-05-19 16:25:06 UTC
See the second constraint in 11.4 (f95 draft)
Comment 2 Paul Thomas 2005-11-01 05:53:34 UTC
Subject: Bug 21565

Author: pault
Date: Tue Nov  1 05:53:29 2005
New Revision: 106317

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106317
Log:
2005-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/21565
	* symbol.c (check_conflict): An object cannot be in a namelist and in
	block data.

	PR fortran/18737
	* resolve.c (resolve_symbol): Set the error flag to
	gfc_set_default_type, in the case of an external symbol, so that
	an error message is emitted if IMPLICIT NONE is set.

	PR fortran/14994
	* gfortran.h (gfc_generic_isym_id): Add GFC_ISYM_SECNDS to enum.
	* check.c (gfc_check_secnds): New function.
	* intrinsic.c (add_functions): Add call to secnds.
	* iresolve.c (gfc_resolve_secnds): New function.
	* trans-intrinsic (gfc_conv_intrinsic_function): Add call to
	secnds via case GFC_ISYM_SECNDS.
	* intrinsic.texi: Add documentation for secnds.

2005-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/14994
	* libgfortran/intrinsics/date_and_time.c: Add interface to
	the functions date_and_time for the intrinsic function secnds.

2005-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/21565
	gfortran.dg/namelist_blockdata.f90: New test.

	PR fortran/18737
	gfortran.dg/external_implicit_none.f90: New test.

	PR fortran/14994
	* gfortran.dg/secnds.f: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/external_implicit_none.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_blockdata.f
    trunk/gcc/testsuite/gfortran.dg/secnds.f
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.h
    trunk/gcc/fortran/intrinsic.texi
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/date_and_time.c

Comment 3 Paul Thomas 2005-11-01 12:15:23 UTC
Subject: Bug 21565

Author: pault
Date: Tue Nov  1 12:15:07 2005
New Revision: 106326

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106326
Log:
2005-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/21565
	* symbol.c (check_conflict): An object cannot be in a namelist and in
	block data.

	PR fortran/18737
	* resolve.c (resolve_symbol): Set the error flag to
	gfc_set_default_type, in the case of an external symbol, so that
	an error message is emitted if IMPLICIT NONE is set.

	PR fortran/14994
	* gfortran.h (gfc_generic_isym_id): Add GFC_ISYM_SECNDS to enum.
	* check.c (gfc_check_secnds): New function.
	* intrinsic.c (add_functions): Add call to secnds.
	* iresolve.c (gfc_resolve_secnds): New function.
	* trans-intrinsic (gfc_conv_intrinsic_function): Add call to
	secnds via case GFC_ISYM_SECNDS.
	* intrinsic.texi: Add documentation for secnds.

2005-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/14994
	* libgfortran/intrinsics/date_and_time.c: Add interface to
	the functions date_and_time for the intrinsic function secnds.

2005-11-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/21565
	gfortran.dg/namelist_blockdata.f90: New test.

	PR fortran/18737
	gfortran.dg/external_implicit_none.f90: New test.

	PR fortran/14994
	* gfortran.dg/secnds.f: New test.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/external_implicit_none.f90
    branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/namelist_blockdata.f
    branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/secnds.f
Modified:
    branches/gcc-4_0-branch/gcc/fortran/ChangeLog
    branches/gcc-4_0-branch/gcc/fortran/check.c
    branches/gcc-4_0-branch/gcc/fortran/gfortran.h
    branches/gcc-4_0-branch/gcc/fortran/intrinsic.c
    branches/gcc-4_0-branch/gcc/fortran/intrinsic.h
    branches/gcc-4_0-branch/gcc/fortran/intrinsic.texi
    branches/gcc-4_0-branch/gcc/fortran/iresolve.c
    branches/gcc-4_0-branch/gcc/fortran/resolve.c
    branches/gcc-4_0-branch/gcc/fortran/symbol.c
    branches/gcc-4_0-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_0-branch/libgfortran/ChangeLog
    branches/gcc-4_0-branch/libgfortran/intrinsics/date_and_time.c

Comment 4 Paul Thomas 2005-11-01 13:04:49 UTC
Fixed on mainline and 4.0