This bugzilla service is closed. All entries have been migrated to

Bug 1471

Summary: (Visual Studio 2015) wiseMin and cwiseMax functions crash at runtime when built in release mode
Product: Eigen Reporter: Lance Chaney <lance.e.chaney>
Component: Core - generalAssignee: Nobody <eigen.nobody>
Status: NEW ---    
Severity: Crash CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: x86 - general   
OS: Windows   

Description Lance Chaney 2017-09-19 21:39:38 UTC
Seems like I need an account to file a bug report, but I can't make one because registration is closed so I'm just emailing you this.

The cwiseMin and cwiseMax member functions are currently very buggy when built with the visual studio 2015 compiler. Most code using these functions will crash when compiled in release mode. According to this StackOverflow post,, even when it doesn't crash it can produce erroneous results. 

The following code crashes when compiled with Visual Studio 2015 in release mode (both x86 and x64):

#include <Eigen\Core>
#include <iostream>

int main()

    Eigen::Vector3i a(1,1,1);
    Eigen::Vector3i b(10, 10, 10);

    std::cout << a.cwiseMin(b) << std::endl;

    return 0;

The following code only crashes when compiled with x64 release as the target:

#include <iostream>
#include <time.h>

#include <Eigen\Core>

int main() {
	int i = rand();
	Eigen::Vector3i a(i, i, i);
	Eigen::Vector3i b(10, 10, 10);
	Eigen::Vector3i min = a.cwiseMin(b);

	std::cout << min << std::endl;

	return 0;

Note that the above code does not crash if the variable i is replaced with a constant value.

This issue does not appear to be present with the Visual Studio 2017 compiler. This issue currently affects the open source NanoGUI widget library, which now must be compiled using Visual Studio 2017. Unfortunately, many developers are still using Visual Studio 2015 and cannot yet upgrade. See this issue report for more details:
Comment 1 Nobody 2019-12-04 17:12:45 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: