-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Coverity issues for acl_mem_test.cpp
#263
Conversation
There is an additional Coverity error for this file that is causing me some confusion and that I will need to look into some more before implementing. This issue's fix should be added to the PR before being merged with main. This error output is quite large, so I'll only leave in the important bits so we can discuss it:
To explain what's happening, we pass in a pointer to a single event What's even stranger (and possibly the cause of Coverity misrecognizing this issue) is that Coverity is contradicting itself in its own analysis... |
The easiest (and maybe only?) solution to this would be to mark it as a false positive using a comment. I don't think it's possible to remove this Coverity issue by rearranging/reordering nearby code. Maybe there is a better way that I'm not thinking of. Any thoughts @pcolberg? I'll continue investigating this issue. |
I have yet to understand Coverity's analysis, but I am confident this issue can be resolved too. |
The Coverity issue is resolved by passing an array: --- a/test/acl_mem_test.cpp
+++ b/test/acl_mem_test.cpp
@@ -2652,9 +2652,10 @@ MT_TEST(acl_mem, fill_image) {
CHECK_EQUAL(CL_INVALID_EVENT_WAIT_LIST,
clEnqueueFillImage(m_cq, image, fill_color_int, origin, region,
1, NULL, &fill_event)); // invalid wait list
+ cl_event event_wait_list[1];
CHECK_EQUAL(CL_INVALID_EVENT_WAIT_LIST,
clEnqueueFillImage(m_cq, image, fill_color_int, origin, region,
- 0, &fill_event,
+ 0, event_wait_list,
&fill_event)); // invalid wait list
CHECK_EQUAL(1, acl_ref_count(image)); I have yet to understand what the underlying issue is. |
There are actually three cases of --- a/src/acl_event.cpp
+++ b/src/acl_event.cpp
@@ -843,12 +843,14 @@ cl_int acl_create_event(cl_command_queue command_queue, cl_uint num_events,
// Fill active_dependency[] by removing duplicates from events[].
for (cl_uint i = 0; i < num_events; i++) {
+#if 0
if (active_dependency.find(events[i]) == active_dependency.end()) {
// If an event is already finished, no need to add a dependency on it
if (!acl_event_is_done(events[i])) {
active_dependency.insert(events[i]);
}
}
+#endif
}
// Now add dependency arcs.
for (cl_event dependency : active_dependency) {
@@ -997,6 +999,7 @@ cl_int acl_check_events_in_context(cl_context context, cl_uint num_events,
}
for (i = 0; i < num_events; i++) {
+#if 0
cl_event event = events[i];
// check the event and context based on the event status
@@ -1010,6 +1013,7 @@ cl_int acl_check_events_in_context(cl_context context, cl_uint num_events,
acl_context_callback(context, "Event from incorrect context");
return CL_INVALID_CONTEXT;
}
+#endif
}
return CL_SUCCESS;
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be merged since these fixes are fine and not related to the ARRAY_VS_SINGLETON
issue. You may or may not want to do more investigation into why Coverity is getting confused, but from a web search for ARRAY_VS_SINGLETON
I could not find any hints other than this being a false positive. You can go ahead and open a new PR with workarounds similar to #263 (comment) that resolve all three cases of ARRAY_VS_SINGLETON
and document your analysis in the commit message.
Yesterday I was attempting this solution but I didn't finish running the Coverity scan. Glad to know it works! |
This mainly fixes various PRINTF_ARGS errors.