public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/108131] New: Incorrect bound calculation when bound intrinsic used in size expression
@ 2022-12-15 17:16 jb at gcc dot gnu.org
  2022-12-15 17:41 ` [Bug fortran/108131] [10/11/12/13 Regression] " anlauf at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: jb at gcc dot gnu.org @ 2022-12-15 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108131
           Summary: Incorrect bound calculation when bound intrinsic used
                    in size expression
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jb at gcc dot gnu.org
  Target Milestone: ---

This is from
https://stackoverflow.com/questions/74814027/where-to-report-possible-gfortran-compiler-bug
. Consider

program test
  integer, parameter :: mg(0:10) = 0
  integer, parameter :: u = ubound(mg, dim=1)
  integer, parameter :: cx(-1:ubound(mg, dim=1)) = 1
  integer, parameter :: cy(-1:10) = 2
  integer, parameter :: cz(-1:u) = 3

  write(*,*) lbound(mg, dim=1), ubound(mg, dim=1)
  write(*,*) lbound(cx, dim=1), ubound(cx, dim=1)
  write(*,*) lbound(cy, dim=1), ubound(cy, dim=1)
  write(*,*) lbound(cz, dim=1), ubound(cz, dim=1)
end program test

Obviously the ubounds of all the 4 arrays should be 10. However running the
program results in:

$ ./a.out
           0          10
          -1          11
          -1          10
          -1          10

This affects master as of today, an earlier 12.x snapshot I had lying around,
and 11.3.0 as shipped with Ubuntu 22.04. Based on a comment on the
stackoverflow question, versions 7, 8, 9, and 10 are ok. Looking at
-fdump-tree-original output, the error occurs already in the gfortran frontend.

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

end of thread, other threads:[~2023-04-09  2:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15 17:16 [Bug fortran/108131] New: Incorrect bound calculation when bound intrinsic used in size expression jb at gcc dot gnu.org
2022-12-15 17:41 ` [Bug fortran/108131] [10/11/12/13 Regression] " anlauf at gcc dot gnu.org
2022-12-15 17:47 ` rguenth at gcc dot gnu.org
2022-12-15 21:43 ` anlauf at gcc dot gnu.org
2022-12-17 21:22 ` anlauf at gcc dot gnu.org
2022-12-23 21:24 ` cvs-commit at gcc dot gnu.org
2022-12-28 16:12 ` cvs-commit at gcc dot gnu.org
2022-12-28 16:27 ` [Bug fortran/108131] [10/11 " anlauf at gcc dot gnu.org
2023-01-08 20:52 ` cvs-commit at gcc dot gnu.org
2023-01-08 20:56 ` cvs-commit at gcc dot gnu.org
2023-01-08 20:59 ` anlauf at gcc dot gnu.org
2023-04-09  2:16 ` jvdelisle 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).