[Bug fortran/44744] Missing -fcheck=bounds diagnostic for function assignment with tmp array

2024-05-18 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44744

--- Comment #5 from Tobias Burnus  ---
(In reply to Tobias Burnus from comment #4)
> Another variant from lsdalton – or rather the

BTW: I have not verified that the cause is the same (temporary variable), but
it seems to be likely.
When replacing the 'A(i,:,:)' on the LHS with 'B(:,:)', gfortran does diagnose
the too large RHS.

[Bug fortran/44744] Missing -fcheck=bounds diagnostic for function assignment with tmp array

2024-05-18 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44744

Tobias Burnus  changed:

   What|Removed |Added

 CC||burnus at gcc dot gnu.org

--- Comment #4 from Tobias Burnus  ---
Another variant from lsdalton – or rather the
https://github.com/openrsp/openrsp/archive/v1.0.0.tar.gz it downloads during
the build.

FLANG diagnoses the LSDalton issue as:

error(/home/jehammond/DALTON/lsdalton/build/_deps/openrsp_sources-src/src/ao_dens/rsp_property_caching.f90:2164):
Assign: mismatching element counts in array assignment (to 6, from 3)

* * *

GCC fails to do so.
Testcase: – the problem is that the RHS is 3 and the LHS is 6:

implicit none
real,allocatable :: A(:,:,:)
integer :: n, n2, i
n = 6
n2 = 3
allocate(A(3,n,3))
do i = 1, 3
  print *, shape(a), '|', shape(f(n2))
  a(i,:,:) = f(n2)
end do
deallocate(A)
contains
  function f(n)
integer :: n
real :: f(n,3)  
f = 99.0
  end
end

[Bug fortran/44744] Missing -fcheck=bounds diagnostic for function assignment with tmp array

2010-07-14 Thread burnus at gcc dot gnu dot org


--- Comment #3 from burnus at gcc dot gnu dot org  2010-07-14 17:42 ---
After PR 44773 has been fixed, we are back to things which failed before. Test
case which has no diagnostic (same as the one in comment 0 but with TARGET
attribute to force the creation of an array temporary)

 integer, target :: a(-4:1), b(0:4)
 b = 5
 i = 0
 a(i:1) = f(b)
contains
  function f(x)
integer :: x(:),f(size(x))
f = x
  end function
end


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Keywords||diagnostic
   Last reconfirmed|-00-00 00:00:00 |2010-07-14 17:42:11
   date||
Summary|[4.6 Regression] Missed |Missing -fcheck=bounds
   |runtime error after revision|diagnostic for function
   |161550  |assignment with tmp array


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44744