This bugzilla service is closed. All entries have been migrated to
Bug 1471 - (Visual Studio 2015) wiseMin and cwiseMax functions crash at runtime when built in release mode
Summary: (Visual Studio 2015) wiseMin and cwiseMax functions crash at runtime when bui...
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.3 (current stable)
Hardware: x86 - general Windows
: Normal Crash
Assignee: Nobody
Depends on:
Reported: 2017-09-19 21:39 UTC by Lance Chaney
Modified: 2019-12-04 17:12 UTC (History)
3 users (show)


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:

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