New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error in task_group.h since Visual Studio updated to 15.7.1 #53

Closed
Dimension4 opened this Issue May 10, 2018 · 9 comments

Comments

Projects
None yet
6 participants
@Dimension4

Dimension4 commented May 10, 2018

I'm getting a compiler error

[...]tbb\task_group.h(94): error C2530: 'my_task': references must be initialized

since I've updated Visual Studio to version 15.7.1 (possibly also 15.7).

Just including the main header tbb/tbb.h causes the error to occur (no additional code required). I've also opened a question on stackoverflow.

System info:

  • TBB 2018 Update 3 (just rebuild it using vcpkg package manager, tbb:x64-windows package)
  • Visual Studio 15.7.1
  • Windows 10 Pro x64 1709 (build 16299.431)
@alexey-katranov

This comment has been minimized.

alexey-katranov commented May 11, 2018

I have failed to reproduce the issue with Visual Studio (without vcpkg). I tried c++17 and c++latest but tbb/tbb.h is compiled successfully. Is it possible to capture the compiler switches (in the output log) when the compiler is invoked with vcpkg?

@ras0219-msft

This comment has been minimized.

ras0219-msft commented May 11, 2018

If I understand the issue correctly, then the only relevance vcpkg has is that it adds the folder containing tbb/tbb.h to the MSBuild additional include directories (which translates to a /I). Notably, we don't modify the user's /std:xyz setting.

@Dimension4

This comment has been minimized.

Dimension4 commented May 13, 2018

@alexey-katranov The compiler for the debug build is invoked with

CL.exe /c /I. /Zi /nologo /W4 /WX- /diagnostics:classic /Od /D _WINDLL /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"C:\libs\vcpkg\buildtrees\tbb\src\tbb-633b01ad27e012e1dc4e392c3230250d1f4967a4\build\vs2013\x64\tbb\Debug\\" /Fd"C:\libs\vcpkg\buildtrees\tbb\src\tbb-633b01ad27e012e1dc4e392c3230250d1f4967a4\build\vs2013\x64\tbb\Debug\vc141.pdb" /Gd /TP /FC /errorReport:queue   /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D__TBB_LIB_NAME=tbb_debug.lib /DDO_ITT_NOTIFY /GS /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0502 /D__TBB_BUILD=1 /W4 /I../../src /I../../src/rml/include /I../../include ..\..\src\tbb\concurrent_hash_map.cpp ..\..\src\tbb\concurrent_queue.cpp ..\..\src\tbb\concurrent_vector.cpp ..\..\src\tbb\dynamic_link.cpp ..\..\src\tbb\itt_notify.cpp ..\..\src\tbb\cache_aligned_allocator.cpp ..\..\src\tbb\pipeline.cpp ..\..\src\tbb\queuing_mutex.cpp ..\..\src\tbb\queuing_rw_mutex.cpp ..\..\src\tbb\reader_writer_lock.cpp ..\..\src\tbb\spin_rw_mutex.cpp ..\..\src\tbb\x86_rtm_rw_mutex.cpp ..\..\src\tbb\spin_mutex.cpp ..\..\src\tbb\critical_section.cpp ..\..\src\tbb\mutex.cpp ..\..\src\tbb\recursive_mutex.cpp ..\..\src\tbb\condition_variable.cpp ..\..\src\tbb\tbb_thread.cpp ..\..\src\tbb\concurrent_monitor.cpp ..\..\src\tbb\semaphore.cpp ..\..\src\tbb\private_server.cpp ..\..\src\rml\client\rml_tbb.cpp ..\..\src\tbb\tbb_misc.cpp ..\..\src\tbb\tbb_misc_ex.cpp ..\..\src\tbb\task.cpp ..\..\src\tbb\task_group_context.cpp ..\..\src\tbb\governor.cpp ..\..\src\tbb\market.cpp ..\..\src\tbb\arena.cpp ..\..\src\tbb\scheduler.cpp ..\..\src\tbb\observer_proxy.cpp ..\..\src\tbb\tbb_statistics.cpp ..\..\src\tbb\tbb_main.cpp ..\..\src\old\concurrent_vector_v2.cpp ..\..\src\old\concurrent_queue_v2.cpp ..\..\src\old\spin_rw_mutex_v2.cpp ..\..\src\old\task_v2.cpp

I just verified the error on another machine.

@alexey-katranov

This comment has been minimized.

alexey-katranov commented May 25, 2018

@Dimension4 I tried your command but it does not reproduce the issue. Could you, please, repeat my experiment to understand if the issue relates to the specific environment or vcpkg somehow? I source the Visual Studio environment for 'x64' and build the TBB sources with the provided command:

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.7.1
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

