public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31818]  New: Wrongly accepts namelists with assumed-sized arrays
@ 2007-05-04 16:52 burnus at gcc dot gnu dot org
  2007-05-05  8:53 ` [Bug fortran/31818] " pault at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-05-04 16:52 UTC (permalink / raw)
  To: gcc-bugs

subroutine test(cha)
  implicit none
  character(len=10) :: cha(:)
  namelist /z/  cha
end subroutine test

See also:
  gfortran.dg/namelist_14.f90

This is invalid:
"5.4 NAMELIST statement"
"C574 (R553) A namelist-group-object shall not be an assumed-size array."

Other compilers reject this:

ifort:  A NAMELIST group object must not be an array with nonconstant bounds.
[CHA]
g95:  Variable 'cha' at (1) must have an explicit shape to be in a NAMELIST
NAG f95: Namelist-group-object CHA is an array dummy with non-constant bounds


-- 
           Summary: Wrongly accepts namelists with assumed-sized arrays
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31818


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/31818] Wrongly accepts namelists with assumed-sized arrays
  2007-05-04 16:52 [Bug fortran/31818] New: Wrongly accepts namelists with assumed-sized arrays burnus at gcc dot gnu dot org
@ 2007-05-05  8:53 ` pault at gcc dot gnu dot org
  2007-07-24 13:49 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-05-05  8:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pault at gcc dot gnu dot org  2007-05-05 09:53 -------
(In reply to comment #0)
> subroutine test(cha)
>   implicit none
>   character(len=10) :: cha(:)
>   namelist /z/  cha
> end subroutine test
> 
> See also:
>   gfortran.dg/namelist_14.f90
> 
> This is invalid:
> "5.4 NAMELIST statement"
> "C574 (R553) A namelist-group-object shall not be an assumed-size array."

Tobius,

That's an assumed shape array:) However,

Constraint:A namelist-group-object shall not be an array dummy argument with a
nonconstant bound, a variable with nonconstant character length, an automatic
object, a pointer, a variable of a type that has an ultimate component that is
a pointer, or an allocatable array.

Hence the error messages of the other products.

I have to confess that I thought that we had fixed this but, apparently, I was
wrong.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-05-05 09:53:20
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31818


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/31818] Wrongly accepts namelists with assumed-sized arrays
  2007-05-04 16:52 [Bug fortran/31818] New: Wrongly accepts namelists with assumed-sized arrays burnus at gcc dot gnu dot org
  2007-05-05  8:53 ` [Bug fortran/31818] " pault at gcc dot gnu dot org
@ 2007-07-24 13:49 ` burnus at gcc dot gnu dot org
  2007-07-25 22:09 ` dfranke at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-24 13:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-07-24 13:49 -------
Index: resolve.c
===================================================================
--- resolve.c   (revision 126873)
+++ resolve.c   (working copy)
@@ -7040,6 +7044,13 @@ resolve_fl_namelist (gfc_symbol *sym)
   /* Reject namelist arrays that are not constant shape.  */
   for (nl = sym->namelist; nl; nl = nl->next)
     {
+      if (nl->sym->as->type != AS_EXPLICIT)
+       {
+         gfc_error ("Variable '%s' at %L must have an explicit shape to "
+                    "be in a NAMELIST", nl->sym->name, &sym->declared_at);
+         return FAILURE;
+       }
+
       if (is_non_constant_shape_array (nl->sym))
        {
          gfc_error ("The array '%s' must have constant shape to be "


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31818


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/31818] Wrongly accepts namelists with assumed-sized arrays
  2007-05-04 16:52 [Bug fortran/31818] New: Wrongly accepts namelists with assumed-sized arrays burnus at gcc dot gnu dot org
  2007-05-05  8:53 ` [Bug fortran/31818] " pault at gcc dot gnu dot org
  2007-07-24 13:49 ` burnus at gcc dot gnu dot org
@ 2007-07-25 22:09 ` dfranke at gcc dot gnu dot org
  2007-07-26 22:16 ` [Bug fortran/31818] Wrongly accepts namelists with assumed-shape arrays dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-25 22:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2007-07-25 22:09 -------
One should think, this code whould pick it up?!

  /* Reject namelist arrays that are not constant shape.  */
  for (nl = sym->namelist; nl; nl = nl->next)
    {
      if (is_non_constant_shape_array (nl->sym))
        {
          gfc_error ("The array '%s' must have constant shape to be "
                     "a NAMELIST object at %L", nl->sym->name,
                     &sym->declared_at);
          return FAILURE;
        }
    }


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31818


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/31818] Wrongly accepts namelists with assumed-shape arrays
  2007-05-04 16:52 [Bug fortran/31818] New: Wrongly accepts namelists with assumed-sized arrays burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-07-25 22:09 ` dfranke at gcc dot gnu dot org
@ 2007-07-26 22:16 ` dfranke at gcc dot gnu dot org
  2007-07-27 20:27 ` dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-26 22:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dfranke at gcc dot gnu dot org  2007-07-26 22:16 -------
