vertex: usage of uninitialized field
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 6.5k
- Forks
- 627
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 6
Description
Hey everyone 🙂👋
I was trying to build the lib from v3.7.1 sources and I faced this issue/warning, is it something expected ?
Don't hesitate to tell me if I can help on this 👍
$cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DBUILD_TESTING=0 -DBUILD_GENERATORS=0 -DBUILD_BENCHMARKS=0 -DBUILD_FILTERS=0 -DENABLE_LINTING=0 -DENABLE_DOCS=0 -DENABLE_COVERAGE=0
...skipped...
...skipped...
...skipped...
/tmp/h3-3.7.1/src/h3lib/lib/vertex.c: In function 'vertexRotations':
/tmp/h3-3.7.1/src/h3lib/lib/vertex.c:80:47: warning: 'dirFaces.faces[3]' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (cellLeadingDigit == JK_AXES_DIGIT &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
fijk.face ==
~~~~~~~~~~~~
dirFaces.faces[IK_AXES_DIGIT - DIRECTION_INDEX_OFFSET]) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/h3-3.7.1/src/h3lib/lib/vertex.c:85:54: warning: 'dirFaces.faces[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
} else if (cellLeadingDigit == IK_AXES_DIGIT &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
fijk.face ==
~~~~~~~~~~~~
dirFaces.faces[JK_AXES_DIGIT - DIRECTION_INDEX_OFFSET]) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the warning with the CMake command shown in the issue, then inspect src/h3lib/lib/vertex.c, especially vertexRotations and the dirFaces.faces accesses at the reported lines. Determine whether the warning reflects a real uninitialized value or a compiler-analysis issue, and rerun the same build to verify the warning is addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100