[valgrind] [Bug 433857] Add validation to C++17 aligned new/delete alignment size

2023-09-11 Thread Paul Floyd
https://bugs.kde.org/show_bug.cgi?id=433857

Paul Floyd  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|REPORTED|RESOLVED

--- Comment #4 from Paul Floyd  ---
Fixed.

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 433857] Add validation to C++17 aligned new/delete alignment size

2023-03-16 Thread Paul Floyd
https://bugs.kde.org/show_bug.cgi?id=433857

Paul Floyd  changed:

   What|Removed |Added

 Blocks||467441


Referenced Bugs:

https://bugs.kde.org/show_bug.cgi?id=467441
[Bug 467441] Add mismatched detection to C++ 14 sized delete
-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 433857] Add validation to C++17 aligned new/delete alignment size

2023-03-16 Thread Paul Floyd
https://bugs.kde.org/show_bug.cgi?id=433857

--- Comment #3 from Paul Floyd  ---
ASAN example

Here ASAN is assuming use of new delete expressions whilst I was making raw
calls to the operators.

paulf> ./new_delete_mismatch_size.asan
=
==1505==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x60300040 in
thread T0:
  object passed to delete has wrong type:
  size of the allocated type:   32 bytes;
  size of the deallocated type: 33 bytes.
#0 0x2b9452 in operator delete(void*, unsigned long)
/usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:164:3
#1 0x2bb021 in main
/usr/home/paulf/scratch/valgrind/memcheck/tests/new_delete_mismatch_size.cpp:18:5
#2 0x23613f in _start /usr/src/lib/csu/amd64/crt1_c.c:75:7
#3 0x8002e0007  ()

So far I have

==7503== Mismatched new/delete with size 33 
==7503==at 0x484F133: operator delete(void*, unsigned long)
(vg_replace_malloc.c:1036)
==7503==by 0x201AF1: main (new_delete_mismatch_size.cpp:18)
==7503==  Address 0x55b4040 is 0 bytes inside a block of size 32 alloc'd
==7503==at 0x484D0D4: operator new(unsigned long) (vg_replace_malloc.c:487)
==7503==by 0x201AE0: main (new_delete_mismatch_size.cpp:17)

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 433857] Add validation to C++17 aligned new/delete alignment size

2023-03-08 Thread Paul Floyd
https://bugs.kde.org/show_bug.cgi?id=433857

--- Comment #2 from Paul Floyd  ---
I haven't yet added any memcheck errors, but this first step is done. Valgrind
now behaves like stdlibc++
There is a small difference with libc++ which accepts an alignment of zero.

commit d4affb0ab725a59da786fee4b918b338eec615fe (HEAD -> master, origin/master,
origin/HEAD)
Author: Paul Floyd 
Date:   Wed Mar 8 23:10:22 2023 +0100

Make operator new aligned more like the standalone versions

If the alignment is not a power of two return nullptr for the
nothrow overload and bomb for the throwing overload.

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 433857] Add validation to C++17 aligned new/delete alignment size

2021-03-03 Thread Paul Floyd
https://bugs.kde.org/show_bug.cgi?id=433857

Paul Floyd  changed:

   What|Removed |Added

   Assignee|jsew...@acm.org |pjfl...@wanadoo.fr

--- Comment #1 from Paul Floyd  ---
The value of __STDCPP_DEFAULT_NEW_ALIGNMENT__ to use seems to be platform and
compiler dependent.

Some examples

clang 11 x86: 8
clang 11 amd64: 16
gcc 10 x86: 8
gcc 10 amd64: 16
AT 12 PPC: 16 [couldn't check 32bit]
gcc 10 arm7 : 8
gcc 10 arm8 and arm64: 16

-- 
You are receiving this mail because:
You are watching all bug changes.