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

Debug builds are broken with -Werror in GCC 11 due to -Wnonnull changes #7402

Open
cjjdespres opened this issue Jul 9, 2024 · 1 comment · May be fixed by #7403
Open

Debug builds are broken with -Werror in GCC 11 due to -Wnonnull changes #7402

cjjdespres opened this issue Jul 9, 2024 · 1 comment · May be fixed by #7403

Comments

@cjjdespres
Copy link
Contributor

I tried producing a debug build of JDK21 with openj9 using the Ubuntu 22 docker image from mkdocker.sh, with the additional flags

export cflags="-Og -ggdb3 -fno-inline -DDEBUG"
export EXTRA_CMAKE_ARGS="-DJ9JIT_EXTRA_CFLAGS=\"$cflags\" -DJ9JIT_EXTRA_CXXFLAGS=\"$cflags\""

as I normally do (in the Ubuntu 20 image, at least) and I got compilation errors in omr:

[ 34%] Building CXX object runtime/compiler/CMakeFiles/j9jit.dir/root/hostdir/foo/openj9-openjdk-jdk21/omr/compiler/infra/InterferenceGraph.cpp.o
/root/hostdir/foo/openj9-openjdk-jdk21/omr/compiler/infra/InterferenceGraph.cpp: In member function 'virtual bool TR_InterferenceGraph::simplify()':
/root/hostdir/foo/openj9-openjdk-jdk21/omr/compiler/infra/InterferenceGraph.cpp:423:51: error: 'this' pointer is null [-Werror=nonnull]
  423 |          workingSet->reset(bestSpillNode->getIndex());
      |                            ~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /root/hostdir/foo/openj9-openjdk-jdk21/omr/compiler/infra/IGBase.hpp:28,
                 from /root/hostdir/foo/openj9-openjdk-jdk21/omr/compiler/infra/InterferenceGraph.hpp:34,
                 from /root/hostdir/foo/openj9-openjdk-jdk21/omr/compiler/infra/InterferenceGraph.cpp:22:
/root/hostdir/foo/openj9-openjdk-jdk21/omr/compiler/infra/IGNode.hpp:89:16: note: in a call to non-static member function 'IGNodeIndex TR_IGNode::getIndex()'
   89 |    IGNodeIndex getIndex()       {return _index;}
      |                ^~~~~~~~
cc1plus: all warnings being treated as errors

I'm fairly sure this is due to the use of GCC 11 in the image. From the changelog:

  • Enhancements to existing warnings:
    • -Wnonnull considers the implicit this argument of every C++ nonstatic member function to have been implicitly declared with attribute nonnull and triggers warnings for calls where the pointer is null.

There are only a few places where the warning arises. I can put up a PR to resolve them.

@cjjdespres cjjdespres linked a pull request Jul 9, 2024 that will close this issue
@cjjdespres
Copy link
Contributor Author

This only shows up in omr because most (all?) of the openj9 code has OMR_ENHANCED_WARNINGS turned off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant