public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "michael at scivision dot dev" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute Date: Fri, 04 Feb 2022 20:45:31 +0000 [thread overview] Message-ID: <bug-104391-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104391 Bug ID: 104391 Summary: Gfortran 9 regression with bind(C) and allocatable or pointer attribute Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: michael at scivision dot dev Target Milestone: --- The `bind(C)` on a procedure appears to break `pointer` and `allocatable` attributes of a variable with regard to index start. Specifically, on exiting a procedure with `bind(c)`, the variable(s) have their indices shifted to zero-based. example that works with GCC <= 8.5 and GCC 12 (broken for GCC 9, 10, 11). ``` program test_bounds use iso_fortran_env, only : error_unit implicit none real, allocatable :: a(:) integer :: L1,L2, U1,U2 allocate(a(1:2)) L1 = lbound(a,1) U1 = ubound(a,1) call c_bounder(a) L2 = lbound(a,1) U2 = ubound(a,1) if (L1 /= L2 .or. U1 /= U2) then write(error_unit, '(a,2i2,a,2i2)') 'FAIL: bounds changed before/after lower:', L1,L2, " upper: ", U1,U2 error stop endif print '(a)', "bounds check OK" contains subroutine c_bounder(a) bind(c) real, intent(inout) :: a(:) end subroutine c_bounder end program ```
next reply other threads:[~2022-02-04 20:45 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-04 20:45 michael at scivision dot dev [this message] 2022-02-04 21:34 ` [Bug fortran/104391] [9/10/11 Regression] bind(C) and allocatable or pointer attribute don't work pinskia at gcc dot gnu.org 2022-02-05 3:14 ` pinskia at gcc dot gnu.org 2022-02-07 7:47 ` rguenth at gcc dot gnu.org 2022-02-22 10:51 ` marxin at gcc dot gnu.org 2022-05-27 9:47 ` [Bug fortran/104391] [10/11 " rguenth at gcc dot gnu.org 2022-06-28 10:48 ` jakub at gcc dot gnu.org 2023-07-07 10:42 ` [Bug fortran/104391] [11 " rguenth at gcc dot gnu.org 2024-04-25 6:20 ` pault 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-104391-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).