public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32928]  New: DATA statement with array element as initializer is rejected
@ 2007-07-28 13:20 burnus at gcc dot gnu dot org
  2007-07-28 13:30 ` [Bug fortran/32928] " burnus at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-28 13:20 UTC (permalink / raw)
  To: gcc-bugs

Found while debugging PR32315.

program chkdata
    character(len=1), parameter,dimension(4) :: string = 'A'
    character :: a
    data a /string(4)/
end program chkdata

Is rejected:
    data a /string(4)/
                 1
Error: Syntax error in DATA statement at (1)

However, g95, NAG f95, ifort, openf95 accept it.

Note that
   data a /string(5)/
should be rejected:
   First subscript (5) is greater than upper bound (4) for array STRING


-- 
           Summary: DATA statement with array element as initializer is
                    rejected
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid, 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=32928


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
@ 2007-07-28 13:30 ` burnus at gcc dot gnu dot org
  2007-07-28 14:01 ` burnus at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-28 13:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-07-28 13:29 -------
The problem seems to be that in decl.c the var_element() function assumes that
it only has to match a variable and not also, e.g., an array element.


-- 


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
  2007-07-28 13:30 ` [Bug fortran/32928] " burnus at gcc dot gnu dot org
@ 2007-07-28 14:01 ` burnus at gcc dot gnu dot org
  2007-08-15 11:52 ` fxcoudert at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-28 14:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-07-28 14:00 -------
R532 data-stmt-constant is scalar-constant
                        or scalar-constant-subobject
                        or signed-int-literal-constant
                        or signed-real-literal-constant
                        or null-init
                        or structure-constructor

I think this also allows for substrings.


-- 


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
  2007-07-28 13:30 ` [Bug fortran/32928] " burnus at gcc dot gnu dot org
  2007-07-28 14:01 ` burnus at gcc dot gnu dot org
@ 2007-08-15 11:52 ` fxcoudert at gcc dot gnu dot org
  2007-08-26  1:55 ` jvdelisle at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-15 11:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert 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-08-15 11:52:48
               date|                            |


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-08-15 11:52 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-26  1:55 ` jvdelisle at gcc dot gnu dot org
  2007-08-29 19:20 ` pault at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-08-26  1:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2007-08-26 01:55 -------
I am going to try this one.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-08-15 11:52:48         |2007-08-26 01:55:25
               date|                            |


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-08-26  1:55 ` jvdelisle at gcc dot gnu dot org
@ 2007-08-29 19:20 ` pault at gcc dot gnu dot org
  2007-10-03  4:51 ` jvdelisle at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-08-29 19:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2007-08-29 19:19 -------
(In reply to comment #3)
> I am going to try this one.
> 
Jerry,

This fixes it but I do not understand why it is necessary; nor have I
regtested.  It's yours - I am going to tackle "spanned" pointers next, in the
hope of getting it into 4.3.0

Paul


-- 


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-08-29 19:20 ` pault at gcc dot gnu dot org
@ 2007-10-03  4:51 ` jvdelisle at gcc dot gnu dot org
  2007-10-04 23:27 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-10-03  4:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2007-10-03 04:51 -------
I think the problem here is that in match_data_constant we never even attempt
to match the array specification.  Using gfc_match_array_spec or
gfc_match_array_ref I can successfully match and get the information.  Now I
just need to figure out what to do with it. :)


-- 


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-10-03  4:51 ` jvdelisle at gcc dot gnu dot org
@ 2007-10-04 23:27 ` jvdelisle at gcc dot gnu dot org
  2007-10-04 23:32 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-10-04 23:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2007-10-04 23:27 -------
Created an attachment (id=14298)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14298&action=view)
Rough draft patch

Here is a first cut at a patch.  It does not successfully get the assignment to
the integer 'a' in the test case correct.  However, the test case compiles
without error and it is matching the array parameter qualifiers correctly.

I am stuck at this point, so suggestions/help appreciated.




-- 


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-10-04 23:27 ` jvdelisle at gcc dot gnu dot org
@ 2007-10-04 23:32 ` jvdelisle at gcc dot gnu dot org
  2007-11-28  1:02 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-10-04 23:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jvdelisle at gcc dot gnu dot org  2007-10-04 23:32 -------
Note on comment #6 :  I used the following simpler test case using INTEGER
rather than the original test case which uses CHARACTER.  The CHARACTER case
does not compile at all.

program chkdata
    integer, parameter,dimension(4) :: string = 5
    integer :: a
    data a / string(4) /
    print *, a
end program chkdata


-- 


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-10-04 23:32 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-28  1:02 ` jvdelisle at gcc dot gnu dot org
  2007-11-28  1:12 ` jvdelisle at gcc dot gnu dot org
  2007-11-28  1:15 ` jvdelisle at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-28  1:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2007-11-28 01:02 -------
Subject: Bug 32928

Author: jvdelisle
Date: Wed Nov 28 01:02:36 2007
New Revision: 130484

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130484
Log:
2007-11-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR fortran/32928
        * decl.c (match_data_constant): Use gfc_match_init_expr to match the
        array spec and set the initializer expression.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c


-- 


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2007-11-28  1:02 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-28  1:12 ` jvdelisle at gcc dot gnu dot org
  2007-11-28  1:15 ` jvdelisle at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-28  1:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2007-11-28 01:12 -------
Subject: Bug 32928

Author: jvdelisle
Date: Wed Nov 28 01:12:31 2007
New Revision: 130487

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130487
Log:
2007-11-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR fortran/32928
        * gfortran.dg/data_array_1.f90
        * gfortran.dg/data_array_2.f90
        * gfortran.dg/data_array_3.f90
        * gfortran.dg/data_array_4.f90

Added:
    trunk/gcc/testsuite/gfortran.dg/data_array_1.f90
    trunk/gcc/testsuite/gfortran.dg/data_array_2.f90
    trunk/gcc/testsuite/gfortran.dg/data_array_3.f90
    trunk/gcc/testsuite/gfortran.dg/data_array_4.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32928] DATA statement with array element as initializer is rejected
  2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2007-11-28  1:12 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-28  1:15 ` jvdelisle at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-28  1:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jvdelisle at gcc dot gnu dot org  2007-11-28 01:15 -------
Fixed on trunk.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-11-28  1:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-28 13:20 [Bug fortran/32928] New: DATA statement with array element as initializer is rejected burnus at gcc dot gnu dot org
2007-07-28 13:30 ` [Bug fortran/32928] " burnus at gcc dot gnu dot org
2007-07-28 14:01 ` burnus at gcc dot gnu dot org
2007-08-15 11:52 ` fxcoudert at gcc dot gnu dot org
2007-08-26  1:55 ` jvdelisle at gcc dot gnu dot org
2007-08-29 19:20 ` pault at gcc dot gnu dot org
2007-10-03  4:51 ` jvdelisle at gcc dot gnu dot org
2007-10-04 23:27 ` jvdelisle at gcc dot gnu dot org
2007-10-04 23:32 ` jvdelisle at gcc dot gnu dot org
2007-11-28  1:02 ` jvdelisle at gcc dot gnu dot org
2007-11-28  1:12 ` jvdelisle at gcc dot gnu dot org
2007-11-28  1:15 ` jvdelisle 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).