public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vik dot heyndrickx at pandora dot be" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/13421] New: IA32 bigmem pointer subtraction and Âftrapv option causes unjustified program abort Date: Wed, 17 Dec 2003 16:33:00 -0000 [thread overview] Message-ID: <20031217152930.13421.vik.heyndrickx@pandora.be> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2236 bytes --] kernel-2.4.22-1.2115.nptl, glibc-2.3.2-101.1 Configured with: ../configure --prefix=/usr --mandir=/usr/share/man -- infodir=/usr/share/info --enable-shared --enable-threads=posix --disable- checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1) Circumstances: -ftrapv is a gcc compiler option used to detect signed integer overflow conditions, and as such is frequently used to debug programs. This flag is by default disabled. On IA32 these days adressible memory for a process can be larger than 2^31 octets. It is possible for a memory block whose lower bound address is less than 2^31 en whose upper bound address is larger than 2^31, to be assigned. Subtracting these two addresses is a normal operation to determine the size of that block. It appears however that when -ftrapv is used to compile a program, execution of this program is aborted when subtracting these pointers. In my opinion this should not happen, because there is nothing illegal about. Example of failing program test.c (it looks "manufactured", but is short, the real program I encountered this problem with is less manufactured, I got the addresses from malloc(), and that program was long): <cut> long signed diff = 0; void setdiff (unsigned char *a, unsigned char *b) { diff = b - a; } int main (void) { unsigned char *a, *b; a = (unsigned char*)0x7FFFF000u; b = (unsigned char*)0x80000001u; setdiff (a, b); return 0; } </cut> Compiler command line: gcc -ftrapv test.c execution of the resulting program a.out: Aborted -- Summary: IA32 bigmem pointer subtraction and ftrapv option causes unjustified program abort Product: gcc Version: 3.3.2 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vik dot heyndrickx at pandora dot be CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13421
next reply other threads:[~2003-12-17 15:29 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-12-17 16:33 vik dot heyndrickx at pandora dot be [this message] 2003-12-17 16:58 ` [Bug c/13421] IA32 bigmem pointer subtraction and ftrapv " 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 ` [Bug middle-end/13421] " eggert at twinsun dot com
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=20031217152930.13421.vik.heyndrickx@pandora.be \ --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).