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 tree-optimization/60165] "may be used uninitialized" warning with -O3 but not with -O2


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

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Only in your reading of the documentation.

You clearly don't know what you are asking for, even the very common case of
pthread_t th;
if (pthread_create (&th, NULL, tf, NULL))
  goto fail;
pthread_join (th, NULL);
case would need to be warned about, even when there is nothing wrong about it.
In your testcase, if fn1 isn't inlined, it is the same thing for GCC, a
function call as a black box which could do anything to the memory pointed to
by the escaped pointer (unless the function is say pure or const, at which
point it couldn't store to it).  If it is inlined, the compiler sees it, sees
that a variable is used and in certain path has uninitialized value and in
others initialized, and correctly warns.


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