https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117643
--- Comment #19 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- (In reply to kargls from comment #17) > On 12/24/24 10:03, jvdelisle at gcc dot gnu.org wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117643 > > > > --- Comment #15 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- > > From Harald's post. "There is another case I found while playing which is > > rejected: > > > > print *, f_c_string(c_char_"abc", asis) " > > > > I bet the parsing does not handle c_char_ with the two underscores. I have > > not > > actually tried that case yet. (I wanted to capture it here.) > > > > Looks like a more general problem than just my patch. In gdb, I see > > (gdb) p *string > $11 = {expr_type = EXPR_CONSTANT, ts = {type = BT_CHARACTER, kind = 1, > u = {derived = 0x80426fba0, cl = 0x80426fba0, pad = 69663648}, > interface = 0x0, is_c_interop = 0, is_iso_c = 0, > f90_type = BT_UNKNOWN, deferred = false, interop_kind = 0x0}, > ...} > > It seems parsing of a c_char_'string_constant' is setting neither > is_c_interop nor is_iso_c. I would assume is_c_interop should be > set. > > I suppose the error in check.cc(gfc_check_f_c_string) that starts > with > > if (string->ts.type != BT_CHARACTER > || (string->ts.type == BT_CHARACTER > && (string->ts.kind != 1 || string->ts.is_c_interop != 1))) > > can be suppressed for (string.expr_type == EXPR_CONSTANT && > string->ts.type == BT_CHARACTER && string->ts.kind == 1) Of course after posting what I just did in Comment #18 I see Steve's comment in 17. Maybe I have my logic all wrong on the error message. I saw the kind = 1 and did not expect is_c_interop to be set since c_char_'string_constant' is equivalent to 1_'string_constant'.