public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/115619] New: [ASAN] new-delete-type-mismatch on aligned operator new
@ 2024-06-24 16:29 thiago at kde dot org
  2024-06-24 16:34 ` [Bug sanitizer/115619] " thiago at kde dot org
  0 siblings, 1 reply; 2+ messages in thread
From: thiago at kde dot org @ 2024-06-24 16:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115619

            Bug ID: 115619
           Summary: [ASAN] new-delete-type-mismatch on aligned operator
                    new
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thiago at kde dot 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
  Target Milestone: ---

Simple test case:

#include <new>
int main()
{
    delete new (std::align_val_t(64)) char;
}

Produces:

=================================================================
==31603==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x509000000040 in
thread T0:
  object passed to delete has wrong type:
  size of the allocated type:   1 bytes;
  size of the deallocated type: 1 bytes.
  alignment of the allocated type:   64 bytes;
  alignment of the deallocated type: default-aligned.
    #0 0x7f8abfefd0d8 in operator delete(void*, unsigned long)
(/lib64/libasan.so.8+0xfd0d8) (BuildId:
1827a4c72065a9f25ba519b25166029eebbf519f)
    #1 0x40118a in main (/tmp/asan+0x40118a) (BuildId:
8bfb14839297ab61e6a8de28f913cc801a1f7cd7)
    #2 0x7f8abf62a1ef in __libc_start_call_main (/lib64/libc.so.6+0x2a1ef)
(BuildId: a2c0942c27fb9483b47886a1b937337a797bbceb)
    #3 0x7f8abf62a2b8 in __libc_start_main_alias_2 (/lib64/libc.so.6+0x2a2b8)
(BuildId: a2c0942c27fb9483b47886a1b937337a797bbceb)
    #4 0x401094 in _start ../sysdeps/x86_64/start.S:115

0x509000000040 is located 0 bytes inside of 1-byte region
[0x509000000040,0x509000000041)
allocated by thread T0 here:
    #0 0x7f8abfefc708 in operator new(unsigned long, std::align_val_t)
(/lib64/libasan.so.8+0xfc708) (BuildId:
1827a4c72065a9f25ba519b25166029eebbf519f)
    #1 0x401178 in main (/tmp/asan+0x401178) (BuildId:
8bfb14839297ab61e6a8de28f913cc801a1f7cd7)
    #2 0x7f8abf62a1ef in __libc_start_call_main (/lib64/libc.so.6+0x2a1ef)
(BuildId: a2c0942c27fb9483b47886a1b937337a797bbceb)

SUMMARY: AddressSanitizer: new-delete-type-mismatch
(/lib64/libasan.so.8+0xfd0d8) (BuildId:
1827a4c72065a9f25ba519b25166029eebbf519f) in operator delete(void*, unsigned
long)
==31603==HINT: if you don't care about these errors you may set
ASAN_OPTIONS=new_delete_type_mismatch=0
==31603==ABORTING

Reproduced with GCC 13, 14 and with Clang 18.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug sanitizer/115619] [ASAN] new-delete-type-mismatch on aligned operator new
  2024-06-24 16:29 [Bug sanitizer/115619] New: [ASAN] new-delete-type-mismatch on aligned operator new thiago at kde dot org
@ 2024-06-24 16:34 ` thiago at kde dot org
  0 siblings, 0 replies; 2+ messages in thread
From: thiago at kde dot org @ 2024-06-24 16:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115619

--- Comment #1 from Thiago Macieira <thiago at kde dot org> ---
Matching Clang bug report: https://github.com/llvm/llvm-project/issues/96512

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-24 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24 16:29 [Bug sanitizer/115619] New: [ASAN] new-delete-type-mismatch on aligned operator new thiago at kde dot org
2024-06-24 16:34 ` [Bug sanitizer/115619] " thiago at kde dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).