Closed ardiehl closed 4 years ago
Does it work if you replace 'reserved[3]' with '*(&reserved[0] + 3)' or just '*(reserved + 3)'?
-Werror=array-bounds is such a useful feature. I feel sad having to defeat it.
EDIT: fixed markdown formatting so the *'s show up
I also encountered with this issue. '*(&reserved[0] + 3)' works but '*(reserved + 3)' returns same error
EDIT: fixed markdown formatting so the *'s show up x2 :D
fs.cc: In member function ‘void crucible::BtrfsIoctlLogicalInoArgs::set_flags(uint64_t)’:
fs.cc:319:13: error: array subscript 3 is above array bounds of ‘__u64 [3]’ {aka ‘long long unsigned int [3]’} [-Werror=array-bounds]
319 | reserved[3] = new_flags;
| ~~~~~~~~~~^
fs.cc: In member function ‘uint64_t crucible::BtrfsIoctlLogicalInoArgs::get_flags() const’:
fs.cc:326:20: error: array subscript 3 is above array bounds of ‘const __u64 [3]’ {aka ‘const long long unsigned int [3]’} [-Werror=array-bounds]
326 | return reserved[3];
| ~~~~~~~~~~^
fs.cc: In member function ‘virtual bool crucible::BtrfsIoctlLogicalInoArgs::do_ioctl_nothrow(int)’:
fs.cc:326:20: error: array subscript 3 is above array bounds of ‘const __u64 [3]’ {aka ‘const long long unsigned int [3]’} [-Werror=array-bounds]
326 | return reserved[3];
` |~~^``[ad@lnx bees]$ gcc --version
gcc (GCC) 9.3.1 20200317 (Red Hat 9.3.1-1)
[ad@lnx bees]$ uname -a
Linux lnx.armin.d 5.5.15-200.fc31.x86_64 #1 SMP Thu Apr 2 19:16:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[ad@lnx bees]$ cat /etc/redhat-release
Fedora release 31 (Thirty One)