RFR: 8328934: Assert that ABS input and output are legal [v3]

Aleksey Shipilev shade at openjdk.org
Fri Apr 12 16:07:41 UTC 2024


On Fri, 12 Apr 2024 14:00:49 GMT, Andrew Haley <aph at openjdk.org> wrote:

> > Caught some failures, which made me think we want richer diagnostics around this. With new version, we print stuff like:
> > ```
> > #  Internal Error (/Users/shipilev/Work/shipilev-jdk/src/hotspot/share/opto/loopnode.cpp:2965), pid=32195, tid=27139
> > #  Error: ABS: argument should not allow overflow
> > ```
> 
> LOL, don't say you weren't warned! ;-)
> 
> ```
>   T res = (x < 0 && x != std::numeric_limits<T>::min()) ? -x : x;
> ```

I mean, we catch the proper error in some tests: https://bugs.openjdk.org/browse/JDK-8330158
Do we really need to do this `x != std::numeric_limits<T>::min()` dance here?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18751#issuecomment-2052047842


More information about the hotspot-dev mailing list