[eigen] Clang issue on MacOS when the set variable is used in the given data

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


I've recently updated my Mac to MacOS 10.8 and then by default the compiler used is Clang.

During the running of unit tests in my program I discovered a specific issue with Clang. The same unit tests passed for GCC 4.2 and MSVC 2008.

For example, I have the following code:
Eigen::Matrix<double,4,1> foo;
foo << I, 1.0;
foo << 0.0, rot * (inv * foo).block(1,0,2,1), 1.0;
*JC = (local * foo).block(0,0,3,1);

The content of the line 3 is wrong with Clang, while there is no problem with the other compilers. If I modified the code with the following:
Eigen::Matrix<double,4,1> foo;
foo << I, 1.0;
foo = inv * foo;
foo << 0.0, rot * foo.block(1,0,2,1), 1.0;
*JC = (local * foo).block(0,0,3,1);

Then everything is fine. The difference is how 'foo' is used during the comma initialisation.

In general is is a bad idea to use the first code for any compiler, or should I write a bug report for this case? I read in this ML than the delivered version of Clang for Mac has some problem but I didn't find any page on the website which list these issues. Maybe somewhere in the documentation it should be written to be carefull with Clang (delivered by Apple)?

Arnaud


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/