public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107695] New: Non conforming shape during assignment is not detected at run-time
@ 2022-11-15 10:55 Edouard.Canot@univ-rennes1.fr
2022-11-15 20:49 ` [Bug fortran/107695] " anlauf at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: Edouard.Canot@univ-rennes1.fr @ 2022-11-15 10:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107695
Bug ID: 107695
Summary: Non conforming shape during assignment is not detected
at run-time
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: Edouard.Canot@univ-rennes1.fr
Target Milestone: ---
Created attachment 53900
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53900&action=edit
Fortran test program which reveals the bug
At run-time, the attached program leads to memory problems (only detected by
valgrind).
It is compiled by the following command:
$ gfortran -fbounds-check -g -o test test.f90
The bug occurs at least for GCC versions from 8.5 to 12.2
In the following assignment:
z(ind,ind) = data(:,:)
I thought that data is recognized as a scalar (shape is [1,1]) and its value
spread to the four elements of z. This is not the case.
However:
z(ind,ind) = data(1,1)
gives the correct result as expected.
Of course, the problem cannot be detected at compile-time since both 'z' and
'data' arrays are allocatable.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/107695] Non conforming shape during assignment is not detected at run-time
2022-11-15 10:55 [Bug fortran/107695] New: Non conforming shape during assignment is not detected at run-time Edouard.Canot@univ-rennes1.fr
@ 2022-11-15 20:49 ` anlauf at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-15 20:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107695
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-11-15
--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.
There seems to be no bounds checking of the rhs expression data(:,:),
and I don't see that we generate a shape check here.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-15 20:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 10:55 [Bug fortran/107695] New: Non conforming shape during assignment is not detected at run-time Edouard.Canot@univ-rennes1.fr
2022-11-15 20:49 ` [Bug fortran/107695] " 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).