This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13239] [3.3 REGRESSION] Assertion does not seem to work correctly anymore


------- Additional Comments From rmerkert at alphatech dot com  2003-12-02 22:32 -------
Here's another, slightly simplified, example: 

#include <assert.h>

struct Y {
  Y () : _y(0) {}
  //Y (const Y& y) : _y(y._y) {}
  int _y;
};

bool foo() { return true; }
Y bar() { return Y(); }

int main()
{
  assert (bar()._y==0);
  assert ( foo() && (bar()._y)==0 );
  return 0;
}

If the copy constructor is uncommented, then it works. It almost looks as if it
does not generate the temporary Y object and just pretends it has got it. I've
tried this on a solaris and it worked and I also tried it on a cygwin (3.1 ?
maybe) which worked as well.

Can someone verify that their system is using builtin_expect rather than general
assert?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13239


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]