https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86312

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
With a clean revision r268299, there is no warning at run time:

% gfca pr86312.f90 -Warray-temporaries -fcheck=array-temps
pr86312.f90:12:9:

   12 | call sub(ia(1,:))   ! runtime warning: array temporary
      |         1
Warning: Creating array temporary at (1) [-Warray-temporaries]
pr86312.f90:15:9:

   15 | call sub(xx(:)%i)   ! no runtime warning?!?
      |         1
Warning: Creating array temporary at (1) [-Warray-temporaries]
% ./a.out
           1           1           1           1           1           1       
   1           1           1           1
           1           1           1           1           1           1       
   1           1           1           1
           3           3           3           3           3           3       
   3           3           3           3

However if I apply the patch at
https://gcc.gnu.org/ml/fortran/2019-01/msg00223.html
I get

% gfcp pr86312.f90 -Warray-temporaries -fcheck=array-temps
pr86312.f90:12:9:

   12 | call sub(ia(1,:))   ! runtime warning: array temporary
      |         1
Warning: Creating array temporary at (1) [-Warray-temporaries]
pr86312.f90:15:9:

   15 | call sub(xx(:)%i)   ! no runtime warning?!?
      |         1
Warning: Creating array temporary at (1) [-Warray-temporaries]
% ./a.out
At line 12 of file pr86312.f90
Fortran runtime warning: An array temporary was created
           1           1           1           1           1           1       
   1           1           1           1
           1           1           1           1           1           1       
   1           1           1           1
At line 15 of file pr86312.f90
Fortran runtime warning: An array temporary was created
           3           3           3           3           3           3       
   3           3           3           3

*** This bug has been marked as a duplicate of bug 48655 ***

Reply via email to