public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute
@ 2022-02-04 20:45 michael at scivision dot dev
  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
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: michael at scivision dot dev @ 2022-02-04 20:45 UTC (permalink / raw)
  To: gcc-bugs

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
```

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

* [Bug fortran/104391] [9/10/11 Regression] bind(C) and allocatable or pointer attribute don't work
  2022-02-04 20:45 [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute michael at scivision dot dev
@ 2022-02-04 21:34 ` pinskia at gcc dot gnu.org
  2022-02-05  3:14 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-04 21:34 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5
           Keywords|                            |needs-bisection, wrong-code
            Summary|Gfortran [9,10,11]          |[9/10/11 Regression]
                   |regression with bind(C) and |bind(C) and allocatable or
                   |allocatable or pointer      |pointer attribute don't
                   |attribute                   |work

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

* [Bug fortran/104391] [9/10/11 Regression] bind(C) and allocatable or pointer attribute don't work
  2022-02-04 20:45 [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute michael at scivision dot dev
  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
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-05  3:14 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=92189

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Maybe PR 92189.

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

* [Bug fortran/104391] [9/10/11 Regression] bind(C) and allocatable or pointer attribute don't work
  2022-02-04 20:45 [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute michael at scivision dot dev
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-07  7:47 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

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

* [Bug fortran/104391] [9/10/11 Regression] bind(C) and allocatable or pointer attribute don't work
  2022-02-04 20:45 [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute michael at scivision dot dev
                   ` (2 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-02-22 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-02-22
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master with r12-2511-g0cbf03689e3e7d9d, started with
r9-5372-gbbf18dc5d248a79a.

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

* [Bug fortran/104391] [10/11 Regression] bind(C) and allocatable or pointer attribute don't work
  2022-02-04 20:45 [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute michael at scivision dot dev
                   ` (3 preceding siblings ...)
  2022-02-22 10:51 ` marxin at gcc dot gnu.org
@ 2022-05-27  9:47 ` rguenth at gcc dot gnu.org
  2022-06-28 10:48 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug fortran/104391] [10/11 Regression] bind(C) and allocatable or pointer attribute don't work
  2022-02-04 20:45 [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute michael at scivision dot dev
                   ` (4 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug fortran/104391] [11 Regression] bind(C) and allocatable or pointer attribute don't work
  2022-02-04 20:45 [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute michael at scivision dot dev
                   ` (5 preceding siblings ...)
  2022-06-28 10:48 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:42 ` rguenth at gcc dot gnu.org
  2024-04-25  6:20 ` pault at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

* [Bug fortran/104391] [11 Regression] bind(C) and allocatable or pointer attribute don't work
  2022-02-04 20:45 [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute michael at scivision dot dev
                   ` (6 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2024-04-25  6:20 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #2)
> Fixed on master with r12-2511-g0cbf03689e3e7d9d, started with
> r9-5372-gbbf18dc5d248a79a.

Yes, indeed.

Thanks, Martin.

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

end of thread, other threads:[~2024-04-25  6:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04 20:45 [Bug fortran/104391] New: Gfortran 9 regression with bind(C) and allocatable or pointer attribute michael at scivision dot dev
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

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