-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Remove unused variable warning in H5C.c #2844
Conversation
Sunspot compiler throws a warning.
This warning occurs with the following configuration:
|
src/H5C.c
Outdated
@@ -6579,8 +6579,10 @@ H5C__make_space_in_cache(H5F_t *f, size_t space_needed, hbool_t write_permitted) | |||
H5C_cache_entry_t *entry_ptr; | |||
H5C_cache_entry_t *prev_ptr; | |||
H5C_cache_entry_t *next_ptr; | |||
uint32_t num_corked_entries = 0; | |||
herr_t ret_value = SUCCEED; /* Return value */ | |||
#if !defined(SYCL_LANGUAGE_VERSION) || !defined(__INTEL_LLVM_COMPILER) |
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.
I don't understand how this can be undefined - it is incremented in line 6631. And the value is used in an assert at line 6758.
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.
Ask the developer who wrote H5C.c.
The responsible coder should understand this behavior.
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 is likely a false positive by the compiler based on the code below. And since it failed to compile on ubuntu when the variable was removed before #if !defined(SYCL_LANGUAGE_VERSION) || !defined(__INTEL_LLVM_COMPILER)
was added, this will probably fail to compile for ICC in the absence of any compiler bugs. At a minimum, further uses of num_corked_entries
below would need to also be surrounded by #if !defined(SYCL_LANGUAGE_VERSION) || !defined(__INTEL_LLVM_COMPILER)
, but I don't believe that's the correct fix.
The https://cs.illinois.edu/academics/courses/cs426 in 1996 reminded me how to fix it. |
Hmm interesting, does ICX still give a warning if you use |
Regardless this is a compiler flaw so I don't see why we should be working around it. |
This was probably about the variable only being used for the later assert(). I have a fix for it in my current cache PR, so will resolve this issue there (and revert this particular change, probably). |
* Add failure value where it's missing from 1+ macros. Clean up whitespace / continuation characters ('\'). Made hash-table macros generic for use in both the package header and test header. Remove duplicated copy & pasted macros (by hoisting difference into #ifdef'd macro). Updated and re-flowed comments to read better. Also clean up a few compiler warnings in production builds. Signed-off-by: Quincey Koziol <quincey@koziol.cc> * Committing clang-format changes * Remove unused variable warning in H5C.c (#2844) * Remove trailing /* NDEBUG */ comment from #endif's * Committing clang-format changes --------- Signed-off-by: Quincey Koziol <quincey@koziol.cc> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Add failure value where it's missing from 1+ macros. Clean up whitespace / continuation characters ('\'). Made hash-table macros generic for use in both the package header and test header. Remove duplicated copy & pasted macros (by hoisting difference into #ifdef'd macro). Updated and re-flowed comments to read better. Also clean up a few compiler warnings in production builds. Signed-off-by: Quincey Koziol <quincey@koziol.cc> * Committing clang-format changes * Remove unused variable warning in H5C.c (HDFGroup#2844) * Remove trailing /* NDEBUG */ comment from #endif's * Committing clang-format changes --------- Signed-off-by: Quincey Koziol <quincey@koziol.cc> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sunspot compiler (icx) throws a warning.
CMAKE_C_COMPILER:FILEPATH=/soft/restricted/CNDA/updates/2022.12.30.001/oneapi/\ cmpiler/trunk-20230201/compiler/linux/bin/icx
See https://my.cdash.org/viewBuildError.php?type=1&buildid=2327793 for details.