public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107266] New: Reject kind=4 characters for BIND(C) – it invalid and generates wrong code
@ 2022-10-14 16:04 burnus at gcc dot gnu.org
  2022-10-14 16:09 ` [Bug fortran/107266] " burnus at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-10-14 16:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107266

            Bug ID: 107266
           Summary: Reject kind=4 characters for BIND(C) – it invalid and
                    generates wrong code
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

There is code which expects that CHARACTER arguments inside BIND(C) procedures
is kind=1 (alias C_CHAR):

  if (sym->ts.type == BT_CHARACTER
      && ((sym->attr.function && sym->attr.is_bind_c)
          || ((sym->attr.result || sym->attr.value)
              && sym->ns->proc_name
              && sym->ns->proc_name->attr.is_bind_c)
          || (sym->ts.deferred && (!sym->ts.u.cl
                                   || !sym->ts.u.cl->backend_decl))))
    type = gfc_character1_type_node;
  else
    type = gfc_typenode_for_spec (&sym->ts, sym->attr.codimension);

If one now tries to use:

call foo(4_'abcd')
contains
subroutine foo(x)
  character(kind=4,len=4) :: x
  ...
end
end

this creates inconsistent interfaces!

Alternatively, if we want to support it, we need to change how this is handled
to yield proper code!

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

end of thread, other threads:[~2022-10-18 23:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14 16:04 [Bug fortran/107266] New: Reject kind=4 characters for BIND(C) – it invalid and generates wrong code burnus at gcc dot gnu.org
2022-10-14 16:09 ` [Bug fortran/107266] " burnus at gcc dot gnu.org
2022-10-14 18:31 ` kargl at gcc dot gnu.org
2022-10-14 18:51 ` kargl at gcc dot gnu.org
2022-10-14 18:51 ` kargl at gcc dot gnu.org
2022-10-14 20:08 ` kargl at gcc dot gnu.org
2022-10-14 21:36 ` burnus at gcc dot gnu.org
2022-10-14 22:21 ` sgk at troutmask dot apl.washington.edu
2022-10-14 22:45 ` kargl at gcc dot gnu.org
2022-10-17 16:15 ` cvs-commit at gcc dot gnu.org
2022-10-17 16:56 ` kargl at gcc dot gnu.org
2022-10-18 10:40 ` burnus at gcc dot gnu.org
2022-10-18 17:29 ` sgk at troutmask dot apl.washington.edu
2022-10-18 22:43 ` sgk at troutmask dot apl.washington.edu
2022-10-18 23:18 ` sgk at troutmask dot apl.washington.edu

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