}
break;
- case Err_AlignMismatch:
+ case Err_AlignMismatch: {
+ HChar alloc_buf[32];
+ HChar dealloc_buf[32];
+ if (extra->Err.AlignMismatch.alloc_align == 0) {
+ VG_(sprintf)(alloc_buf, "%s", "default-aligned");
+ } else {
+ VG_(sprintf)(alloc_buf, "%lu", extra->Err.AlignMismatch.alloc_align);
+ }
+ if (extra->Err.AlignMismatch.default_delete) {
+ VG_(sprintf)(dealloc_buf, "%s", "default-aligned");
+ } else {
+ VG_(sprintf)(dealloc_buf, "%lu", extra->Err.AlignMismatch.dealloc_align);
+ }
if (xml) {
emit( " <kind>MismatchedAllocateDeallocateAlignment</kind>\n" );
- if (extra->Err.AlignMismatch.default_delete) {
- emit( " <what>Mismatched %s size alloc value: %lu dealloc value: default-aligned</what>\n",
- extra->Err.SizeMismatch.function_names, extra->Err.AlignMismatch.alloc_align );
- } else {
- emit( " <what>Mismatched %s size alloc value: %lu dealloc value: %lu</what>\n",
- extra->Err.SizeMismatch.function_names, extra->Err.AlignMismatch.alloc_align, extra->Err.AlignMismatch.dealloc_align );
- }
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- VG_(pp_addrinfo_mc)(VG_(get_error_address)(err),
- &extra->Err.AlignMismatch.ai, False);
+ emit( " <what>Mismatched %s alignment alloc value: %s dealloc value: %s</what>\n",
+ extra->Err.AlignMismatch.function_names, alloc_buf, dealloc_buf );
} else {
- if (extra->Err.AlignMismatch.default_delete) {
- emit( "Mismatched %s alignment alloc value: %lu dealloc value: default-aligned\n",
- extra->Err.AlignMismatch.function_names, extra->Err.AlignMismatch.alloc_align );
- } else {
- emit( "Mismatched %s alignment alloc value: %lu dealloc value: %lu\n",
- extra->Err.AlignMismatch.function_names, extra->Err.AlignMismatch.alloc_align, extra->Err.AlignMismatch.dealloc_align );
- }
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- VG_(pp_addrinfo_mc)(VG_(get_error_address)(err),
- &extra->Err.AlignMismatch.ai, False);
+ emit( "Mismatched %s alignment alloc value: %s dealloc value: %s\n",
+ extra->Err.AlignMismatch.function_names, alloc_buf, dealloc_buf );
}
+ VG_(pp_ExeContext)( VG_(get_error_where)(err) );
+ VG_(pp_addrinfo_mc)(VG_(get_error_address)(err),
+ &extra->Err.AlignMismatch.ai, False);
+ }
break;
default:
at 0x........: free_aligned_sized (vg_replace_malloc.c:...)
by 0x........: main (c23_free.c:42)
-Mismatched aligned_alloc/free_aligned_sized alignment alloc value: 0 dealloc value: 1000
+Mismatched aligned_alloc/free_aligned_sized alignment alloc value: default-aligned dealloc value: 1000
at 0x........: free_aligned_sized (vg_replace_malloc.c:...)
by 0x........: main (c23_free.c:42)
Address 0x........ is 0 bytes inside a block of size 1,000 alloc'd
mem = operator new[](size, align);
operator delete[](mem, size, misalign);
+
+ // default size new, sized aligned delete
+ mem = operator new(size);
+ operator delete(mem, size, align);
+
+ // default size new array, sized aligned delete array
+ mem = operator new[](size);
+ operator delete[](mem, size, align);
// initially this test had two throwing
// versions called from fork()s
// but that doesn't mix well with xml
- // so they have split out int versions 2 and 3
+ // so they have split out into versions 2 and 3
}
at 0x........: operator delete[](void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
by 0x........: main (sized_aligned_new_delete_misaligned1.cpp:52)
+Mismatched new/delete alignment alloc value: default-aligned dealloc value: 64
+ at 0x........: operator delete(void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (sized_aligned_new_delete_misaligned1.cpp:56)
+ Address 0x........ is 0 bytes inside a block of size 32 alloc'd
+ at 0x........: ...operator new... (vg_replace_malloc.c:...)
+ by 0x........: main (sized_aligned_new_delete_misaligned1.cpp:55)
+
+Mismatched new[]/delete[] alignment alloc value: default-aligned dealloc value: 64
+ at 0x........: operator delete[](void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (sized_aligned_new_delete_misaligned1.cpp:60)
+ Address 0x........ is 0 bytes inside a block of size 32 alloc'd
+ at 0x........: ...operator new[]... (vg_replace_malloc.c:...)
+ by 0x........: main (sized_aligned_new_delete_misaligned1.cpp:59)
+
+used_suppression: 2 array delete aligned alignment mismatch sized_aligned_new_delete_misaligned1_supp.supp
+used_suppression: 2 scalar delete sized aligned alignment mismatch sized_aligned_new_delete_misaligned1_supp.supp
used_suppression: 1 array delete sized aligned bad alignment sized_aligned_new_delete_misaligned1_supp.supp
-used_suppression: 1 array delete aligned alignment mismatch sized_aligned_new_delete_misaligned1_supp.supp
used_suppression: 1 scalar delete sized aligned bad alignment sized_aligned_new_delete_misaligned1_supp.supp
-used_suppression: 1 scalar delete sized aligned alignment mismatch sized_aligned_new_delete_misaligned1_supp.supp
used_suppression: 1 array delete aligned nothrow bad alignment sized_aligned_new_delete_misaligned1_supp.supp
used_suppression: 1 array new aligned nothrow bad alignment sized_aligned_new_delete_misaligned1_supp.supp
used_suppression: 2 scalar delete aligned nothrow bad alignment sized_aligned_new_delete_misaligned1_supp.supp
<unique>0x........</unique>
<tid>...</tid>
<kind>MismatchedAllocateDeallocateAlignment</kind>
- <what>Mismatched new/delete size alloc value: 64 dealloc value: 63</what>
+ <what>Mismatched new/delete alignment alloc value: 64 dealloc value: 63</what>
<stack>
<frame>
<ip>0x........</ip>
<unique>0x........</unique>
<tid>...</tid>
<kind>MismatchedAllocateDeallocateAlignment</kind>
- <what>Mismatched new[]/delete[] size alloc value: 64 dealloc value: 63</what>
+ <what>Mismatched new[]/delete[] alignment alloc value: 64 dealloc value: 63</what>
<stack>
<frame>
<ip>0x........</ip>
<unique>0x........</unique>
<tid>...</tid>
<kind>MismatchedAllocateDeallocateAlignment</kind>
- <what>Mismatched new/delete size alloc value: 64 dealloc value: 63</what>
+ <what>Mismatched new/delete alignment alloc value: 64 dealloc value: 63</what>
<stack>
<frame>
<ip>0x........</ip>
<unique>0x........</unique>
<tid>...</tid>
<kind>MismatchedAllocateDeallocateAlignment</kind>
- <what>Mismatched new[]/delete[] size alloc value: 64 dealloc value: 63</what>
+ <what>Mismatched new[]/delete[] alignment alloc value: 64 dealloc value: 63</what>
<stack>
<frame>
<ip>0x........</ip>
</stack>
</error>
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>MismatchedAllocateDeallocateAlignment</kind>
+ <what>Mismatched new/delete alignment alloc value: default-aligned dealloc value: 64</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>operator delete(void*, unsigned long, std::align_val_t)</fn>
+ <dir>...</dir>
+ <file>vg_replace_malloc.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>sized_aligned_new_delete_misaligned1.cpp</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ <auxwhat>Address 0x........ is 0 bytes inside a block of size 32 alloc'd</auxwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>operator new(unsigned long)</fn>
+ <dir>...</dir>
+ <file>vg_replace_malloc.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>sized_aligned_new_delete_misaligned1.cpp</file>
+ <line>...</line>
+ </frame>
+ </stack>
+</error>
+
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>MismatchedAllocateDeallocateAlignment</kind>
+ <what>Mismatched new[]/delete[] alignment alloc value: default-aligned dealloc value: 64</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>operator delete[](void*, unsigned long, std::align_val_t)</fn>
+ <dir>...</dir>
+ <file>vg_replace_malloc.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>sized_aligned_new_delete_misaligned1.cpp</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ <auxwhat>Address 0x........ is 0 bytes inside a block of size 32 alloc'd</auxwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>operator new[](unsigned long)</fn>
+ <dir>...</dir>
+ <file>vg_replace_malloc.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>sized_aligned_new_delete_misaligned1.cpp</file>
+ <line>...</line>
+ </frame>
+ </stack>
+</error>
+
<status>
<state>FINISHED</state>
<time>...</time>
<count>...</count>
<unique>0x........</unique>
</pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
</errorcounts>
<suppcounts>...</suppcounts>