Opened 9 years ago

Closed 8 years ago

#9266 closed Bugs (worksforme)

Synchronized_value crashes MSVC12 (VS2013)

Reported by: mjklaim@… Owned by: viboes
Milestone: To Be Determined Component: config
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description (last modified by viboes)

I got the crash using the following full code (using boost trunk r86347 ):

    #include<boost/thread/synchronized_value.hpp>
    
    boost::synchronized_value<int> foo;		

Which produce the following error (ignore the file name, it contains exactly the code above):

1>  clock.cpp
1>e:\projects\sdk\boost\boost\include\boost-1_55\boost\thread\synchronized_value.hpp(401): fatal error C1001: An internal error has occurred in the compiler.
1>  (compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\types.c', line 12852)
1>   To work around this problem, try simplifying or changing the program near the locations listed above.
1>  Please choose the Technical Support command on the Visual C++ 
1>   Help menu, or open the Technical Support help file for more information
1>          e:\projects\games\netrush\netrush_projects\projects\netrush\system\core\clock.hpp(120) : see reference to class template instantiation 'boost::synchronized_value<int,boost::mutex>' being compiled
Build has been canceled.

Note that I reported another problem similar in MSVC12 RC: connect.microsoft.com/VisualStudio/feedback/details/802157/compiler-crash-mixing-boost-synchronized-value-and-boost-property-tree I'm not sure if it's related.

Change History (9)

comment:1 by mjklaim@…, 9 years ago

Removing the ifdefs in the synchronized_value related to BOOST_NO_CXX11_VARIADIC_TEMPLATES, and taking the code using variadic templates does fix the problem for me.

comment:2 by viboes, 9 years ago

Description: modified (diff)
Owner: changed from Anthony Williams to viboes
Status: newassigned

in reply to:  1 comment:3 by viboes, 9 years ago

Replying to mjklaim@…:

Removing the ifdefs in the synchronized_value related to BOOST_NO_CXX11_VARIADIC_TEMPLATES, and taking the code using variadic templates does fix the problem for me.

Please, could you provide a patch that resolve the issue, I don't understand which part must be removed in your case.

comment:4 by mjklaim@…, 9 years ago

Sorry! I meant:

  1. go into synchronized_value.hpp
  2. search ifdefs testing BOOST_NO_CXX11_VARIADIC_TEMPLATES (there are 2 if I'm correct)
  3. remove the ifdef and keep only the code that does use variadic templates.

Then boost::synchronized_value<int> does compile for me. I also forgot to say that I'm using the last boost thread interface (V4?).

I'm currently recompiling this revision of trunk boost with BOOST_NO_CXX11_VARIADIC_TEMPLATES defined only for MSVC <= VC11 , see if it impacts my current code (I suspect it will break my signals2 usage as said in the mailing list but I want to be sure).

comment:5 by viboes, 9 years ago

Component: threadconfig

Whether BOOST_NO_CXX11_VARIADIC_TEMPLATES must be defined or not is out of the scope of Boost.Thread and we need to fix it in Boost.Config.

Anyway it is a shame that Microsoft has not checked MSVC12 RC against the regression tests in boost before delivering.

Last edited 9 years ago by viboes (previous) (diff)

in reply to:  5 comment:6 by mjklaim@…, 9 years ago

Replying to viboes:

Anyway it is a shame that Microsoft has not checked MSVC12 RC against the regression tests in boost before delivering.

That being said, synchronized_value worked correctly with MSVC12 RC, at least in the revision I used in the past months (which I believe was r85663 ). Yesterday I was still using this revision with MSVC12 RC and had no other problem than this one: connect.microsoft.com/VisualStudio/feedback/details/802157/compiler-crash-mixing-boost-synchronized-value-and-boost-property-tree

I didn't check if something changed in config or synchronized_value since them so there are several potential source of problem here.

comment:7 by viboes, 9 years ago

The last commit in synchronized_value was [85306].

comment:8 by John Maddock, 9 years ago

There's a message thread on the lists to the effect that variadic templates are not fully supported yet: http://lists.boost.org/Archives/boost/2013/09/206389.php so I'm reluctant to re-enable them in Boost.Config. Sounds like this is a good case where a BOOST_WORKAROUND would be more appropriate in the thread lib?

BTW am I alone in finding it ironic that the way to work around a compiler bug is to enable an only-partially-working new feature? Oh well!

The change I'm suggesting for synchronized_value.hpp is to change:

#if ! defined BOOST_NO_CXX11_VARIADIC_TEMPLATES

to

#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || BOOST_WORKAROUND(BOOST_MSVC, == 1800)

comment:9 by John Maddock, 8 years ago

Resolution: worksforme
Status: assignedclosed

Update: this works for me with current develop and master branches and released VC12.

Note: See TracTickets for help on using tickets.