[Bug fortran/126386] matmul in combination with multiplication and transpose fails to correctly reallocate result array

"kargl at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126386

Steve Kargl <kargl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |15.3.1, 16.1.1, 17.0
   Last reconfirmed|                            |2026-07-24
                 CC|                            |kargl at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Steve Kargl <kargl at gcc dot gnu.org> ---
It is related to the frontend optimized pass.

% gfcx -o z -O u6.f90 && ./z
 Result size (expected 2):            3
% gfcx -o z -O u6.f90 -fno-frontend-optimize && ./z
 Result size (expected 2):            2

If I change the code to 

    a = 2*a
    y = matmul(transpose(A),x)

one gets the expected answer.  The frontend pass appears
to miss handle the expression in transpose().
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.