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 #13 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Manuel LÃpez-IbÃÃez from comment #12)
> Why do you want to remove the clobber? 

I am in the DSE pass, so removing the clobber as a dead store is the easiest
thing to do ;-)

Ok, it might not be such a good idea.

> I understood your idea to avoid duplicated warnings was to add
> __builtin_unreachable and replace the value.

adding __builtin_unreachable seems doable. I am not sure what to replace the
value with though, as the variable could have any type.

Note that I also posted:
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00269.html
(hmm, OPT_Wreturn_local_addr is a C/C++ FE flag, I should move it or pick a
different one)
where I do replace the pointer by zero as you suggested. I am not adding
__builtin_unreachable, because if nothing uses the return value, I am not sure
it would be right to break the code.

> Could be possible to have a special var/value that is marked as artificial
> such that the warning code never warns for statements containing this
> variable? We already have DECL_ARTIFICIAL in the FE but I am not sure
> whether that survives to the middle-end.

There is probably some unused bit somewhere...

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