found 491137 4.3.3-1 thanks Finally I got around to produce a tiny example from the original code that reproduces the bug. The attached code contains several notes on which parts seem to be essential (e.g., using ::std::string in some way). To reproduce do
g++ -g -O2 -o invariance_annotation invariance_annotation.preproc.cpp ./invariance_annotation vs. g++ -g -O2 -DVOLATILE -o invariance_annotation invariance_annotation.preproc.cpp ./invariance_annotation All experiments were done in the sid chroot on zelenka.d.o. Hope this helps, Michael
// try: // g++ -O2 -o invariance_annotation invariance_annotation.preproc.cpp ; ./invariance_annotation // g++ -O2 -DVOLATILE -o invariance_annotation invariance_annotation.preproc.cpp ; ./invariance_annotation // Was fine on g++ 4.2, only happens on s390; adding -g does not change the behaviour struct Dummy_Class_With_Invariance; struct Class_Invariance_Guard_Throw { explicit Class_Invariance_Guard_Throw(Dummy_Class_With_Invariance * object); ~Class_Invariance_Guard_Throw(); Dummy_Class_With_Invariance & m_object; }; struct Dummy_Class_With_Invariance { void method_with_return(bool t1, bool t2) { m_class_invariance_called=0; m_throw=t1; Class_Invariance_Guard_Throw internal__invariance_guard(this); m_throw=t2; return; // internal__invariance_guard is destructed at this point and must thus call m_class_invariance } void m_class_invariance() { ++m_class_invariance_called; if(m_throw) throw "Invariance throwing"; } int m_class_invariance_called; #ifdef VOLATILE volatile #endif bool m_throw; }; Class_Invariance_Guard_Throw::Class_Invariance_Guard_Throw(Dummy_Class_With_Invariance * object) : m_object(*object) { (m_object.m_class_invariance)(); } Class_Invariance_Guard_Throw::~Class_Invariance_Guard_Throw() { (m_object.m_class_invariance)(); } #include <string> int main() { Dummy_Class_With_Invariance d; d.method_with_return(false,false); if(!(d.m_class_invariance_called==2)) { // use of ::std::string or other class (implicitly) building a string from the argument // required to cause the error throw ::std::string("d.m_class_invariance_called==2"); } d.method_with_return(false,false); if(!(d.m_class_invariance_called==2)) { // use of ::std::string or other class (implicitly) building a string from the argument // required to cause the error throw ::std::string("d.m_class_invariance_called==2"); } try { d.method_with_return(false,true); printf("Missing exception\n"); } catch(...) { printf("Ok\n"); } }
pgpNvcC5SzR1Z.pgp
Description: PGP signature