public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/109821] vect: Different output with -O2 -ftree-loop-vectorize compared to -O2
Date: Fri, 12 May 2023 03:29:12 +0000	[thread overview]
Message-ID: <bug-109821-4-05rICsYEcE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109821-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The second issue an buffer overflow:

-O0 -fsanitize=undefined -fsanitize=address, we get:

/app/example.cpp:19:9: runtime error: store to misaligned address
0x7f4fad20002c for type 'uint64_t', which requires 8 byte alignment
0x7f4fad20002c: note: pointer points here
  39 61 62 63 64 65 66 67  68 69 6a 6b 6c 6d 6e 6f  70 71 72 73 74 75 00 00  00
00 00 00 00 00 00 00
              ^ 
=================================================================
==1==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f4fad20003c
at pc 0x0000004013c2 bp 0x7fff80744570 sp 0x7fff80744568
WRITE of size 8 at 0x7f4fad20003c thread T0
    #0 0x4013c1 in IncrementalCopyFastPath /app/example.cpp:19
    #1 0x4015c1 in main /app/example.cpp:32
    #2 0x7f4faf58f082 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId:
1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #3 0x40114d in _start (/app/output.s+0x40114d) (BuildId:
634f65b0ae11c54185ffa1239c341eaa4dd87ee3)

Address 0x7f4fad20003c is located in stack of thread T0 at offset 60 in frame
    #0 0x401456 in main /app/example.cpp:27

  This frame has 1 object(s):
    [32, 63) 'src' (line 29) <== Memory access at offset 60 partially overflows
this variable
HINT: this may be a false positive if your program uses some custom stack
unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /app/example.cpp:20 in
IncrementalCopyFastPath
Shadow bytes around the buggy address:
  0x7f4fad1ffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7f4fad1ffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7f4fad1ffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7f4fad1fff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7f4fad1fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x7f4fad200000: f1 f1 f1 f1 00 00 00[07]f3 f3 f3 f3 00 00 00 00
  0x7f4fad200080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7f4fad200100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7f4fad200180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7f4fad200200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7f4fad200280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==1==ABORTING

  parent reply	other threads:[~2023-05-12  3:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12  2:30 [Bug c++/109821] New: " yinyuefengyi at gmail dot com
2023-05-12  2:56 ` [Bug middle-end/109821] " pinskia at gcc dot gnu.org
2023-05-12  3:13 ` yinyuefengyi at gmail dot com
2023-05-12  3:29 ` pinskia at gcc dot gnu.org [this message]
2023-05-12  3:42 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109821-4-05rICsYEcE@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).