-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8320353: Reenable stringop-overflow warnings #26067
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
Changes from all commits
6739a18
169a773
db39eb5
231480b
06b3412
452d598
3289ff1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -923,6 +923,17 @@ int CodeInstaller::estimate_stubs_size(HotSpotCompiledCodeStream* stream, JVMCI_ | |
| // perform data and call relocation on the CodeBuffer | ||
| JVMCI::CodeInstallResult CodeInstaller::initialize_buffer(JVMCIObject compiled_code, CodeBuffer& buffer, HotSpotCompiledCodeStream* stream, u1 code_flags, JVMCI_TRAPS) { | ||
| JavaThread* thread = stream->thread(); | ||
| #if defined(__GNUC__) && !defined(__clang__) && !defined(PRODUCT) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that |
||
| if (thread == nullptr) { | ||
| // This is to prevent --stringop-overflow warning from GCC on linux/fastdebug. | ||
| // GCC does believe that JavaThread::current() can return nullptr, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| // though it cannot. | ||
| // GCC seems to not remember that this hint has been given to it when initializing | ||
| // HotSpotCompiledCodeStream object with a thread returned by JavaThread::current(), | ||
| // therefore 2nd hint is needed. | ||
| __builtin_unreachable(); | ||
| } | ||
| #endif | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this could be replaced with asserting non-null. A failed assert calls a noreturn reporting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although I wonder why the assert in Thread::current() isn't sufficient? Maybe non-null info isn't |
||
| HandleMark hm(thread); | ||
| int locs_buffer_size = _sites_count * (relocInfo::length_limit + sizeof(relocInfo)); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1067,7 +1067,16 @@ class JavaThread: public Thread { | |
| public: | ||
| // Returns the running thread as a JavaThread | ||
| static JavaThread* current() { | ||
| return JavaThread::cast(Thread::current()); | ||
| auto result = JavaThread::cast(Thread::current()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why auto when the type is known? |
||
| #if defined(__GNUC__) && !defined(__clang__) && !defined(PRODUCT) | ||
| if (result == nullptr) { | ||
| // This is to prevent --stringop-overflow warning from GCC on linux/fastdebug. | ||
| // GCC does believe that JavaThread::current() can return nullptr, | ||
| // though it cannot. | ||
| __builtin_unreachable(); | ||
| } | ||
| #endif | ||
| return result; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly here, I think this could be replaced with asserting non-null. |
||
| } | ||
|
|
||
| // Returns the current thread as a JavaThread, or nullptr if not attached | ||
|
|
||
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.
What about this one in shenandoahLock.cpp?