[Bug] appendonlyam_handler.c:1790:25: error: ‘segfile_count’ may be used uninitialized
- Dominant language
- C
- Stars
- 1.4k
- Forks
- 247
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 39
Description
### Apache Cloudberry version
main branch commit: 644b4e307380954e986f048d0a7910a3063e524e
### What happened
```shell
appendonlyam_handler.c: In function ‘appendonly_index_build_range_scan’:
appendonlyam_handler.c:1790:25: error: ‘segfile_count’ may be used uninitialized [-Werror=maybe-uninitialized]
1790 | FreeAllSegFileInfo(seginfo, segfile_count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aocsam_handler.c: In function ‘aoco_index_build_range_scan’:
aocsam_handler.c:1952:25: error: ‘segfile_count’ may be used uninitialized [-Werror=maybe-uninitialized]
1952 | FreeAllAOCSSegFileInfo(seginfo, segfile_count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
### What you think should happen instead
_No response_
### How to reproduce
config, make
### Operating System
Ubuntu
### Anything else
_No response_
### Are you willing to submit PR?
- [ ] Yes, I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/cloudberry/blob/main/CODE_OF_CONDUCT.md).
Contributor guide
Research direction
Start by reproducing the warning with `config, make`, then inspect `appendonlyam_handler.c` around line 1790 and `aocsam_handler.c` around line 1952. Confirm how `segfile_count` is handled before each `FreeAllSegFileInfo` and `FreeAllAOCSSegFileInfo` call; done means the Ubuntu build completes without the `maybe-uninitialized` errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100