https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48655
Nick <nickpapior at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nickpapior at gmail dot com --- Comment #9 from Nick <nickpapior at gmail dot com> --- I really think this needs fixing. A user (me) is unaware of the implications and differences between -Warray-temporaries and -fcheck=array-temps. E.g. from this discussion it seems that -Warray-temporaries only pin-points where there _could_ be problems of creating temporaries. -fcheck=array-temps will reveal true temporary copies created. However, I have found that our code (+100.000 LOC) can greatly benefit closing -Warray-temporaries even if -fcheck=array-temps did not show any temporaries created. Why is this? So some follow up questions to clarify the flags: 1) Is there any compiled code difference in places where -Warray-temporaries show up, e.g. can we assume that IFF -Warray-temporaries gives a warning it is equivalent to the compiler inserting something like: if (is_contiguous(A) ) then call with no temp else temp = A(...) call with_temp deallocate(temp) end if ? And if not, then there is nothing to worry about? 2) Can we be sure that -fcheck=array-temps actually shows all true positives related to temporary array creation? What I would really like is the following changes to the documentation: -Warray-temporaries: Warn about possible array temporaries generated by the compiler. The information generated by this warning is sometimes useful in optimization, in order to avoid such temporaries. If this warning is issued it is equivalent to extra code checking for contiguous arrays before determining whether a temporary is created. To assert a temporary array was created, use -fcheck=array-temps. If extra code is not generated when a warning is issued then the 2nd last line should be omitted. Additionally the Warning message should be clarified, currently it looks like: Warning: Creating array temporary at (1) [-Warray-temporaries] However, I think it should look like this: Warning: Creating array temporary at (1) if non-contiguous [-Warray-temporaries] Thanks!