public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48303] New: [Legacy] Support Character constants in DATA statement for non-character variables
@ 2011-03-27 20:08 burnus at gcc dot gnu.org
  2011-03-27 20:09 ` [Bug fortran/48303] " burnus at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-03-27 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [Legacy] Support Character constants in DATA statement
                    for non-character variables
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Reported on freenode's #fortran.

The following program uses:
      DATA ZERO,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,
     & RNINE,TEN/'-','1','2','3','4','5','6','7','8','9','T'/

which almost all my compilers accept as vendor extension; however, gfortran
only accepts Hollerith constants (even more common vendor extension) in DATA:

      DATA ZERO,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,
     & RNINE,TEN/1H-,1H1,1H2,1H3,1H4,1H5,1H6,1H7,1H8,1H9,1HT/

Expected: As -std=legacy extension, also accept in DATA character literals.

The full program is the first one in the list at
http://www.netl.doe.gov/technologies/oil-gas/software/simulat.html


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

* [Bug fortran/48303] [Legacy] Support Character constants in DATA statement for non-character variables
  2011-03-27 20:08 [Bug fortran/48303] New: [Legacy] Support Character constants in DATA statement for non-character variables burnus at gcc dot gnu.org
@ 2011-03-27 20:09 ` burnus at gcc dot gnu.org
  2011-03-27 23:08 ` steven at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-03-27 20:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-03-27 19:18:32 UTC ---
Created attachment 23784
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23784
Longer example


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

* [Bug fortran/48303] [Legacy] Support Character constants in DATA statement for non-character variables
  2011-03-27 20:08 [Bug fortran/48303] New: [Legacy] Support Character constants in DATA statement for non-character variables burnus at gcc dot gnu.org
  2011-03-27 20:09 ` [Bug fortran/48303] " burnus at gcc dot gnu.org
@ 2011-03-27 23:08 ` steven at gcc dot gnu.org
  2011-03-27 23:52 ` steven at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu.org @ 2011-03-27 23:08 UTC (permalink / raw)
  To: gcc-bugs

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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steven at gcc dot gnu.org

--- Comment #2 from Steven Bosscher <steven at gcc dot gnu.org> 2011-03-27 22:01:04 UTC ---
What are the semantics supposed to be of this extension? Make the variables
assigned in the data implicitly typed CHARACTER?


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

* [Bug fortran/48303] [Legacy] Support Character constants in DATA statement for non-character variables
  2011-03-27 20:08 [Bug fortran/48303] New: [Legacy] Support Character constants in DATA statement for non-character variables burnus at gcc dot gnu.org
  2011-03-27 20:09 ` [Bug fortran/48303] " burnus at gcc dot gnu.org
  2011-03-27 23:08 ` steven at gcc dot gnu.org
@ 2011-03-27 23:52 ` steven at gcc dot gnu.org
  2011-03-28  0:03 ` steven at gcc dot gnu.org
  2013-06-22 13:28 ` dominiq at lps dot ens.fr
  4 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu.org @ 2011-03-27 23:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Steven Bosscher <steven at gcc dot gnu.org> 2011-03-27 23:08:20 UTC ---
Interpret them as Hollerith constants? Something like this extremely crude code
from the hip:

  /* Only DATA Statements come here.  */
  if (!conform)
    {
      /* Numeric can be converted to any other numeric. And Hollerith can be
         converted to any other type.  */
      if ((gfc_numeric_ts (&lvalue->ts) && gfc_numeric_ts (&rvalue->ts))
          || rvalue->ts.type == BT_HOLLERITH)
        return SUCCESS;

      if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL)
        return SUCCESS;

      /* In legacy mode, accept CHARACTER data, interpreted as a Hollerith
         constant.  */
      if (lvalue->ts.type != rvalue->ts.type
          && rvalue->ts.type == BT_CHARACTER
          && rvalue->ts.kind == gfc_default_character_kind)
        {
          gfc_expr *e;
          unsigned i, l;

          if (gfc_notify_std (GFC_STD_LEGACY, "Shame on you at %C ")
              == FAILURE)
            return FAILURE;

          l = rvalue->value.character.length;
          e = gfc_get_constant_expr (BT_HOLLERITH, gfc_default_character_kind,
                                     &rvalue->where);
          e->representation.string = XCNEWVEC (char, l + 1);
          for (i = 0; i < l; i++)
            {
              gfc_char_t c = rvalue->value.character.string[i];
              e->representation.string[i] = (char) c;
            }
          *rvalue = *e; /* ??? Not sure how to replace rvalue with the new e */
          return SUCCESS;
        }


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

* [Bug fortran/48303] [Legacy] Support Character constants in DATA statement for non-character variables
  2011-03-27 20:08 [Bug fortran/48303] New: [Legacy] Support Character constants in DATA statement for non-character variables burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-03-27 23:52 ` steven at gcc dot gnu.org
@ 2011-03-28  0:03 ` steven at gcc dot gnu.org
  2013-06-22 13:28 ` dominiq at lps dot ens.fr
  4 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu.org @ 2011-03-28  0:03 UTC (permalink / raw)
  To: gcc-bugs

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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.03.27 23:08:42
     Ever Confirmed|0                           |1


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

* [Bug fortran/48303] [Legacy] Support Character constants in DATA statement for non-character variables
  2011-03-27 20:08 [Bug fortran/48303] New: [Legacy] Support Character constants in DATA statement for non-character variables burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-03-28  0:03 ` steven at gcc dot gnu.org
@ 2013-06-22 13:28 ` dominiq at lps dot ens.fr
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-22 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
No activity since more than two years. IMO this should go under the section

6.2 Extensions not implemented in GNU Fortran

of the manual. I can submit a draft patch for this PR if someone is will to fix
my Frenglish and formatting issues and do the commit.


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

end of thread, other threads:[~2013-06-22 13:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-27 20:08 [Bug fortran/48303] New: [Legacy] Support Character constants in DATA statement for non-character variables burnus at gcc dot gnu.org
2011-03-27 20:09 ` [Bug fortran/48303] " burnus at gcc dot gnu.org
2011-03-27 23:08 ` steven at gcc dot gnu.org
2011-03-27 23:52 ` steven at gcc dot gnu.org
2011-03-28  0:03 ` steven at gcc dot gnu.org
2013-06-22 13:28 ` dominiq at lps dot ens.fr

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).