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

            Bug ID: 96624
           Summary: A segment error occurred when using the reshape
                    function result to assign a variable
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shenpo.d...@compiler-dev.com
  Target Milestone: ---

program test
  integer :: a(2,0)
  a = reshape([1,2,3,4], [2,0])
  print *,a
end

with gcc version 10.1.0 (Ubuntu 10.1.0-2ubuntu1~18.04)
Target: aarch64-linux-gnu
i get this message:
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0xffff81755e5f
#1  0xffff81754ea7
#2  0xffff818dd687
#3  0xaaaad5c199cc
#4  0xaaaad5c19b1f
#5  0xffff816006df
#6  0xaaaad5c19883
Segmentation fault (core dumped)

But if assign values when declare them,it is correct

  integer :: a(2,0) = reshape([1,2,3,4], [2,0])
  print *,a
end

the result is a blank line

Reply via email to