public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30792]  New: DATA implied-do substring allowed with -std=f95/f2003
@ 2007-02-14 10:04 burnus at gcc dot gnu dot org
  2007-04-18  6:17 ` [Bug fortran/30792] " fxcoudert at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-14 10:04 UTC (permalink / raw)
  To: gcc-bugs

The following mini program gives an error in other compilers, but not in
gfortran, we should check whether we need to give an error as well.

Cf.
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/1cb58e9fed576fbe

---------------------------
CHARACTER string*1025
INTEGER i
DATA (string(i:i),i=1,1025)/1025*'?'/ 
end
---------------------------

$ g95 foo1.f90
In file foo1.f90:3
DATA (string(i:i),i=1,1025)/1025*'?'/
      1
Error: DATA element inside iterator at (1) must be an array element or a scalar
structure component

$ f95 foo1.f90  # NAG
f95 foo1.f90
Error: foo1.f90, line 3: Substring in data-implied-do
       detected at )@,

$ sunf95 foo1.f90
DATA (string(i:i),i=1,1025)/1025*'?'/
            ^
"foo1.f90", Line = 3, Column = 13: ERROR: A DATA implied-DO target must be an
array element or scalar structure component reference.

(It is accepted with "ifort -stand f95 -warn all".)


At a glance, I cannot find this restriction in the Fortran 2003 standard.
We should also check the corrigenda and F95+corrigenda.
http://gcc.gnu.org/wiki/GFortranStandards


-- 
           Summary: DATA implied-do substring allowed with -std=f95/f2003
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          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=30792


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

* [Bug fortran/30792] DATA implied-do substring allowed with -std=f95/f2003
  2007-02-14 10:04 [Bug fortran/30792] New: DATA implied-do substring allowed with -std=f95/f2003 burnus at gcc dot gnu dot org
@ 2007-04-18  6:17 ` fxcoudert at gcc dot gnu dot org
  2007-06-23  7:34 ` burnus at gcc dot gnu dot org
  2007-06-23 13:53 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-18  6:17 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-04-18 07:16:57
               date|                            |


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


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

* [Bug fortran/30792] DATA implied-do substring allowed with -std=f95/f2003
  2007-02-14 10:04 [Bug fortran/30792] New: DATA implied-do substring allowed with -std=f95/f2003 burnus at gcc dot gnu dot org
  2007-04-18  6:17 ` [Bug fortran/30792] " fxcoudert at gcc dot gnu dot org
@ 2007-06-23  7:34 ` burnus at gcc dot gnu dot org
  2007-06-23 13:53 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-23  7:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-06-23 07:34 -------
R527 data-implied-do
        is ( data-i-do-object-list , data-i-do-variable = scalar-int-expr,
             scalar-int-expr [ , scalar-int-expr ] )
R528 data-i-do-object is array-element
                      or scalar-structure-component
                      or data-implied-do

which does not include substrings.

Related:
 character(len=20) :: a = 'xyz'
 data a(1:3)/'abc'/
-> Overlapping storage initializations (otherwise valid)
Should be detected with -std=f95.

 character(len=3) :: b
 integer :: i
 data (b(i:i),i=1,3)/3*'x'/
 data (b(i:i),i=2,2)/'y'/
 print *, b
-> Overlapping storage initializations (substrings are also not standard
conform)
-> Should this be detected or ignored?
(This is not detected by ifort either; both ifort and gfortran print 'xxx'; if
one reverses the data order, both print 'xyx'.)

Observation (should be ok either way):
 character(len=20) :: a
 data a(1:3)/'abc'/
 print '(":",a,":")', a
gfortran prints:
:abc                 :
g95, NAG f95, ifort print:
:abc:
(for "a = 'abc'" they have the same as gfortran. -> preinitialized by \0 vs. by
' '?)


-- 


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


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

* [Bug fortran/30792] DATA implied-do substring allowed with -std=f95/f2003
  2007-02-14 10:04 [Bug fortran/30792] New: DATA implied-do substring allowed with -std=f95/f2003 burnus at gcc dot gnu dot org
  2007-04-18  6:17 ` [Bug fortran/30792] " fxcoudert at gcc dot gnu dot org
  2007-06-23  7:34 ` burnus at gcc dot gnu dot org
@ 2007-06-23 13:53 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-23 13:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-06-23 13:53 -------
Also the following is not allowed:
data (string,i=1,1)/'hello'/
or
data (string,i=1,2)/'hello','foo'/

For the second, ifort -stand f95:
Warning: Overlapping storage initializations encountered with STRING

For both:
- NAG f95: syntax error
- g95: Error: DATA element inside iterator must be an array element or a scalar
structure component


-- 


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


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

end of thread, other threads:[~2007-06-23 13:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-14 10:04 [Bug fortran/30792] New: DATA implied-do substring allowed with -std=f95/f2003 burnus at gcc dot gnu dot org
2007-04-18  6:17 ` [Bug fortran/30792] " fxcoudert at gcc dot gnu dot org
2007-06-23  7:34 ` burnus at gcc dot gnu dot org
2007-06-23 13:53 ` burnus 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).