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!