Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8275008: gtest build failure due to stringop-overflow warning with gcc11 #5881

Closed
wants to merge 2 commits into from

Conversation

DamonFool
Copy link
Member

@DamonFool DamonFool commented Oct 10, 2021

Hi all,

gtest build fails due to stringop-overflow warning with gcc11.

This is because gcc11 seems to be smart enough to detect the following stringop-overflow at test/hotspot/gtest/memory/test_guardedMemory.cpp:125:11.

* For target hotspot_variant-server_libjvm_gtest_objs_test_guardedMemory.o:
In file included from /usr/include/string.h:495,
                 from /home/jdk/src/hotspot/share/utilities/globalDefinitions_gcc.hpp:35,
                 from /home/jdk/src/hotspot/share/utilities/globalDefinitions.hpp:35,
                 from /home/jdk/src/hotspot/share/memory/allocation.hpp:29,
                 from /home/jdk/test/hotspot/gtest/memory/test_guardedMemory.cpp:25:
In function 'void* memset(void*, int, size_t)',      
    inlined from 'virtual void GuardedMemory_buffer_overrun_tail_Test::TestBody()' at /home/jdk/test/hotspot/gtest/memory/test_guardedMemory.cpp:125:11:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:71:33: error: 'void* __builtin_memset(void*, int, long unsigned int)' writing between 2 and 262144 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
   71 |   return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
      |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

So I suggest disabling the stringop-overflow warning for gcc when building gtest since this overflow is designed as a test case.

Thanks.
Best regards,
Jie


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8275008: gtest build failure due to stringop-overflow warning with gcc11

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5881/head:pull/5881
$ git checkout pull/5881

Update a local copy of the PR:
$ git checkout pull/5881
$ git pull https://git.openjdk.java.net/jdk pull/5881/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5881

View PR using the GUI difftool:
$ git pr show -t 5881

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5881.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 10, 2021

👋 Welcome back jiefu! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 10, 2021
@openjdk
Copy link

openjdk bot commented Oct 10, 2021

@DamonFool The following label will be automatically applied to this pull request:

  • build

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the build build-dev@openjdk.org label Oct 10, 2021
@mlbridge
Copy link

mlbridge bot commented Oct 10, 2021

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Jie,

Can we not just disable the warning in this specific test?

Thanks,
David

@DamonFool
Copy link
Member Author

Hi Jie,

Can we not just disable the warning in this specific test?

Thanks, David

Thanks @dholmes-ora for your review.

According to this comment [1], gtest source code warnings are disabled in build script.
Maybe, it would be better to also follow that style here.

What do you think?
Thanks.

[1] https://github.com/openjdk/jdk/blob/master/make/hotspot/lib/CompileGtest.gmk#L84

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Seems a bit heavy handed to disable across all gtests but okay.

Thanks,
David

@openjdk
Copy link

openjdk bot commented Oct 11, 2021

@DamonFool This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8275008: gtest build failure due to stringop-overflow warning with gcc11

Reviewed-by: dholmes, ihse

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 4 new commits pushed to the master branch:

  • c032186: 8272968: AArch64: Remove redundant matching rules for commutative ops
  • a05873a: 8274952: jdk/jfr/api/consumer/TestRecordedFrameType.java failed when c1 disabled
  • 5ecc99b: 8274620: resourcehogs/serviceability/sa/TestHeapDumpForLargeArray.java is timing out
  • 2ff3977: 8275004: CDS build failure with gcc11

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 11, 2021
@magicus
Copy link
Member

magicus commented Oct 11, 2021

We do not currently have a way to disable warnings for individual files in a library. The only other way to disable warnings for a specific place is to use #pragma.

Looks good.

@DamonFool
Copy link
Member Author

Thanks @dholmes-ora and @magicus .
/integrate

@openjdk
Copy link

openjdk bot commented Oct 11, 2021

Going to push as commit c55dd36.
Since your change was applied there have been 6 commits pushed to the master branch:

  • 3edee1e: 8272723: Don't use Access API to access primitive fields
  • 49f8ce6: 8274773: [TESTBUG] UnsafeIntrinsicsTest intermittently fails on weak memory model platform
  • c032186: 8272968: AArch64: Remove redundant matching rules for commutative ops
  • a05873a: 8274952: jdk/jfr/api/consumer/TestRecordedFrameType.java failed when c1 disabled
  • 5ecc99b: 8274620: resourcehogs/serviceability/sa/TestHeapDumpForLargeArray.java is timing out
  • 2ff3977: 8275004: CDS build failure with gcc11

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Oct 11, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 11, 2021
@openjdk
Copy link

openjdk bot commented Oct 11, 2021

@DamonFool Pushed as commit c55dd36.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@DamonFool DamonFool deleted the JDK-8275008 branch October 11, 2021 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build-dev@openjdk.org integrated Pull request has been integrated
3 participants