[Bug tree-optimization/109571] potential null pointer dereference

2023-04-20 Thread f.heckenbach--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109571 --- Comment #3 from Frank Heckenbach --- Thanks for the explanation, that was really helpful. If I understand it correctly, since B has a vtable and A doesn't, upcasting means to add some offset to the pointer, but of course not if it's null. T

[Bug tree-optimization/109571] potential null pointer dereference

2023-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109571 --- Comment #2 from Andrew Pinski --- You get the same warning with: struct A { int i = 0; }; struct B: A { virtual ~B (); }; int f(B *tmp) { A *a = tmp; return a->i; }

[Bug tree-optimization/109571] potential null pointer dereference

2023-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109571 Andrew Pinski changed: What|Removed |Added Component|c++ |tree-optimization Keywords|