[Bug sanitizer/60963] New: ubsan runtime error: load of null pointer of type '<unknown> *'
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 25 11:31:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60963
Bug ID: 60963
Summary: ubsan runtime error: load of null pointer of type
'<unknown> *'
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
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
I think this is valid:
#include <new>
class EmbeddedObject {
public:
virtual int val() { return 2; }
};
class Container {
alignas(EmbeddedObject) char buffer[sizeof(EmbeddedObject)];
public:
EmbeddedObject *obj() { return (EmbeddedObject*)buffer; }
Container() { new (buffer) EmbeddedObject(); }
};
Container o;
int main()
{
return o.obj()->val();
}
But compiled with trunk and -std=c++11 -O2 -fsanitize=undefined it errors:
sa3.cc:19:23: runtime error: load of null pointer of type '<unknown> *'
Segmentation fault (core dumped)
This might not be a ubsan issue, it might be just a side-effect of the
devirtualization problem described at
http://gcc.gnu.org/ml/gcc/2014-04/msg00236.html
More information about the Gcc-bugs
mailing list