This bugzilla service is closed. All entries have been migrated to
Bug 1125 - ICE with VS2015 Update 1 and /openmp
Summary: ICE with VS2015 Update 1 and /openmp
Status: RESOLVED DUPLICATE of bug 1096
Alias: None
Product: Eigen
Classification: Unclassified
Component: General (show other bugs)
Version: 3.3 (current stable)
Hardware: All Windows
: Normal Compilation Problem
Assignee: Nobody
Depends on:
Blocks: 3.3
  Show dependency treegraph
Reported: 2015-12-02 00:38 UTC by patrikhuber
Modified: 2019-12-04 15:14 UTC (History)
3 users (show)


Description patrikhuber 2015-12-02 00:38:48 UTC
The following code causes an internal compiler error in VS2015 Update 1 when compiling with /openmp...

#include "Eigen/Core"

int main(int argc, char *argv[])
	Eigen::MatrixXf A_Eigen;
	Eigen::MatrixXf AtA_Eigen = A_Eigen.transpose() * A_Eigen;

1>------ Build started: Project: rcr-detect, Configuration: Debug x64 ------
1>  test.cpp
1>c:\eigen-3.3-alpha1\eigen\src\core\products\generalmatrixmatrix.h(66): fatal error C1001: An internal error has occurred in the compiler.
1>  (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 246)
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

Error occurs both in Release and Debug mode. It compiled fine in VS2015 (before Update 1). Also the error goes away if I remove /openmp.

I'll file a bug in MS Connect too, but is there anything we can do as a workaround?
Comment 1 Gael Guennebaud 2015-12-02 08:38:17 UTC
The only way to find a workaround (if any) would be to try to comment some code in Eigen (within general_matrix_matrix_product::run are within the callee) to find what really confuse MSVC... I'm definitely not going to do so, but if you find a concrete line of code, I can probably help in suggesting workarounds.

Also, it seems to be exactly the same as bug 1096.
Comment 2 patrikhuber 2015-12-02 12:15:03 UTC
Yep, that bug looks the same. Though its title sucks a bit, it's not "CTP1" - what he meant was probably "VS2015 Update 1 CTP", which came out in October. My bug is related to Update 1 RTM (the "final") that came out a couple of days ago. Sadly, it seems to have the same bug. Also my code is a lot shorter and isolates the bug better.

I'll try to experiment a bit more if I can find some time. Would also be nice if at least one other person could confirm the same behaviour.
Comment 3 patrikhuber 2015-12-02 12:22:30 UTC
Had a quick try:

If I remove the
#pragma omp atomic
from GeneralMatrixMatrix.h line 151, the ICE disappears.
Comment 4 patrikhuber 2015-12-02 12:31:37 UTC
I can confirm the offending code is in that section.

      #pragma omp critical
      for(Index i=0; i<threads; ++i)
        #pragma omp atomic

If I remove the #pragma omp atomic, the code compiles. (but probably won't do what it's intended to do anymore.

Also if I change 
to something silly like "++i;", the code also compiles.

It thus seems to depend on the #pragma omp atomic and what is actually inside the section too.
Comment 5 Christoph Hertzberg 2015-12-02 12:40:44 UTC
Does the following work?

    int& users = info[i].users;
    #pragma omp atomic
Comment 6 patrikhuber 2015-12-02 12:45:09 UTC
@Christoph: No, it gives a

Error	C2440	'initializing': cannot convert from 'volatile int' to 'int &'

If I change it to
volatile int& users = info[i].users;
(or even "auto& users = ..."), I get the ICE again.
Comment 7 Christoph Hertzberg 2015-12-02 12:55:25 UTC
(In reply to patrikhuber from comment #6)
> Error	C2440	'initializing': cannot convert from 'volatile int' to 'int &'

Sorry, of course it has to be `volatile int`. But apparently, that did not help. I don't see any other obvious work-around, at the moment.
Comment 8 patrikhuber 2015-12-02 13:08:28 UTC
Okay, thank you!

Here's the link to the connect bug:

I tried to update it with this new information, but it wouldn't let me add comments...
Comment 9 Christoph Hertzberg 2015-12-03 15:10:29 UTC
Does the workaround suggested in Bug 1096 comment 4 work for you?
Comment 10 patrikhuber 2015-12-04 07:39:10 UTC
Yep, this makes the ICE go away and it compiles!
Comment 11 Gael Guennebaud 2015-12-04 08:30:03 UTC

*** This bug has been marked as a duplicate of bug 1096 ***
Comment 12 Nobody 2019-12-04 15:14:29 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.