diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2022-12-09 18:33:14 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2022-12-09 18:56:09 +0100 |
| commit | ceb268fd3436998d03e56856065b3d5ba8201b3f (patch) | |
| tree | cb3471a6a19d97f551dedfe5492b9b11a8141d14 /FL | |
| parent | 59be6a7ef905eaf4adbe1fffd517a02ff64ae011 (diff) | |
Suppress (GitHub CI/wayland) compiler warning
[ 15%] Building CXX object src/CMakeFiles/fltk.dir/Fl_Text_Display.cxx.o
.../fltk/src/Fl_Text_Display.cxx: In constructor ‘Fl_Text_Display::Fl_Text_Display(int, int, int, int, const char*)’:
.../fltk/src/Fl_Text_Display.cxx:122:57: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ writing between 4 and 8589934584 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
122 | for (int i=1; i<mNVisibleLines; i++) mLineStarts[i] = -1;
| ~~~~~~~~~~~~~~~^~~~
.../fltk/src/Fl_Text_Display.cxx:120:39: note: at offset 4 into destination object of size 4 allocated by ‘operator new []’
120 | mLineStarts = new int[mNVisibleLines];
| ^
This warning is IMHO obsolete because the code in question should not
be executed at all (mNVisibleLines == 1). However, the compiler seems
to substitute this with '__builtin_memset(...)' and analyzes "correctly"
that memory at offset 4 would be overwritten but not that the written
size would be 0.
The "fix" uses a compiler macro and #if to clarify that this code must
not be executed and should not be compiled (see comment why this code
exists).
Diffstat (limited to 'FL')
0 files changed, 0 insertions, 0 deletions
