Opened 10 years ago

Closed 10 years ago

#7272 closed Patches (fixed)

win32/thread_primitives.hpp: (Unneccessary) Warning

Reported by: christian.buss@… 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)

thread_primitives.hpp.diff (700 bytes ) - added by christian.buss@… 10 years ago.
Diff for suggested fix.
7272.patch (1.2 KB ) - added by anonymous 10 years ago.
boost-7272.cpp (721 bytes ) - added by gix 10 years ago.
test-case
boost-7272-proper.patch (1.2 KB ) - added by gix 10 years ago.
Proper patch, reformats asm instructions

Download all attachments as: .zip

Change History (13)

by christian.buss@…, 10 years ago

Attachment: thread_primitives.hpp.diff added

Diff for suggested fix.

comment:1 by viboes, 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 anonymous, 10 years ago

Attachment: 7272.patch added

comment:2 by viboes, 10 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned
Version: Boost 1.52.0Boost 1.51.0

comment:3 by viboes, 10 years ago

Milestone: To Be DeterminedBoost 1.52.0

Committed in trunk at [80203]

comment:4 by viboes, 10 years ago

Committed in trunk at [80235]

comment:5 by viboes, 10 years ago

Resolution: fixed
Status: assignedclosed

Merged to release [80450]

by gix, 10 years ago

Attachment: boost-7272.cpp added

test-case

comment:6 by gix, 10 years ago

Resolution: fixed
Severity: CosmeticProblem
Status: closedreopened

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 gix, 10 years ago

Attachment: boost-7272-proper.patch added

Proper patch, reformats asm instructions

comment:7 by viboes, 10 years ago

Committed in trunk revision [80757].

comment:8 by viboes, 10 years ago

Milestone: Boost 1.52.0

comment:9 by viboes, 10 years ago

Milestone: Boost 1.52.0
Resolution: fixed
Status: reopenedclosed

Merged revision 80955.

Note: See TracTickets for help on using tickets.