public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/1823] -ftrapv aborts with pointer difference due to division optimization
       [not found] <20010131120600.1823.meeberdt@unity.ncsu.edu>
@ 2003-07-06 17:09 ` falk at debian dot org
  2003-07-06 17:27 ` falk at debian dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: falk at debian dot org @ 2003-07-06 17:09 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1823


falk at debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CLOSED                      |REOPENED
          Component|libstdc++                   |optimization
         Resolution|FIXED                       |
            Summary|program compiled with -     |-ftrapv aborts with pointer
                   |ftrapv aborts in            |difference due to division
                   |std::queue<>.size()         |optimization
            Version|3.0                         |3.4


------- Additional Comments From falk at debian dot org  2003-07-06 17:09 -------
Here's a test case (works for me on alpha-linux mainline):

struct s { char c[3]; };

__PTRDIFF_TYPE__ frob (struct s *cur, struct s *last) {
    return last - cur;
}

int main (void) {
    struct s a[17];

    if (frob(a, a + 17) != 17)
	abort ();

    return 0;
}

The problem is caused by the optimization of the division by three to a
multiplication with 0xaaaaaaaaaaaaaaab; this works since the difference
is known to be a multiple of 3.

However, the multiplication is done with a trapping instruction:

subq/v  a1,a0,t2
ldq     t3,32256(t0)	# 0xaaaaaaaaaaaaaaab
mulq/v  t2,t3,v0	# traps
ret


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

* [Bug optimization/1823] -ftrapv aborts with pointer difference due to division optimization
       [not found] <20010131120600.1823.meeberdt@unity.ncsu.edu>
  2003-07-06 17:09 ` [Bug optimization/1823] -ftrapv aborts with pointer difference due to division optimization falk at debian dot org
@ 2003-07-06 17:27 ` falk at debian dot org
  2003-07-06 17:30 ` falk at debian dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: falk at debian dot org @ 2003-07-06 17:27 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1823


falk at debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |169862 at bugs dot debian
                   |                            |dot org


------- Additional Comments From falk at debian dot org  2003-07-06 17:27 -------
*** Bug 9067 has been marked as a duplicate of this bug. ***


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

* [Bug optimization/1823] -ftrapv aborts with pointer difference due to division optimization
       [not found] <20010131120600.1823.meeberdt@unity.ncsu.edu>
  2003-07-06 17:09 ` [Bug optimization/1823] -ftrapv aborts with pointer difference due to division optimization falk at debian dot org
  2003-07-06 17:27 ` falk at debian dot org
@ 2003-07-06 17:30 ` falk at debian dot org
  2003-09-05 18:28 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: falk at debian dot org @ 2003-07-06 17:30 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1823


falk at debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wefing at gmx dot de


------- Additional Comments From falk at debian dot org  2003-07-06 17:30 -------
*** Bug 9088 has been marked as a duplicate of this bug. ***


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

* [Bug optimization/1823] -ftrapv aborts with pointer difference due to division optimization
       [not found] <20010131120600.1823.meeberdt@unity.ncsu.edu>
                   ` (2 preceding siblings ...)
  2003-07-06 17:30 ` falk at debian dot org
@ 2003-09-05 18:28 ` cvs-commit at gcc dot gnu dot org
  2003-09-06  1:31 ` roger at eyesopen dot com
  2003-10-17 17:48 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-05 18:28 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1823



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-09-05 18:28 -------
Subject: Bug 1823

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2003-09-05 18:28:48

Modified files:
	gcc            : ChangeLog expmed.c 

Log message:
	PR optimization/1823
	* expmed.c (expand_divmod <EXACT_DIV_EXPR>): Use an unsigned
	multiplication to implement division by constant integer.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.980&r2=2.981
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expmed.c.diff?cvsroot=gcc&r1=1.140&r2=1.141


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

* [Bug optimization/1823] -ftrapv aborts with pointer difference due to division optimization
       [not found] <20010131120600.1823.meeberdt@unity.ncsu.edu>
                   ` (3 preceding siblings ...)
  2003-09-05 18:28 ` cvs-commit at gcc dot gnu dot org
@ 2003-09-06  1:31 ` roger at eyesopen dot com
  2003-10-17 17:48 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 6+ messages in thread
From: roger at eyesopen dot com @ 2003-09-06  1:31 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1823


roger at eyesopen dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


------- Additional Comments From roger at eyesopen dot com  2003-09-06 01:31 -------
This has now been fixed on mainline.


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

* [Bug optimization/1823] -ftrapv aborts with pointer difference due to division optimization
       [not found] <20010131120600.1823.meeberdt@unity.ncsu.edu>
                   ` (4 preceding siblings ...)
  2003-09-06  1:31 ` roger at eyesopen dot com
@ 2003-10-17 17:48 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-17 17:48 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1823


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.4


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

end of thread, other threads:[~2003-10-17 17:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010131120600.1823.meeberdt@unity.ncsu.edu>
2003-07-06 17:09 ` [Bug optimization/1823] -ftrapv aborts with pointer difference due to division optimization falk at debian dot org
2003-07-06 17:27 ` falk at debian dot org
2003-07-06 17:30 ` falk at debian dot org
2003-09-05 18:28 ` cvs-commit at gcc dot gnu dot org
2003-09-06  1:31 ` roger at eyesopen dot com
2003-10-17 17:48 ` pinskia at gcc dot gnu dot 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).