public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104908] New: gfortran 11/trunk regression: incorrect Fortran out-of-bound runtime error.
@ 2022-03-13 21:58 a.shahmoradi at gmail dot com
  2022-03-15 20:49 ` [Bug fortran/104908] [11/12 Regression] " anlauf at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: a.shahmoradi at gmail dot com @ 2022-03-13 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104908
           Summary: gfortran 11/trunk regression: incorrect Fortran
                    out-of-bound runtime error.
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a.shahmoradi at gmail dot com
  Target Milestone: ---

The following code appears to be standard-conforming, but gfortran throws a
runtime error with the flag `-check=bounds`,

```
program test

    type vec
        integer :: x(3)
    end type

    type(vec) :: v(2)

    call sub(v)

contains

    subroutine sub (v)

        class(vec), intent(in) :: v(:)

        integer :: k, q(3)

        q = [ (v(1)%x(k), k = 1, 3) ]   ! <-- fails here

   end subroutine

end program
```

Here is the error message,

```
At line 19 of file /app/example.f90
Fortran runtime error: Index '3' of dimension 1 of array 'v%_data%x' above
upper bound of 2
```

This is a gfortran-11 regression since the code is functional with gfortran-10
with the same compile flags. It can be tested here with different versions of
gfortran: https://godbolt.org/z/K6chcYE5e

This issue was raised in a StackOverflow question:
https://stackoverflow.com/questions/71441100/class-dummy-argument-for-array-of-custom-types-stuck-on-fcheck-bounds

I am only reporting it to the GNU Bugzilla.

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

end of thread, other threads:[~2024-03-07 21:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-13 21:58 [Bug fortran/104908] New: gfortran 11/trunk regression: incorrect Fortran out-of-bound runtime error a.shahmoradi at gmail dot com
2022-03-15 20:49 ` [Bug fortran/104908] [11/12 Regression] " anlauf at gcc dot gnu.org
2022-03-17 22:23 ` anlauf at gcc dot gnu.org
2022-03-22 10:33 ` rguenth at gcc dot gnu.org
2022-04-21  7:51 ` rguenth at gcc dot gnu.org
2023-05-29 10:06 ` [Bug fortran/104908] [11/12/13/14 " jakub at gcc dot gnu.org
2024-01-24 18:41 ` anlauf at gcc dot gnu.org
2024-01-26 20:20 ` anlauf at gcc dot gnu.org
2024-01-26 21:01 ` anlauf at gcc dot gnu.org
2024-01-27  0:25 ` jvdelisle at gcc dot gnu.org
2024-01-27 16:52 ` cvs-commit at gcc dot gnu.org
2024-01-31 19:28 ` cvs-commit at gcc dot gnu.org
2024-02-09 20:28 ` cvs-commit at gcc dot gnu.org
2024-02-09 20:28 ` cvs-commit at gcc dot gnu.org
2024-02-09 20:30 ` anlauf at gcc dot gnu.org
2024-03-07 21:06 ` anlauf 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).