Issue 1:
System information (version)

OpenCV => 4.5.5

Operating System / Platform => Fedora 36

Compiler => GCC 12

Detailed description

The version is not building in the debug mode because of the Werror=return-type warning.

/home/user/.conan/data/opencv/4.5.5/_/_/build/c2ecc42c4fd20695e9185b38647d6dcb62ef4a3a/source_subfolder/modules/gapi/src/compiler/gislandmodel.cpp: In member function 'ade::NodeHandle cv::gimpl::GIsland::producer(const ade::Graph&, const ade::NodeHandle&) const':
/home/user/.conan/data/opencv/4.5.5/_/_/build/c2ecc42c4fd20695e9185b38647d6dcb62ef4a3a/source_subfolder/modules/gapi/src/compiler/gislandmodel.cpp:124:1: error: control reaches end of non-void function [-Werror=return-type]
124 | }
| ^

Steps to reproduce

Just compile with conan with build_type being Debug.

Issue submission checklist

I report the issue, it's not a question

I checked the problem with documentation, FAQ, open issues,

forum.opencv.org, Stack Overflow, etc and have not found any solution

I updated to the latest OpenCV version and the issue is still there

There is reproducer code and related data files: videos, images, onnx, etc

Issue 2:
Compiler: GCC 12.1

Warnings are related to GAPI_Assert(false ...); code.

GAPI_Error() with "noreturn" attribute should be used instead.

[2464/3435] Building CXX object modules/gapi/CMakeFiles/opencv_gapi.dir/src/compiler/gislandmodel.cpp.o
/home/alalek/projects/opencv/dev/modules/gapi/src/compiler/gislandmodel.cpp: In member function ‘ade::NodeHandle cv::gimpl::GIsland::producer(const ade::Graph&, const ade::NodeHandle&) const’:
/home/alalek/projects/opencv/dev/modules/gapi/src/compiler/gislandmodel.cpp:124:1: warning: control reaches end of non-void function [-Wreturn-type]
124 | }
| ^
[2483/3435] Building CXX object modules/gapi/CMakeFiles/opencv_gapi.dir/src/executor/gstreamingexecutor.cpp.o
/home/alalek/projects/opencv/dev/modules/gapi/src/executor/gstreamingexecutor.cpp: In member function ‘bool cv::gimpl::GStreamingExecutor::pull(cv::GRunArgsP&&)’:
/home/alalek/projects/opencv/dev/modules/gapi/src/executor/gstreamingexecutor.cpp:1832:1: warning: control reaches end of non-void function [-Wreturn-type]
1832 | }
| ^
/home/alalek/projects/opencv/dev/modules/gapi/src/executor/gstreamingexecutor.cpp: In member function ‘bool cv::gimpl::GStreamingExecutor::pull(cv::GOptRunArgsP&&)’:
/home/alalek/projects/opencv/dev/modules/gapi/src/executor/gstreamingexecutor.cpp:1863:1: warning: control reaches end of non-void function [-Wreturn-type]
1863 | }
| ^
[2491/3435] Building CXX object modules/gapi/CMakeFiles/opencv_gapi.dir/src/backends/cpu/gcpustereo.cpp.o
In file included from /home/alalek/projects/opencv/dev/modules/core/include/opencv2/core/matx.hpp:52,
from /home/alalek/projects/opencv/dev/modules/core/include/opencv2/core/mat.hpp:51,
from /home/alalek/projects/opencv/dev/modules/gapi/include/opencv2/gapi/opencv_includes.hpp:13,
from /home/alalek/projects/opencv/dev/modules/gapi/include/opencv2/gapi/gmat.hpp:14,
from /home/alalek/projects/opencv/dev/modules/gapi/include/opencv2/gapi/stereo.hpp:10,
from /home/alalek/projects/opencv/dev/modules/gapi/src/backends/cpu/gcpustereo.cpp:7:
/home/alalek/projects/opencv/dev/modules/gapi/src/backends/cpu/gcpustereo.cpp: In static member function ‘static void GCPUStereo::run(const cv::Mat&, const cv::Mat&, cv::gapi::StereoOutputFormat, cv::Mat&, const StereoSetup&)’:
/home/alalek/projects/opencv/dev/modules/core/include/opencv2/core/base.hpp:342:32: warning: this statement may fall through [-Wimplicit-fallthrough=]
342 | #define CV_Assert( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0)
| ^~
/home/alalek/projects/opencv/dev/modules/gapi/include/opencv2/gapi/own/assert.hpp:20:21: note: in expansion of macro ‘CV_Assert’
20 | #define GAPI_Assert CV_Assert
| ^~~~~~~~~
/home/alalek/projects/opencv/dev/modules/gapi/src/backends/cpu/gcpustereo.cpp:66:17: note: in expansion of macro ‘GAPI_Assert’
66 | GAPI_Assert(false && "This case may be supported in future.");
| ^~~~~~~~~~~
/home/alalek/projects/opencv/dev/modules/gapi/src/backends/cpu/gcpustereo.cpp:67:13: note: here
67 | default:
| ^~~~~~~