RFR(xs): 8210320: PPC64: Fix uninitialized variable in C1 LIR assembler code
Gustavo Romero
gromero at linux.vnet.ibm.com
Tue Sep 4 14:47:54 UTC 2018
Hi Martin!
On 09/04/2018 11:12 AM, Doerr, Martin wrote:
> Hi Gustavo,
>
> it's not a real bug, just a build warning. But it needs to get fixed. Thanks for doing it. Reviewed.
Thanks for reviewing it. Yes, I agree.
Btw, I tried to precisely determine which change was introduced in gcc 7.3
(for instance) hoping it was only a matter of an additional -Wextra or
-Wall in a gcc spec but it turned out that that was not the case
apparently... I could not find a reasonable change in gcc flags or source
code that might cause such a warnings when gcc 7.3 is used.
I've create a "test case" from JVM code for that [1] (which is still
4.4 MiB since I didn't have the change to prune it further). But curious
enough although the following simple code really triggers the same warning
_both_ on gcc 4.8 and 7.3 when compiled with:
$ g++ -Wuninitialized -O3 mu.cpp -c -o mu
mu.cpp:
void foo(int x) {
printf("%d\n", x+1);
}
int main(int argc, char** argv)
{
int x;
switch (argc) {
case 1: x = 1;
break;
case 2: x = 4;
break;
case 3: x = 5;
}
foo(x);
}
code [1] only triggers the warning in question when gcc 7.3 is used (using
the exact same flags):
$ g++ -Wuninitialized -O3 ok.cpp -c -o ok.o
Passing '-v' to gcc to check the flags from spec didnt show any clue.
Toolchain folks also were not able to tell any differences that could
account for that behavior on gcc 7.3 without a detailed look...
Anyway, it's only a note :)
Thanks.
Best regards,
Gustavo
[1] http://cr.openjdk.java.net/~gromero/misc/ok.cpp
> Best regards,
> Martin
>
>
> -----Original Message-----
> From: hotspot-compiler-dev <hotspot-compiler-dev-bounces at openjdk.java.net> On Behalf Of Gustavo Romero
> Sent: Dienstag, 4. September 2018 15:42
> To: hotspot-compiler-dev at openjdk.java.net
> Cc: ppc-aix-port-dev at openjdk.java.net
> Subject: RFR(xs): 8210320: PPC64: Fix uninitialized variable in C1 LIR assembler code
> Importance: High
>
> Hi,
>
> May I please request reviews for this tiny change that fixes two
> uninitialized variables in PPC64 C1 LIR code?
>
> Bug : https://bugs.openjdk.java.net/browse/JDK-8210320
> Webrev: http://cr.openjdk.java.net/~gromero/8210320/v1/
>
> GCC 4.8 does not complain about these two uninitialized pointers ('data'
> and 'md') but more recent versions, like 5.4.0 and 7.3.1, complain about
> it:
>
> In file included from /home/gromero/hg/jdk/jdk/src/hotspot/share/c1/c1_Compilation.hpp:29:0,
> from /home/gromero/hg/jdk/jdk/src/hotspot/share/precompiled/precompiled.hpp:286:
> /home/gromero/hg/jdk/jdk/src/hotspot/share/ci/ciMethodData.hpp: In member function ‘void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck*, Label*, Label*, Label*)’:
> /home/gromero/hg/jdk/jdk/src/hotspot/share/ci/ciMethodData.hpp:595:100: warning: ‘data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> int byte_offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data) { return in_bytes(offset_of_slot(data, slot_offset_in_data)); }
> ^
> /home/gromero/hg/jdk/jdk/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp:2400:18: note: ‘data’ was declared here
> ciProfileData* data;
> ^
> /home/gromero/hg/jdk/jdk/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp:2483:78: warning: ‘md’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> type_profile_helper(mdo, mdo_offset_bias, md, data, recv, Rtmp1, success);
> ^
>
> Thank you.
>
> Best regards,
> Gustavo
>
More information about the ppc-aix-port-dev
mailing list