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++/60517] warning/error for taking address of member of a temporary object


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

--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #5)
> I would need a different (middle-end) warning that
> detects return &local_var,

To confirm this, I looked at the last dangling reference I debugged, recompiled
it with -O3 -fkeep-inline-functions, and a grep for "return &" in the
.optimized dump showed:
  return &one;
  return &one;
  return &D.495451.c_;
(where "one" is a global variable, but D.495451 is a local variable)
so even this trivial version of the warning would be useful.


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