-
Enhancement
-
Resolution: Unresolved
-
P5
-
21, 22, 23
```
if (!ci_env.failing() && !task->is_success()) {
+ assert(ci_env.failure_reason() != nullptr, "expect failure reason");
+ assert(false, "compiler should always document failure: %s", ci_env.failure_reason());
```
`ciEnv` functions:
```
bool failing() const { return _failure_reason.get() != nullptr; }
const char* failure_reason() const { return _failure_reason.get(); }
```
So the code above is:
```
if (_failure_reason.get() == nullptr && !task->is_success()) {
assert(_failure_reason.get() != nullptr, "expect failure reason");
assert(false, "compiler should always document failure: %s", ci_env.failure_reason());
```
The condition `_failure_reason.get() != nullptr` is always false in the assert because we can get to it only if `_failure_reason.get() == nullptr`. So it will be triggered. The second assert is redundant.
The code above should be changed to:
```
if (!ci_env.failing() && !task->is_success()) {
assert(ci_env.failure_reason() != nullptr, "compiler should always document failure");
// The compiler elected, without comment, not to register a result.
```
`assert(false, "compiler should always document failure: %s", ci_env.failure_reason()); ` has UB because `ci_env.failure_reason()` is `nullptr`.
- relates to
-
JDK-8303951 Add asserts before record_method_not_compilable where possible
- Resolved
- links to
-
Review(master) openjdk/jdk/19395