public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/109861] New: Optimization is marking  uninitialized  C_PTR being passed to a C function, causes segfault.
@ 2023-05-15 14:00 brtnfld at hdfgroup dot org
  2023-05-15 18:23 ` [Bug fortran/109861] " anlauf at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: brtnfld at hdfgroup dot org @ 2023-05-15 14:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109861
           Summary: Optimization is marking  uninitialized  C_PTR being
                    passed to a C function, causes segfault.
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brtnfld at hdfgroup dot org
  Target Milestone: ---

Created attachment 55085
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55085&action=edit
Fortran/C/Makfile. Changing the optimization level in the makefile reproduces
the behaviour.

For a TYPE(C_PTR), INTENT(OUT), buf, which is being passed through a Fortran
subroutine to get the value set in a C function, an optimization of >= -O1
gives the warning "used uninitialized [-Wuninitialized]" and then the program
Segmentation faults - invalid memory reference. It works for gfortran 12 but
fails for gfortran 13 and 14. It works if the INTENT is INOUT.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-16 13:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15 14:00 [Bug fortran/109861] New: Optimization is marking uninitialized C_PTR being passed to a C function, causes segfault brtnfld at hdfgroup dot org
2023-05-15 18:23 ` [Bug fortran/109861] " anlauf at gcc dot gnu.org
2023-05-15 18:49 ` anlauf at gcc dot gnu.org
2023-05-15 20:08 ` brtnfld at hdfgroup dot org
2023-05-15 21:22 ` anlauf at gcc dot gnu.org
2023-05-15 21:25 ` kargl at gcc dot gnu.org
2023-05-16 13:27 ` brtnfld at hdfgroup dot org
2023-05-16 13:29 ` brtnfld at hdfgroup dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).