Modify

Ticket #7272 (closed Patches: fixed)

Opened 20 months ago

Last modified 18 months ago

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

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

Change History

Changed 20 months ago by christian.buss@…

Diff for suggested fix.

comment:1 Changed 20 months ago by viboes

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.

Changed 20 months ago by anonymous

comment:2 Changed 20 months ago by viboes

  • Owner changed from anthonyw to viboes
  • Status changed from new to assigned
  • Version changed from Boost 1.52.0 to Boost 1.51.0

comment:3 Changed 20 months ago by viboes

  • Milestone changed from To Be Determined to Boost 1.52.0

Committed in trunk at [80203]

comment:4 Changed 20 months ago by viboes

Committed in trunk at [80235]

comment:5 Changed 19 months ago by viboes

  • Status changed from assigned to closed
  • Resolution set to fixed

Merged to release [80450]

Changed 19 months ago by gix

test-case

comment:6 Changed 19 months ago by gix

  • Status changed from closed to reopened
  • Resolution fixed deleted
  • Severity changed from Cosmetic to Problem

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.

Changed 19 months ago by gix

Proper patch, reformats asm instructions

comment:7 Changed 19 months ago by viboes

Committed in trunk revision [80757].

comment:8 Changed 18 months ago by viboes

  • Milestone Boost 1.52.0 deleted

comment:9 Changed 18 months ago by viboes

  • Status changed from reopened to closed
  • Resolution set to fixed
  • Milestone set to Boost 1.52.0

Merged revision 80955.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.