public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/115625] New: [10/11/13 Regression] misaligned address check missing
@ 2024-06-25  2:20 bic60176 at gmail dot com
  2024-06-25  2:29 ` [Bug sanitizer/115625] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: bic60176 at gmail dot com @ 2024-06-25  2:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115625
           Summary: [10/11/13 Regression] misaligned address check missing
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bic60176 at gmail dot com
                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: ---

Created attachment 58509
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58509&action=edit
Test file used in the report.

OS: Ubuntu 22.04.3 LTS
We found that gcc failed to catch misaligned address errors when compiling with
gcc-13.2.0 at optimization level 1.

$ ~/compiler-builds/gcc-13.2.0_build/bin/gcc -fsanitize=undefined -g -lgcc_s
-I/home/csmith/include/csmith-2.3.0 -O1 testcase.c -o exec
$ timeout 5s ./exec 2>exec.err
$ cat exec.err
$ ~/compiler-builds/gcc-14.1.0_build/bin/gcc -fsanitize=undefined -g -lgcc_s
-I/home/csmith/include/csmith-2.3.0 -O1 testcase.c -o exec
$ timeout 5s ./exec 2>exec.err
$ cat exec.err
testcase.c:25:7: runtime error: load of misaligned address 0x7ffe94ed505a for
type 'int32_t', which requires 4 byte alignment
0x7ffe94ed505a: note: pointer points here
 00 00  00 00 00 00 00 00 09 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00
00  01 00 00 00 00 00
              ^
$

We have found that gcc also fails to catch misaligned address errors in both
gcc-11.4.0 at optimization level 1 and gcc-10.5.0 at optimization level 1.

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

* [Bug sanitizer/115625] [10/11/13 Regression] misaligned address check missing
  2024-06-25  2:20 [Bug sanitizer/115625] New: [10/11/13 Regression] misaligned address check missing bic60176 at gmail dot com
@ 2024-06-25  2:29 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-25  2:29 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
  uint16_t f[1];
  int g;
  f[g] = 9;
```

This code is undefined but at -O1 and above is optimized out since nobody uses
the value; it just sets it.

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

end of thread, other threads:[~2024-06-25  2:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25  2:20 [Bug sanitizer/115625] New: [10/11/13 Regression] misaligned address check missing bic60176 at gmail dot com
2024-06-25  2:29 ` [Bug sanitizer/115625] " pinskia at gcc dot gnu.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).