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
Created attachment 23784 [details] Longer example
What are the semantics supposed to be of this extension? Make the variables assigned in the data implicitly typed CHARACTER?
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; }
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.
(In reply to Dominique d'Humieres from comment #4) > 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. Hi, just going through some WAITING bugs... do you still plan to do this? If not, I can also do this.
See https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277975 I'm pretty sure this can be closed as fixed.
Requires -fdec or -fdec-char-conversions trunk (10.0).