public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/107498] Wrong optimization leads to unaligned access when compiling OpenLDAP
Date: Sun, 13 Nov 2022 10:14:58 +0000	[thread overview]
Message-ID: <bug-107498-4-LSETeIE1ke@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107498-4@http.gcc.gnu.org/bugzilla/>

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

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

--- Comment #9 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Program received signal SIGBUS, Bus error.
> 0x00000100000ceda4 in mdb_node_add (mc=0x100004327b8, indx=<optimized out>,
> key=0x7feffffe0a0, data=0x7feffffe090, pgno=0, flags=0) at
> ./../../../libraries/liblmdb/mdb.c:7366
> 7366            mp->mp_lower += sizeof(indx_t);
> (gdb) p mp
> $1 = (MDB_page *) 0x10000463caa

Thanks.  So that's definitely *not* a compiler bug but a programming error as
per the 6.5.3.2(4) clause of the ISO C standard:

"The unary * operator denotes indirection. If the operand points to a function,
the result is a function designator; if it points to an object, the result is
an lvalue designating the object. If the operand has type "pointer to type",
the result has type "type". If an invalid value has been assigned to the
pointer, the behavior of the unary * operator is undefined.(106)"

(106)
Among the invalid values for dereferencing a pointer by the unary * operator
are a null pointer, an address inappropriately aligned for the type of object
pointed to, and the address of an object after the end of its lifetime.

  parent reply	other threads:[~2022-11-13 10:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 16:54 [Bug c/107498] New: " glaubitz at physik dot fu-berlin.de
2022-11-01 16:57 ` [Bug middle-end/107498] " pinskia at gcc dot gnu.org
2022-11-01 17:04 ` jrtc27 at jrtc27 dot com
2022-11-01 17:08 ` glaubitz at physik dot fu-berlin.de
2022-11-01 17:18 ` pinskia at gcc dot gnu.org
2022-11-01 20:23 ` ebotcazou at gcc dot gnu.org
2022-11-01 21:53 ` glaubitz at physik dot fu-berlin.de
2022-11-01 21:55 ` glaubitz at physik dot fu-berlin.de
2022-11-12 10:14 ` glaubitz at physik dot fu-berlin.de
2022-11-13 10:14 ` ebotcazou at gcc dot gnu.org [this message]
2022-11-13 10:33 ` glaubitz at physik dot fu-berlin.de
2022-11-13 10:56 ` ebotcazou 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-107498-4-LSETeIE1ke@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).