public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39490]  New: Non-standard assignment of arrays of character objects
@ 2009-03-18  9:53 n dot pinhao at netvisao dot pt
  2009-03-18 11:17 ` [Bug fortran/39490] " dominiq at lps dot ens dot fr
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: n dot pinhao at netvisao dot pt @ 2009-03-18  9:53 UTC (permalink / raw)
  To: gcc-bugs

gfortran accepts the following syntax for the assignment of character objects:

CHARACTER(14) :: prop(4) = (/'name', 'data_file_name', 'Ho_units',
'mpolar_units'/)

Although this is convenient, is not according to the Fortran standard that
requires that all of the elements of a constructor be the same kind, type and
for characters, length.
According to this the correct syntax is:

CHARACTER(14) :: prop(4) = (/'name          ', 'data_file_name', &
  'Ho_units      ', 'mpolar_units  '/)


-- 
           Summary: Non-standard assignment of arrays of character objects
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: n dot pinhao at netvisao dot pt
 GCC build triplet: Linux, x86_64 and i486
  GCC host triplet: Linux, x86_64 and i486
GCC target triplet: Linux, x86_64 and i486


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


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

* [Bug fortran/39490] Non-standard assignment of arrays of character objects
  2009-03-18  9:53 [Bug fortran/39490] New: Non-standard assignment of arrays of character objects n dot pinhao at netvisao dot pt
@ 2009-03-18 11:17 ` dominiq at lps dot ens dot fr
  2009-03-18 19:13 ` burnus at gcc dot gnu dot org
  2009-03-28  8:28 ` [Bug fortran/39490] Invalid character constructor rejected at -std=gnu since 4.4 fxcoudert at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens dot fr @ 2009-03-18 11:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2009-03-18 11:17 -------
Confirmed on 4.3.3, trunk gives:

pr39490.f90:1.36:

CHARACTER(14) :: prop(4) = (/'name', 'data_file_name', 'Ho_units', 'mpolar_unit
                                    1
Error: Different CHARACTER lengths (4/14) in array constructor at (1)


-- 


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


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

* [Bug fortran/39490] Non-standard assignment of arrays of character objects
  2009-03-18  9:53 [Bug fortran/39490] New: Non-standard assignment of arrays of character objects n dot pinhao at netvisao dot pt
  2009-03-18 11:17 ` [Bug fortran/39490] " dominiq at lps dot ens dot fr
@ 2009-03-18 19:13 ` burnus at gcc dot gnu dot org
  2009-03-28  8:28 ` [Bug fortran/39490] Invalid character constructor rejected at -std=gnu since 4.4 fxcoudert at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-03-18 19:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-03-18 19:12 -------
> Confirmed on 4.3.3

Well, I get also with 4.3.x an error with -std=f95.

The question is rather: Is is on purpose that it is rejected with -std=gnu with
4.4, while 4.2/4.3 accept it. (g95, sunf95 and NAG f95 reject it; while ifort
and openf95 accept it with default options.)

Another version of legal code is:

CHARACTER(14) :: prop(4) = (/ character(14) :: 'name', 'data_file_name',
'Ho_units','mpolar_units'/)


-- 


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


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

* [Bug fortran/39490] Invalid character constructor rejected at -std=gnu since 4.4
  2009-03-18  9:53 [Bug fortran/39490] New: Non-standard assignment of arrays of character objects n dot pinhao at netvisao dot pt
  2009-03-18 11:17 ` [Bug fortran/39490] " dominiq at lps dot ens dot fr
  2009-03-18 19:13 ` burnus at gcc dot gnu dot org
@ 2009-03-28  8:28 ` fxcoudert at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-03-28  8:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2009-03-28 08:28 -------
This is work that Daniel Kraft and I did (well, I think he did the hard work
and I gave some loose sort of guidance). I seem to remember it was intentional
(it may have been discussed on the list around summer of 2008, but I can't find
it).

Regarding whether it's desirable or not, I think it is right to issue an error:
this is rather recent Fortran code, so people have virtually no reason for not
writing the proper constructor. (Accepting invalid code as a GNU extension
should be done sparsely.)

I'm thus closing as WONTFIX.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
  GCC build triplet|Linux, x86_64 and i486      |
   GCC host triplet|Linux, x86_64 and i486      |
 GCC target triplet|Linux, x86_64 and i486      |
         Resolution|                            |WONTFIX
            Summary|Non-standard assignment of  |Invalid character
                   |arrays of character objects |constructor rejected at -
                   |                            |std=gnu since 4.4
            Version|4.3.2                       |4.4.0


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


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

end of thread, other threads:[~2009-03-28  8:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-18  9:53 [Bug fortran/39490] New: Non-standard assignment of arrays of character objects n dot pinhao at netvisao dot pt
2009-03-18 11:17 ` [Bug fortran/39490] " dominiq at lps dot ens dot fr
2009-03-18 19:13 ` burnus at gcc dot gnu dot org
2009-03-28  8:28 ` [Bug fortran/39490] Invalid character constructor rejected at -std=gnu since 4.4 fxcoudert 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).