public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41218]  New: Vendor extension: character assignment in DATA to non-character variables
@ 2009-09-01 20:58 burnus at gcc dot gnu dot org
  2010-05-12 12:27 ` [Bug fortran/41218] " dfranke at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-09-01 20:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/ml/fortran/2009-09/msg00003.html

g77 - but also openf95, sunf95 or ifort - support the following Fortran 66
vendor extension, which was effectively obsoleted by Fortran 77.

      LOGICAL :: L
      INTEGER :: I
      REAL    :: R
      DATA L/'abcd'/, I/'Text'/, R/'ZYXW'/  ! Missing legacy extension
      print *, L, transfer(L,"1234")
      print *, I, transfer(I,"1234")
      print *, R, transfer(R,"1234")
      END


Tim wrote: "Hollerith constant expressed with apostrophes was a vendor
extension to f66, typically supported by IBM and HP but few others. Its use was
often a sign of intentional non-portability. In order to support the extension
in f77, it involved the new extension of supporting character strings to assign
and initialize Hollerith."

 * * *

One needs to add a conversion similar as done in gfc_simplify_transfer -
with the proper warning if the string is too long (ignored characters)
or too short (undefined value) - somewhere in gfc_check_assign. The
first steps will be:

Index: expr.c
===================================================================
--- expr.c      (revision 151272)
+++ expr.c      (working copy)
@@ -3021,6 +3021,18 @@ gfc_check_assign (gfc_expr *lvalue, gfc_
       if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL)
        return SUCCESS;

+      if ((gfc_numeric_ts (&lvalue->ts) || lvalue->ts.type == BT_LOGICAL)
+         && rvalue->ts.type == BT_CHARACTER)
+        {
+         if (gfc_notify_std (GFC_STD_LEGACY, "Legacy: Assigning character "
+                        "literal in DATA statement at %L to a
noncharacter "
+                        "variable", &rvalue->where) == FAILURE)
+           return FAILURE;
+
+FIXME: Do actual conversion similar to gfc_simplify_transfer
+       (incl. too long/too shortwarnings)
+
+        }
+
       gfc_error ("Incompatible types in DATA statement at %L; attempted "
                 "conversion of %s to %s", &lvalue->where,
                 gfc_typename (&rvalue->ts), gfc_typename (&lvalue->ts));


-- 
           Summary: Vendor extension: character assignment in DATA to non-
                    character variables
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          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=41218


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

* [Bug fortran/41218] Vendor extension: character assignment in DATA to non-character variables
  2009-09-01 20:58 [Bug fortran/41218] New: Vendor extension: character assignment in DATA to non-character variables burnus at gcc dot gnu dot org
@ 2010-05-12 12:27 ` dfranke at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-12 12:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2010-05-12 12:26 -------


*** This bug has been marked as a duplicate of 33015 ***


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2010-05-12 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-01 20:58 [Bug fortran/41218] New: Vendor extension: character assignment in DATA to non-character variables burnus at gcc dot gnu dot org
2010-05-12 12:27 ` [Bug fortran/41218] " 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).