RFR: 8263718: unused-result warning happens at os_linux.cpp [v2]

David Holmes dholmes at openjdk.java.net
Tue Mar 30 05:09:45 UTC 2021


On Mon, 29 Mar 2021 08:03:58 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

>> I tried to build OpenJDK with g++-10.2.1_pre1-r3 on Alpine Linux 3.13.2, but I saw following warning:
>> 
>> 
>>   668 | alloca(((pid ^ counter++) & 7) * 128);
>>       | ^
>> cc1plus: all warnings being treated as errors
>
> Yasumasa Suenaga has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove alloca() from some platforms

I think I am comfortable with the changes as proposed. A summary of what we found for each platform should be put in the bug report.

Thanks,
David

src/hotspot/os/linux/os_linux.cpp line 671:

> 669:   static int counter = 0;
> 670:   int pid = os::current_process_id();
> 671:   void *stackmem = alloca(((pid ^ counter++) & 7) * 128);

Please add a comment:

// Ensure the alloca result is used in a way that prevents the compiler from eliding it.

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

Marked as reviewed by dholmes (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3042


More information about the hotspot-dev mailing list