public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/108618] New: ISO C-Fortran Interface fails to pass CFI descriptor version check when using code coverage flags for fortran
@ 2023-01-31 19:31 kyle.shores44 at gmail dot com
  2023-01-31 19:38 ` [Bug libfortran/108618] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: kyle.shores44 at gmail dot com @ 2023-01-31 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108618
           Summary: ISO C-Fortran Interface fails to pass CFI descriptor
                    version check when using code coverage flags for
                    fortran
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kyle.shores44 at gmail dot com
  Target Milestone: ---

Created attachment 54378
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54378&action=edit
A zipped archive with 5 files, a dockerfile, CMakeLists.txt, a cmake file for
code coverage, a fortran source file, a c++ source file

The C-Fortran interface fails to pass a runtime Fortran check for the CFI
descriptor when checking code coverage. Specifically, the `-fcheck=bounds` flag
causes the runtime failure.

Included is a zip file that has a minimal working example. It's a cmake project
with two source files (one c++, one fortran), a Dockerfile, a CMakeLists.txt
file as well as the necessary code coverage cmake file. Fortran creates some
strings and passes them to C(++) through the `CFI_cdesc_t` struct defined in
ISO_Fortran_binding.h.

Inside of the CMakeLists.txt file there are two calls to
`set(CMAKE_Fortran_FLAGS ...`. Above each is a comment indicating which of the
flags passes and which fails. You can comment and uncomment the pair to watch
the created executable fail intermittently. 

When I compile the sources on my machine with the below versions of tools, I
see the failure.

os: macOS 12.5
architecture: Apple M1 Pro
gfortran: GNU Fortran (Homebrew GCC 12.2.0) 12.2.0
g++: (Homebrew GCC 12.2.0) 12.2.0
cmake: 3.25.1

I also see the failure in the Dockerfile included in the zipped archive
(hopefully this aids in the reproducibility of the issue). The tool versions in
the Dockerfile are

os: Fedora Linux 38
architecture: Apple M1 Pro
gfortran: GNU Fortran (GCC) 13.0.1 20230127 (Red Hat 13.0.1-0)
g++: (GCC) 13.0.1 20230127 (Red Hat 13.0.1-0)
cmake: 3.25.2

The specific flag that causes the issue is `-fcheck=bounds`.

The full list of compiler flags passed to gfortran on my machine:

/opt/homebrew/bin/gfortran 
-I/Users/kshores/Downloads/mwe/build/_deps/googletest-src/googletest/include
-I/Users/kshores/Downloads/mwe/build/_deps/googletest-src/googletest -g -O0
-fprofile-arcs -ftest-coverage -fcheck=bounds,do,pointer
-ffpe-trap=zero,overflow,invalid -fprofile-abs-path -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -c
/Users/kshores/Downloads/mwe/fortran_strings.F90 -o
CMakeFiles/bad_version.dir/fortran_strings.F90.o

The full list of compiler flags passed to gfortran in the Dockerfile:

/usr/bin/gfortran  -I/build/_deps/googletest-src/googletest/include
-I/build/_deps/googletest-src/googletest -g -O0 -fprofile-arcs -ftest-coverage
-fcheck=bounds,do,pointer -ffpe-trap=zero,overflow,invalid -fprofile-abs-path
-c /mwe/fortran_strings.F90 -o CMakeFiles/bad_version.dir/fortran_strings.F90.o


I hope that this is enough information. Please let me know if there is more
that is needed from me.

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

end of thread, other threads:[~2023-02-01 15:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-31 19:31 [Bug libfortran/108618] New: ISO C-Fortran Interface fails to pass CFI descriptor version check when using code coverage flags for fortran kyle.shores44 at gmail dot com
2023-01-31 19:38 ` [Bug libfortran/108618] " pinskia at gcc dot gnu.org
2023-01-31 19:39 ` pinskia at gcc dot gnu.org
2023-01-31 19:40 ` kyle.shores44 at gmail dot com
2023-01-31 19:41 ` pinskia at gcc dot gnu.org
2023-01-31 19:42 ` kyle.shores44 at gmail dot com
2023-01-31 19:54 ` kyle.shores44 at gmail dot com
2023-01-31 22:02 ` pinskia at gcc dot gnu.org
2023-01-31 22:25 ` pinskia at gcc dot gnu.org
2023-01-31 22:47 ` kyle.shores44 at gmail dot com
2023-01-31 22:49 ` pinskia at gcc dot gnu.org
2023-02-01 15:40 ` kyle.shores44 at gmail dot com

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).