[jdk8u-dev] RFR: 8342822: jdk8u432-b06 does not compile on AIX
Francisco Ferrari Bihurriet
fferrari at openjdk.org
Thu Nov 7 20:05:28 UTC 2024
On Thu, 7 Nov 2024 11:41:23 GMT, Varada M <varadam at openjdk.org> wrote:
>> @varada1110: the cause of this build error seems to be that while `jdk8u` uses the C++98 standard, the `long long` overload for `abs` was introduced in C++11:
>>
>>
>> long long int abs (long long int n);
>>
>>
>> Haven't you found the same problem with `jdk11u`? At least in _Linux x64_ `src/hotspot/share/opto/superword.cpp` is built with `-std=gnu++98`.
>
> Hi @franferrax ,
> I couldn't find the use of abs in jdk11u in superword.cpp. For the safer side I have removed the use of abs and added the traditional way of doing the same. I have pushed the new code change and the testing for hotspot/jtreg is successful on aix-ppc didn't found any related failures.
> Thanks,
> Varada
Hi @varada1110,
Here is the jdk11u version of the failing code: [src/hotspot/share/opto/superword.hpp:710](https://github.com/openjdk/jdk11u/blob/jdk-11.0.25-ga/src/hotspot/share/opto/superword.hpp#L710). We may experience the same build error on AIX.
I'm realizing my assumptions in the understanding of the issue were wrong. I thought it was a 32-bit build, but the build is for `aix-ppc64`. Thus, `jlong` should be defined as `long`, and the C++98 [`long int abs (long int n)` overload](https://en.cppreference.com/w/cpp/numeric/math/abs) (defined in `stdlib.h`, included from [globalDefinitions_xlc.hpp](https://github.com/openjdk/jdk8u-dev/blob/jdk8u432-ga/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp#L40)) should work.
The problem seems to be in choosing between two equally suitable `abs()` definitions. A possible cause might be one definition coming from `stdlib.h`, the other one from `cstdlib` combined with a `using namespace std;` statement. Another less likely possibility is a compiler bug (see [IV24392](https://www.ibm.com/support/pages/apar/IV24392) and [LI71532](https://www.ibm.com/support/pages/apar/LI71532)).
@varada1110 / @andrew-m-leonard: could you help me understand the root cause of this build issue? Did the `xlC` compiler generate any informational `(I)` messages besides the `1540-0219 (S)` severe error?
With regard to the last change (8d18c5596af6db8c73fac2e072cdfe688dd36e83), I think it would be cleaner to just use the `ABS` template function:
https://github.com/openjdk/jdk8u-dev/blob/618917eb093243de2c5d7e83d4688bfe9ad04985/hotspot/src/share/vm/utilities/globalDefinitions.hpp#L1156
It's already being used in the file changed by this PR:
https://github.com/openjdk/jdk8u-dev/blob/618917eb093243de2c5d7e83d4688bfe9ad04985/hotspot/src/share/vm/opto/superword.hpp#L292-L295
But I think we'll first want to understand why the build failed, and if it isn't failing in jdk11u, what's causing the difference in behavior.
-------------
PR Comment: https://git.openjdk.org/jdk8u-dev/pull/600#issuecomment-2463081034
More information about the jdk8u-dev
mailing list