https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106692
Bug ID: 106692 Summary: [10/11/12/13 Regression] Cray pointer comparison wrongly optimized away Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- The following program crashes with -O but not -O0: $ ./f951 -quiet -frecursive -fPIC -ffixed-line-length-132 -fautomatic -fcray-pointer -O x.f; gfortran x.s; ./a.out Program aborted. Backtrace: #0 0x7fa618e23a12 in ??? #1 0x7fa618e2444d in ??? #2 0x7fa619078d0c in ??? #3 0x401153 in ??? #4 0x401161 in ??? #5 0x401192 in ??? #6 0x7fa618a2954f in __libc_start_call_main at ../sysdeps/nptl/libc_start_call_main.h:58 #7 0x7fa618a29608 in __libc_start_main_impl at ../csu/libc-start.c:389 #8 0x401084 in ??? #9 0xffffffffffffffff in ??? Aborted (core dumped) $ cat x.f program test k=1 call test_cray(k) end subroutine test_cray(k) pointer(ptrzz1 , zz1) ptrzz1=0 if (ptrzz1 .ne. 0) then call abort() else call shape_cray(zz1) end if end subroutine shape_cray(zz1) pointer(ptrzz , zz) ptrzz=loc(zz1) if (ptrzz .ne. 0) then call abort() end if end