public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/63689] New: -fcheck=array-temps should warn for temporaries during intrinsic assignment
@ 2014-10-30 17:45 bardeau at iram dot fr
2014-12-07 14:34 ` [Bug fortran/63689] " dominiq at lps dot ens.fr
0 siblings, 1 reply; 2+ messages in thread
From: bardeau at iram dot fr @ 2014-10-30 17:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63689
Bug ID: 63689
Summary: -fcheck=array-temps should warn for temporaries during
intrinsic assignment
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: bardeau at iram dot fr
Hi!
please consider this code:
program test
real(kind=4), pointer :: a(:),b(:)
allocate(a(2),b(2))
b = a
end program test
In the assignment, because the LHS and RHS are pointers, they may alias
each-other, so the compiler generates a temporary/intermediate array for
evaluating the RHS. Fine.
This use-case is well detected by -Warray-temporaries:
$ gfortran test.f90 -Warray-temporaries -o test
test.f90:4.6:
b = a
1
Warning: Creating array temporary at (1)
On the other hand, -fcheck=array-temps gives no message at run-time:
$ gfortran test.f90 -fcheck=array-temps -o test && ./test
$
I know that the documentation for -fcheck=array-temps clearly states that it
warns for temporary arrays passed to a procedure. However, it would be useful
to extend the warnings to temporaries during intrinsic assignment because the
option name is opened to all temporaries, and because -Warray-temporaries warns
in both cases.
I am currently tracking temporaries, but I prefer runtime checks (temporaries
*are* actually created) instead of compilation checks (temporaries *may* be
created, too many false positives in my program).
I was not sure which version (all opened?) and which component could be
affected, I let you correct this. Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/63689] -fcheck=array-temps should warn for temporaries during intrinsic assignment
2014-10-30 17:45 [Bug libfortran/63689] New: -fcheck=array-temps should warn for temporaries during intrinsic assignment bardeau at iram dot fr
@ 2014-12-07 14:34 ` dominiq at lps dot ens.fr
0 siblings, 0 replies; 2+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-12-07 14:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63689
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-07
Component|libfortran |fortran
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I am currently tracking temporaries, but I prefer runtime checks
> (temporaries *are* actually created) instead of compilation checks
> (temporaries *may* be created, too many false positives in my program).
See pr48655 for an instance of false positive.
> I was not sure which version (all opened?) and which component could be
> affected, I let you correct this.
Confirmed from 4.8 up to trunk (5.0). Since the checking code is emitted by the
front-end, I erasing the component to 'fortran'.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-07 14:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-30 17:45 [Bug libfortran/63689] New: -fcheck=array-temps should warn for temporaries during intrinsic assignment bardeau at iram dot fr
2014-12-07 14:34 ` [Bug fortran/63689] " dominiq at lps dot ens.fr
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).