public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107501] New: Aliasing warning not working properly in certain situations
@ 2022-11-01 19:05 mhbalsmeier at mail dot de
0 siblings, 0 replies; only message in thread
From: mhbalsmeier at mail dot de @ 2022-11-01 19:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107501
Bug ID: 107501
Summary: Aliasing warning not working properly in certain
situations
Product: gcc
Version: og11 (devel/omp/gcc-11)
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: mhbalsmeier at mail dot de
Target Milestone: ---
Created attachment 53816
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53816&action=edit
source file
Hi,
this is my first bug report. During developing a scientific code I found that
the -Waliasing warning is not thrown in certain situations where in fact it
should be thrown.
The following code shows three calls to a subroutine, but in one of them, the
alaising warning does not appear.
program test
implicit none
type t_state
real(8) :: array_1(2,2)
real(8) :: array_2(2,2)
real(8) :: array_3(2,2)
end type t_state
type(t_state) :: state
real(8) :: array_1(2,2)
real(8) :: array_2(2,2)
real(8) :: array_3(2,2)
state%array_1 = .0
state%array_2 = .0
state%array_3 = .0
array_1 = .0
array_2 = .0
array_3 = .0
! should trigger warning, but doesn't
call
aliasing_routine_1(state%array_1,state%array_2,state%array_3,state%array_2,state%array_3)
! does trigger warning, as it should
call aliasing_routine_1(array_1,array_2,array_3,array_2,array_3)
! does trigger warning, as it should
call aliasing_routine_2(state%array_1,state%array_2,state%array_2)
contains
subroutine aliasing_routine_1(factor,in_1,in_2,out_1,out_2)
real(8), intent(in) :: factor(:,:)
real(8), intent(in) :: in_1(:,:)
real(8), intent(in) :: in_2(:,:)
real(8), intent(out) :: out_1(:,:)
real(8), intent(out) :: out_2(:,:)
out_1 = factor*in_1
out_2 = factor*in_2
end subroutine aliasing_routine_1
subroutine aliasing_routine_2(factor,in_1,out_1)
real(8), intent(in) :: factor(:,:)
real(8), intent(in) :: in_1(:,:)
real(8), intent(out) :: out_1(:,:)
out_1 = factor*in_1
end subroutine aliasing_routine_2
end program test
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-01 19:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 19:05 [Bug fortran/107501] New: Aliasing warning not working properly in certain situations mhbalsmeier at mail dot de
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).