add test for delete size mismatch

This commit is contained in:
Daniel Micay 2018-10-11 01:44:41 -04:00
parent 7606bf4c1f
commit e47c783524
2 changed files with 15 additions and 1 deletions

View File

@ -22,7 +22,8 @@ EXECUTABLES := \
uninitialized_malloc_usable_size \ uninitialized_malloc_usable_size \
eight_byte_overflow_small \ eight_byte_overflow_small \
eight_byte_overflow_large \ eight_byte_overflow_large \
string_overflow string_overflow \
delete_type_size_mismatch
all: $(EXECUTABLES) all: $(EXECUTABLES)

View File

@ -0,0 +1,13 @@
#include <stdint.h>
struct foo {
uint64_t a, b, c, d;
};
__attribute__((optimize(0)))
int main(void) {
void *p = new char;
struct foo *c = (struct foo *)p;
delete c;
return 0;
}