我要评分
获取效率
正确性
完整性
易理解

Differences in Random Array Initialization Behavior

Overview

x86 and Kunpeng platforms process uninitialized arrays in different ways. On the x86 platform, the initial value is a random value (non-zero value) by default. On the Kunpeng platform, however, the value contains non-zero values and some zero values. If the user code depends on the random value in their services, the result varies based on platforms. The following figure shows the random initial value in the code:

Workaround

BiSheng has the option and you do not need to install it.

Method

Add -finit-one during compilation.