[Bug sanitizer/106739] New: runtime error coredump case on c++17/20
zhkefa at live dot cn
gcc-bugzilla@gcc.gnu.org
Thu Aug 25 09:20:12 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106739
Bug ID: 106739
Summary: runtime error coredump case on c++17/20
Product: gcc
Version: 10.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: zhkefa at live dot cn
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
code file test.cc:
=============================
class A {
public:
A(int i): i(i){}
int get() {return i;}
private:
int i{0};
};
void func() {
typedef int (A::*f)();
f fs[] = {&A::get};
A *a = new A{1};
for (int i = 0; i < 1; ++i) {
(a->*fs[i])();
}
delete a;
}
int main() {
func();
return 0;
}
===============
envirment: gcc10.4
g++ -fsanitize=address -fsanitize=undefined -std=c++17 test.cc
./a.out
runtime error: index 4198816 out of bounds for type func[1]
runtime error: load of address 0x7ffd97570f08 whith insufficient space for an
object of type 'long int'
if compile with -std=c++14 or -std=c++11, everything ok.
More information about the Gcc-bugs
mailing list