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++/61528] std::min std::max and RValue


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

--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> ---
If I mark f as static or inline (so the optimizer changes f to take its
argument by value), I get with g++-5:

w2.c: In function 'int main()':
w2.c:11:7: warning: '<anonymous>' is used uninitialized in this function
[-Wuninitialized]
   f(i);
       ^
w2.c:13:7: warning: '<anonymous>' is used uninitialized in this function
[-Wuninitialized]
   f(a);
       ^

(not the best error message, but a good first step)

It is quite fragile though, if instead f is inlined (rename main to help
convince the optimizer), we end up with:
  _49 = std::basic_ostream<char>::_M_insert<long unsigned int> (&cout, _9(D));
and don't warn about it (I didn't check, but I assume _9 is marked
TREE_NO_WARNING).


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