public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61528] New: std::min std::max and RValue
@ 2014-06-16 17:59 lisp2d at lisp2d dot net
  2014-06-16 18:07 ` [Bug c++/61528] " glisse at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: lisp2d at lisp2d dot net @ 2014-06-16 17:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61528

            Bug ID: 61528
           Summary: std::min std::max and RValue
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lisp2d at lisp2d dot net

Declaring reference of result of functions MIN or MAX we get a DEAD memory when
one of arguments is an RValue.

// gcc -std=c++11 -Os bug.cpp
// gcc -std=c++11 -O2 bug.cpp
#include<iostream>

void  f(size_t  const & x){
  std::cout <<  "f:x="  <<  x <<  std::endl;}

int main(void){
  size_t  x{1};
  size_t  y{2};
  size_t  z{4};
  size_t  const & i=std::min(z,x  + y);
  f(i);
  size_t  const & a=std::max(x,y  + z);
  f(a);}


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-11-22 15:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16 17:59 [Bug c++/61528] New: std::min std::max and RValue lisp2d at lisp2d dot net
2014-06-16 18:07 ` [Bug c++/61528] " glisse at gcc dot gnu.org
2014-06-16 18:33 ` lisp2d at lisp2d dot net
2014-06-16 19:31 ` glisse at gcc dot gnu.org
2014-06-16 19:54 ` lisp2d at lisp2d dot net
2014-06-16 21:10 ` glisse at gcc dot gnu.org
2014-06-24 18:27 ` daniel.kruegler at googlemail dot com
2014-06-26 17:22 ` paolo.carlini at oracle dot com
2014-11-22 15:40 ` glisse at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).