[cfe-dev] Strange dimension errors in a custom matrix class

Tony Kelman kelman at berkeley.edu
Fri Feb 7 17:48:35 PST 2014


I'm working with the package PSOPT ( http://www.psopt.org/ ), I haven't 
found much evidence in its user group of anyone compiling its custom matrix 
class using Clang - which is a little bit surprising considering OS X 
Mavericks. I was able to put together a Homebrew formula to get the package 
to compile using Apple clang on OS X 10.9 with all of its prerequisites, but 
I'm seeing some strange runtime errors that don't occur when the same code 
is built with g++. I've tried to cut down the class in question and reduce 
the error to a small test case, and posted the result at 
https://gist.github.com/8875125

For some reason building with clang (from package clang-3.3 on Ubuntu 13.10, 
or with Xcode CLT in OS X 10.9), the DMatrix colon() operator results in 
different dimensions at an intermediate iteration of the for loop at line 67 
of dmtest.cxx. All dimensions are expected to remain constant, but according 
to lldb/gdb they are not. Is there a bug in one of the DMatrix class 
operators that's resulting in incorrect or undefined behavior that just gets 
lucky with g++, or what? I'm stumped at this point. I hope this is the right 
place to ask this kind of question (aside from the user group and developers 
of the PSOPT package, where I made a post earlier today 
https://groups.google.com/forum/#!topic/psopt-users-group/Psxeb1nVg_4 ), if 
there's anything else I can provide please let me know.

Regards,
Tony




More information about the cfe-dev mailing list