public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "eggert at twinsun dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/13421] IA32 bigmem pointer subtraction and Âftrapv option causes unjustified program abort Date: Tue, 06 Apr 2004 05:13:00 -0000 [thread overview] Message-ID: <20040406051310.30913.qmail@sources.redhat.com> (raw) In-Reply-To: <20031217152930.13421.vik.heyndrickx@pandora.be> ------- Additional Comments From eggert at twinsun dot com 2004-04-06 05:13 ------- A point of clarification: even if pointers are changed to be consistently unsigned internally (which seems to be the right thing to do, if pointer comparison is unsigned), GCC must still check for overflow when subtracting pointers. For example, suppose we have the 2 GiB array "a" successfully allocated by "char *a = malloc (1u<<31);". Then the expression "(a + (1u<<31)) - a" is of type ptrdiff_t, which is a signed 32-bit integer that cannot represent (1u<<31). So this expression must generate a trap with -ftrapv, regardless of whether pointers are unsigned internally. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13421
next prev parent reply other threads:[~2004-04-06 5:13 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-12-17 16:33 [Bug c/13421] New: IA32 bigmem pointer subtraction and ftrapv " vik dot heyndrickx at pandora dot be 2003-12-17 16:58 ` [Bug c/13421] " pinskia at gcc dot gnu dot org 2003-12-17 16:59 ` falk at debian dot org 2003-12-17 17:05 ` pinskia at gcc dot gnu dot org 2003-12-17 17:06 ` vik dot heyndrickx at pandora dot be 2003-12-17 17:28 ` pinskia at gcc dot gnu dot org 2003-12-17 18:20 ` vik dot heyndrickx at pandora dot be 2003-12-17 18:22 ` pinskia at gcc dot gnu dot org 2003-12-17 18:23 ` falk dot hueffner at student dot uni-tuebingen dot de 2003-12-17 18:38 ` zack at gcc dot gnu dot org 2003-12-18 11:46 ` bangerth at dealii dot org 2003-12-18 12:46 ` vik dot heyndrickx at pandora dot be 2003-12-18 13:34 ` bangerth at dealii dot org 2003-12-19 11:05 ` vik dot heyndrickx at pandora dot be 2004-04-06 5:13 ` eggert at twinsun dot com [this message] [not found] <bug-13421-4@http.gcc.gnu.org/bugzilla/> 2021-12-29 6:12 ` [Bug middle-end/13421] IA32 bigmem pointer subtraction and –ftrapv " pinskia at gcc dot gnu.org 2023-06-25 2:01 ` pinskia at gcc dot gnu.org 2024-04-30 11:05 ` cvs-commit at gcc dot gnu.org 2024-05-02 6:33 ` rguenth 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=20040406051310.30913.qmail@sources.redhat.com \ --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: linkBe 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).