> CL.exe /c /I. /Zi /nologo /W4 /WX- /diagnostics:classic /Od /D _WINDLL /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"C:\libs\vcpkg\buildtrees\tbb\src\tbb-633b01ad27e012e1dc4e392c3230250d1f4967a4\build\vs2013\x64\tbb\Debug\\" /Fd"C:\libs\vcpkg\buildtrees\tbb\src\tbb-633b01ad27e012e1dc4e392c3230250d1f4967a4\build\vs2013\x64\tbb\Debug\vc141.pdb" /Gd /TP /FC /errorReport:queue   /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D__TBB_LIB_NAME=tbb_debug.lib /DDO_ITT_NOTIFY /GS /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0502 /D__TBB_BUILD=1 /W4 /I../../src /I../../src/rml/include /I../../include ..\..\src\tbb\concurrent_hash_map.cpp ..\..\src\tbb\concurrent_queue.cpp ..\..\src\tbb\concurrent_vector.cpp ..\..\src\tbb\dynamic_link.cpp ..\..\src\tbb\itt_notify.cpp ..\..\src\tbb\cache_aligned_allocator.cpp ..\..\src\tbb\pipeline.cpp ..\..\src\tbb\queuing_mutex.cpp ..\..\src\tbb\queuing_rw_mutex.cpp ..\..\src\tbb\reader_writer_lock.cpp ..\..\src\tbb\spin_rw_mutex.cpp ..\..\src\tbb\x86_rtm_rw_mutex.cpp ..\..\src\tbb\spin_mutex.cpp ..\..\src\tbb\critical_section.cpp ..\..\src\tbb\mutex.cpp ..\..\src\tbb\recursive_mutex.cpp ..\..\src\tbb\condition_variable.cpp ..\..\src\tbb\tbb_thread.cpp ..\..\src\tbb\concurrent_monitor.cpp ..\..\src\tbb\semaphore.cpp ..\..\src\tbb\private_server.cpp ..\..\src\rml\client\rml_tbb.cpp ..\..\src\tbb\tbb_misc.cpp ..\..\src\tbb\tbb_misc_ex.cpp ..\..\src\tbb\task.cpp ..\..\src\tbb\task_group_context.cpp ..\..\src\tbb\governor.cpp ..\..\src\tbb\market.cpp ..\..\src\tbb\arena.cpp ..\..\src\tbb\scheduler.cpp ..\..\src\tbb\observer_proxy.cpp ..\..\src\tbb\tbb_statistics.cpp ..\..\src\tbb\tbb_main.cpp ..\..\src\old\concurrent_vector_v2.cpp ..\..\src\old\concurrent_queue_v2.cpp ..\..\src\old\spin_rw_mutex_v2.cpp ..\..\src\old\task_v2.cpp
task_v2.cpp
spin_rw_mutex_v2.cpp
concurrent_queue_v2.cpp
concurrent_vector_v2.cpp
tbb_main.cpp
tbb_statistics.cpp
observer_proxy.cpp
scheduler.cpp
arena.cpp
market.cpp
governor.cpp
task_group_context.cpp
task.cpp
tbb_misc_ex.cpp
tbb_misc.cpp
rml_tbb.cpp
private_server.cpp
semaphore.cpp
concurrent_monitor.cpp
tbb_thread.cpp
Generating Code...
Compiling...
condition_variable.cpp
recursive_mutex.cpp
mutex.cpp
critical_section.cpp
spin_mutex.cpp
x86_rtm_rw_mutex.cpp
spin_rw_mutex.cpp
reader_writer_lock.cpp
queuing_rw_mutex.cpp
queuing_mutex.cpp
pipeline.cpp
cache_aligned_allocator.cpp
itt_notify.cpp
dynamic_link.cpp
concurrent_vector.cpp
concurrent_queue.cpp
concurrent_hash_map.cpp
Generating Code...

> cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.14.26428.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.
@bheld

This comment has been minimized.

bheld commented Jun 19, 2018

Simply removing /permissive- (e.g. set Comformance Mode to No in the C/C++ options) gets past this issue. I would think Intel would fix this soon)

@akukanov

This comment has been minimized.

akukanov commented Jun 21, 2018

Indeed, adding /permissive- allows to reproduce the issue (with VS 15.7.4 / compiler version 19.14.26431 in my case).

However, this is a compiler bug. The code is perfectly valid, compliant C++; the reference is explicitly initialized in the initializer list of the constructor, as it can be seen in the code:

ref_count_guard( task& t ) : my_task(t) {

Note also that this is seemingly a regression in VS, because at least the initial release of VS 2017 (15.0.something) compiles the code even with /permissive-.

I have tried to remove inheritance from no_copy and explicitly declare the default ctor and copy ctor as deleted, however this did not help. The only other way to work it around I could think of is to use a pointer instead of reference; but this is quite undesirable.

@bheld

This comment has been minimized.

bheld commented Jun 21, 2018

Do you happen to know if Intel has reported this bug to Microsoft?

@akukanov

This comment has been minimized.

akukanov commented Nov 22, 2018

A workaround was added into TBB 2019 Update 1.

@tbbdev tbbdev closed this Nov 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment