G
Guest
I'm new to this list so please forgive in case this is not the correct forum.
If so, please let me know to where I can direct bug reports for vc.
The following crashes using whole program optimization (i.e. invoking LTCG)
under vc7.1 Professional.
#include <string>
#include <boost/function.hpp>
#include <boost/bind.hpp>
void f(std::string, int) { }
void main()
{
std::string s;
boost::function<void()> fp = boost::bind(f, s, 42);
}
///////
Other optimization flags besides WPO doesn't seem to change the behaviour.
Executing the above code will result in, at best, a corrupt stack pointer
after returning from boost::bind. More likely a segmentation fault will occur
when the std::string is copied due to misalignment in the stack frame (the
stack reference to the first string is incorrect when creating a copy for the
bind() call).
Either way it will crash.
Changing the order of arguments for the f() declaration and accordingly for
the bind() from (std::string, int) to (int, std::string) produces correct
code.
Procedure:
*New Win32 Console project
*Select Release compile
*Add include path to the boost distribution
* Turn on WPO
* Run the above code and it will crash
Any information regarding this issue would be appreciated.
Regards,
Christian
If so, please let me know to where I can direct bug reports for vc.
The following crashes using whole program optimization (i.e. invoking LTCG)
under vc7.1 Professional.
#include <string>
#include <boost/function.hpp>
#include <boost/bind.hpp>
void f(std::string, int) { }
void main()
{
std::string s;
boost::function<void()> fp = boost::bind(f, s, 42);
}
///////
Other optimization flags besides WPO doesn't seem to change the behaviour.
Executing the above code will result in, at best, a corrupt stack pointer
after returning from boost::bind. More likely a segmentation fault will occur
when the std::string is copied due to misalignment in the stack frame (the
stack reference to the first string is incorrect when creating a copy for the
bind() call).
Either way it will crash.
Changing the order of arguments for the f() declaration and accordingly for
the bind() from (std::string, int) to (int, std::string) produces correct
code.
Procedure:
*New Win32 Console project
*Select Release compile
*Add include path to the boost distribution
* Turn on WPO
* Run the above code and it will crash
Any information regarding this issue would be appreciated.
Regards,
Christian