Repository: tensorflow
Issue: Potential bugs found with static analysis
Labels: stat:awaiting tensorflower,type:bug,TF 1.13,comp:core

<em>Please make sure that this is a bug. As per our [GitHub Policy](https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md), we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template</em>

**System information**
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
- TensorFlow installed from (source or binary): Source
- TensorFlow version (use command below): 1.14.0
- Python version: 2.7.12
- Bazel version (if compiling from source): 0.26.1
- GCC/Compiler version (if compiling from source): c++ (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
- CUDA/cuDNN version: N/A
- GPU model and memory: N/A

You can collect some of this information using our environment capture
[script](https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh)
You can also obtain the TensorFlow version with: 1. TF 1.0: `python -c "import
tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"` 2. TF 2.0: `python -c
"import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"`

**Describe the current behavior**

**Issue 1:**
https://github.com/tensorflow/tensorflow/blob/1ee51a3b868a3ccd5f80724f6b9389fd0a9aed07/tensorflow/compiler/tf2xla/functionalize_cond.cc#L445-L447
`dst_copy != nullptr` is checked immediately after `if (dst_copy == nullptr) continue;`. Is one of comparisons supposed to be different, or can the `TF_RET_CHECK` be removed?

**Issue 2:**
https://github.com/tensorflow/tensorflow/blob/9d67841e6c1f852516abf6ff44490b5d5a8331af/tensorflow/contrib/ignite/kernels/dataset/ignite_dataset_iterator.cc#L126-L128
This code is unreachable, because both branches of `if` above return. Either it should be deleted or some part of `if` modified.

**Issue 3:**
https://github.com/tensorflow/tensorflow/blob/514004a2347058214d1e7b13b9769a2abdd06830/tensorflow/core/profiler/rpc/client/capture_profile.cc#L218-L220
The condition is always true. My guess is that `==` is intended instead of `!=`.

**Issue 4:**
https://github.com/tensorflow/tensorflow/blob/9590c4c32dd4346ea5c35673336f5912c6072bf2/tensorflow/core/profiler/internal/tfprof_tensor.h#L55
Should this be `void` since nothing gets returned in any branch?

**Issue 5:**
https://github.com/tensorflow/tensorflow/blob/9380a41290e8fb8b9ea85f614472deab56dbc481/tensorflow/stream_executor/stream_executor_pimpl.cc#L112-L125
`ScopedTracer` doesn't obey the rule of 3, but this `SCOPED_TRACE` macro expands to calling its copy constructor. This should be safe in practice because of copy elision, I believe, but undesirable to rely on. Unfortunately, changing to `auto tracer{MakeScopedTracer(this, &LOC##Begin, &LOC##Complete, ##__VA_ARGS__)};` will infer `initializer_list<...>` (is that right?).

**Describe the expected behavior**

**Code to reproduce the issue**
Provide a reproducible test case that is the bare minimum necessary to generate the problem.

**Other info / logs**
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.