[Bug tree-optimization/61493] [4.10 Regression] Bug exposed by speculative devirtualizing

2014-06-24 Thread wmi at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61493

wmi at google dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from wmi at google dot com ---
This is a source problem. So close the bug.

void foo(FST *fst) {
  const PAIR &final_pair = fst->Final().getpair();
  if (final_pair == global_pair)
__builtin_printf("equal\n");
  else
__builtin_printf("not equal\n");

  return;
}

The life time of the temporary object generated by fst->Final() will not be
extended after the statement generating it, according to the following rule :

a temporary bound to a return value of a function in a return statement is not
extended: it is destroyed immediately at the end of the return expression. Such
function always returns a dangling reference.
(http://en.cppreference.com/w/cpp/language/reference_initialization)

So it is meaningless to access final_pair afterwards.


[Bug tree-optimization/61493] [4.10 Regression] Bug exposed by speculative devirtualizing

2014-06-13 Thread wmi at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61493

--- Comment #3 from wmi at google dot com ---
Fix a typo in the first post.

$~/workarea/gcc-r211604/build/install/bin/g++ -O2 1.cxx
$./a.out
not equal

$~/workarea/gcc-r211604/build/install/bin/g++ -O0 1.cxx
$./a.out
equal

$~/workarea/gcc-r211604/build/install/bin/g++ -O2
-fno-devirtualize-speculatively 1.cxx
$./a.out
equal


[Bug tree-optimization/61493] [4.10 Regression] Bug exposed by speculative devirtualizing

2014-06-13 Thread ppluzhnikov at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61493

Paul Pluzhnikov  changed:

   What|Removed |Added

 CC||ppluzhnikov at google dot com

--- Comment #2 from Paul Pluzhnikov  ---
Also broken in 4.9


[Bug tree-optimization/61493] [4.10 Regression] Bug exposed by speculative devirtualizing

2014-06-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61493

Richard Biener  changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||hubicka at gcc dot gnu.org
   Target Milestone|--- |4.10.0
Summary|Bug exposed by speculative  |[4.10 Regression] Bug
   |devirtualizing  |exposed by speculative
   ||devirtualizing