Currently fighting namelists ...


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dfranke at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-05-05 09:53:20         |2007-07-26 22:16:35
               date|                            |
            Summary|Wrongly accepts namelists   |Wrongly accepts namelists
                   |with assumed-sized arrays   |with assumed-shape arrays


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31818


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/31818] Wrongly accepts namelists with assumed-shape arrays
  2007-05-04 16:52 [Bug fortran/31818] New: Wrongly accepts namelists with assumed-sized arrays burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-07-26 22:16 ` [Bug fortran/31818] Wrongly accepts namelists with assumed-shape arrays dfranke at gcc dot gnu dot org
@ 2007-07-27 20:27 ` dfranke at gcc dot gnu dot org
  2007-07-28  8:51 ` dfranke at gcc dot gnu dot org
  2007-07-28  8:52 ` dfranke at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-27 20:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dfranke at gcc dot gnu dot org  2007-07-27 20:27 -------
Try this testcase instead ...

subroutine test(cha)
  implicit none
  character(len=10) :: cha(1:)       ! added lower-bound
  namelist /z/  cha
end subroutine test


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31818


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/31818] Wrongly accepts namelists with assumed-shape arrays
  2007-05-04 16:52 [Bug fortran/31818] New: Wrongly accepts namelists with assumed-sized arrays burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-07-27 20:27 ` dfranke at gcc dot gnu dot org
@ 2007-07-28  8:51 ` dfranke at gcc dot gnu dot org
  2007-07-28  8:52 ` dfranke at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-28  8:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dfranke at gcc dot gnu dot org  2007-07-28 08:51 -------
Subject: Bug 31818

Author: dfranke
Date: Sat Jul 28 08:51:06 2007
New Revision: 127014

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127014
Log:
gcc/fortran:
2007-07-28  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/31818
        PR fortran/32876
        PR fortran/32905
        * gfortran.h (symbol_attribute): Added bits for pointer_comp,
private_comp.
        * parse.c (parse_derived): Set pointer_comp/private_comp bits if the
derived
        type ultimately contains pointer components or private components.
        * module.c (ab_attribute): New values AB_POINTER_COMP, AB_PRIVATE_COMP.
        (attr_bits): Added names for new ab_attributes.
        (mio_symbol_attribute): Save/restore new attribute bits in modules.
        * match.c (gfc_match_namelist): Removed check for namelist objects of
assumed
        shape.
        * resolve.c (resolve_fl_namelist): Added check for pointer or private
        components in nested types. Added check for namelist objects of assumed
        shape.

gcc/testsuite:
2007-07-28  Daniel Franke  <franke.daniel@gmail.com>

        * gfortran.dg/namelist_5.f90: Adjusted error message.
        * gfortran.dg/assumed_shape_nml.f90: Renamed to ...
        * gfortran.dg/namelist_31.f90: ... this. Removed dg-warning directive.
        * gfortran.dg/assumed_size_nml.f90: Renamed to ...
        * gfortran.dg/namelist_32.f90: ... this.

        PR fortran/32876
        * gfortran.dg/namelist_33.f90: New test.

        PR fortran/32905
        * gfortran.dg/namelist_34.f90: New test.

        PR fortran/31818
        * gfortran.dg/namelist_35.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/namelist_31.f90
      - copied, changed from r126930,
trunk/gcc/testsuite/gfortran.dg/assumed_shape_nml.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_32.f90
      - copied unchanged from r126930,
trunk/gcc/testsuite/gfortran.dg/assumed_size_nml.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_33.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_34.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_35.f90
Removed:
    trunk/gcc/testsuite/gfortran.dg/assumed_shape_nml.f90
    trunk/gcc/testsuite/gfortran.dg/assumed_size_nml.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/module.c
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/namelist_5.f90


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31818


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/31818] Wrongly accepts namelists with assumed-shape arrays
  2007-05-04 16:52 [Bug fortran/31818] New: Wrongly accepts namelists with assumed-sized arrays burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-07-28  8:51 ` dfranke at gcc dot gnu dot org
@ 2007-07-28  8:52 ` dfranke at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-28  8:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dfranke at gcc dot gnu dot org  2007-07-28 08:52 -------
Fixed in trunk. Closing.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2007-
                   |                            |07/msg02016.html
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31818


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-07-28  8:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-04 16:52 [Bug fortran/31818] New: Wrongly accepts namelists with assumed-sized arrays burnus at gcc dot gnu dot org
2007-05-05  8:53 ` [Bug fortran/31818] " pault at gcc dot gnu dot org
2007-07-24 13:49 ` burnus at gcc dot gnu dot org
2007-07-25 22:09 ` dfranke at gcc dot gnu dot org
2007-07-26 22:16 ` [Bug fortran/31818] Wrongly accepts namelists with assumed-shape arrays dfranke at gcc dot gnu dot org
2007-07-27 20:27 ` dfranke at gcc dot gnu dot org
2007-07-28  8:51 ` dfranke at gcc dot gnu dot org
2007-07-28  8:52 ` dfranke at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).