public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/114355] New: Segfault passing missing optional dummy of bind(c) subroutine to optional assumed-rank dummy Date: Fri, 15 Mar 2024 17:02:08 +0000 [thread overview] Message-ID: <bug-114355-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114355 Bug ID: 114355 Summary: Segfault passing missing optional dummy of bind(c) subroutine to optional assumed-rank dummy Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: anlauf at gcc dot gnu.org Target Milestone: --- Found while working out corner cases for pr101135: program main implicit none call test_c contains subroutine test_c (s) bind(c) real, dimension(:), optional :: s call test_ar (s) end subroutine test_ar (z) real, dimension(..), optional :: z end end This crashes at runtime when compiled with -O0 or -Og since gcc-9. The dump-tree has in test_c: { integer(kind=8) D.4362; struct array01_real(kind=4) parm.1; integer(kind=8) D.4369; struct array01_real(kind=4) * D.4370; D.4362 = s->dim[0].ubound; parm.1.span = s->span; parm.1.dtype = {.elem_len=4, .version=0, .rank=1, .type=3}; D.4369 = s->dim[0].stride; parm.1.dim[0].lbound = 1; parm.1.dim[0].ubound = D.4362; parm.1.dim[0].stride = NON_LVALUE_EXPR <D.4369>; parm.1.data = (void *) s->data; parm.1.offset = -NON_LVALUE_EXPR <D.4369>; D.4370 = s != 0B ? &parm.1 : 0B; test_ar (D.4370); } Looks like there are several potential NULL pointer dereferences.
next reply other threads:[~2024-03-15 17:02 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-15 17:02 anlauf at gcc dot gnu.org [this message] 2024-03-15 17:12 ` [Bug fortran/114355] " anlauf at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-114355-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).