Opened 10 years ago
Closed 10 years ago
#7272 closed Patches (fixed)
win32/thread_primitives.hpp: (Unneccessary) Warning
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.52.0 | Component: | thread |
Version: | Boost 1.51.0 | Severity: | Problem |
Keywords: | Cc: |
Description
When compiling with the Intel C++ compiler 12.1, I receive an (unneccessary) warning about an uninitialised variable 'ret':
1>thread_primitives.hpp(356): warning #592: variable "ret" is used before its value is set 1> return ret; 1> 1> 1>thread_primitives.hpp(377): warning #592: variable "ret" is used before its value is set 1> return ret; 1>
Suggested fix: See attached file
Attachments (4)
Change History (13)
by , 10 years ago
Attachment: | thread_primitives.hpp.diff added |
---|
comment:1 by , 10 years ago
In order to avoid the unnecessary assignation for all the compilers I think it is better to apply it conditionally. In addition the current code causing the warning was there for Intel compiler, so the attached patch should work.
by , 10 years ago
Attachment: | 7272.patch added |
---|
comment:2 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Version: | Boost 1.52.0 → Boost 1.51.0 |
comment:3 by , 10 years ago
Milestone: | To Be Determined → Boost 1.52.0 |
---|
Committed in trunk at [80203]
comment:6 by , 10 years ago
Resolution: | fixed |
---|---|
Severity: | Cosmetic → Problem |
Status: | closed → reopened |
The warning reported by ICL points at a serious bug. Changesets [80203] and [80235] only silence the warning.
ICL seems to only accept newlines as separator between asm instructions and only emits "mov eax,bit", which makes interlocked_bit_test_and_set return an ret uninitialized.
Running the attached test case:
$ icl -nologo -EHsc boost-7272.cpp && boost-7272.exe boost-7272.cpp Testing bit 0 of x=3 result: 0 (expected: 1) x: 3 (expected: 3) Testing bit 2 of x=3 result: 0 (expected: 0) x: 3 (expected: 7)
As a comparison, here with MSVC:
D:\>cl -nologo -EHsc boost-7272.cpp && boost-7272.exe boost-7272.cpp Testing bit 0 of x=3 result: 1 (expected: 1) x: 3 (expected: 3) Testing bit 2 of x=3 result: 0 (expected: 0) x: 7 (expected: 7)
Putting each instruction on a separate line (with and without trailing ";") fixes this.
by , 10 years ago
Attachment: | boost-7272-proper.patch added |
---|
Proper patch, reformats asm instructions
comment:8 by , 10 years ago
Milestone: | Boost 1.52.0 |
---|
comment:9 by , 10 years ago
Milestone: | → Boost 1.52.0 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Merged revision 80955.
Diff for suggested fix.