icu
icu copied to clipboard
ICU-21781 suppress Wstringop-overflow in decNumber
Currently there are a few compiler warnings generated when using GCC 11.2.1:
decNumber.cpp: In function ‘decNumber* uprv_decNumberSquareRoot_70(
decNumber*, const decNumber*, decContext*)’:
decNumber.cpp:2976:31: warning:
writing 1 byte into a region of size 0 [-Wstringop-overflow=]
2976 | t->lsu[0]=9; t->lsu[1]=5; t->lsu[2]=2;
| ~~~~~~~~~^~
In file included from decNumber.cpp:184:
decNumber.h:89:19: note:
at offset 1 into destination object ‘decNumber::lsu’ of size 1
89 | decNumberUnit lsu[DECNUMUNITS];
| ^~~
There is an ignore for array-bounds warnings in this file which was added in Commit 38f7c0625c3a49208cc573720deaafcd2843c381 ("ICU-8954 add pragma to slience clang/gcc 4.6 about array bound error"). This commit add an ignore for stringop-overflow to suppress this warning.
Checklist
- [x] Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-21781
- [x] Required: The PR title must be prefixed with a JIRA Issue number.
- [x] Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
- [x] Required: Each commit message must be prefixed with a JIRA Issue number.
- [ ] Issue accepted (done by Technical Committee after discussion)
- [ ] Tests included, if applicable
- [ ] API docs and/or User Guide docs changed or added, if applicable
Why should this warning be suppressed? Why is this not a overlfow?
ping