Modify

#11832 closed Bugs (fixed)

clang-cl + boost intrusive = miscompile

Reported by: Yaron Keren <yaron.keren@…> Owned by: igaztanaga
Milestone: To Be Determined Component: intrusive
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

I'm not sure what the problem source is, but boost intrusive examples fail when compiled with clang-cl (but pass with clang targetting mingw).

Attached is a reduced example doc_how_to_use.cpp and a batch file running it under clang(mingw), cl, clang-cl. The two reported address should be the identical per the original example which compares them. Yet, clang-cl (last) prints different addresses:

clang++ (i686,mingw)
values=0x3519d0 memberlist = 0x3519d0
cl
doc_how_to_use.cpp
values=003D96D0 memberlist = 003D96D0
clang-cl
values=005196D0 memberlist = 005196D1

clang version 3.8.0 (trunk 253440).

Attachments (3)

doc.bat (464 bytes) - added by Yaron Keren <yaron.keren@…> 19 months ago.
doc.2.bat (464 bytes) - added by Yaron Keren <yaron.keren@…> 19 months ago.
doc_how_to_use.cpp (706 bytes) - added by Yaron Keren <yaron.keren@…> 19 months ago.

Download all attachments as: .zip

Change History (5)

Changed 19 months ago by Yaron Keren <yaron.keren@…>

Changed 19 months ago by Yaron Keren <yaron.keren@…>

Changed 19 months ago by Yaron Keren <yaron.keren@…>

comment:1 Changed 19 months ago by Yaron Keren <yaron.keren@…>

Reid Kleckner diagnosed the problem in https://llvm.org/bugs/show_bug.cgi?id=25761:

In boost/intrusive/detail/parent_from_member.hpp, the implementation of offset_from_pointer_to_member goes down the #idefs to the #else case, which subtracts one from the offset to create the off-by-one pointer. BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER should be defined for clang-cl.

This could be fixed by modifying parent_from_member.hpp:26 from:

#if defined(BOOST_MSVC) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && defined(BOOST_INTEL))

to:

#if defined(_MSC_VER) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && defined(BOOST_INTEL))

since BOOST_MSVC is defined only for Visual C++ while _MSC_VER is defined for both Visual C++ and clang-cl.

comment:2 Changed 16 months ago by igaztanaga

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain igaztanaga.
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.