public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/9196] [3.4 regression] Inlining of function with void * arithmetic is misoptimized
[not found] <20030106103602.9196.aj@suse.de>
@ 2003-06-03 19:14 ` pinskia@physics.uc.edu
2003-06-09 6:02 ` aj@gcc.gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-03 19:14 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=9196
pinskia@physics.uc.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
------- Additional Comments From pinskia@physics.uc.edu 2003-06-03 19:14 -------
Moving up priority because it effects glibc.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/9196] [3.4 regression] Inlining of function with void * arithmetic is misoptimized
[not found] <20030106103602.9196.aj@suse.de>
2003-06-03 19:14 ` [Bug optimization/9196] [3.4 regression] Inlining of function with void * arithmetic is misoptimized pinskia@physics.uc.edu
@ 2003-06-09 6:02 ` aj@gcc.gnu.org
2003-07-05 3:07 ` pinskia at physics dot uc dot edu
` (5 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: aj@gcc.gnu.org @ 2003-06-09 6:02 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=9196
------- Additional Comments From aj@gcc.gnu.org 2003-06-09 06:02 -------
Bug confirmed with gcc (GCC) 3.4 20030604 (experimental).
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/9196] [3.4 regression] Inlining of function with void * arithmetic is misoptimized
[not found] <20030106103602.9196.aj@suse.de>
2003-06-03 19:14 ` [Bug optimization/9196] [3.4 regression] Inlining of function with void * arithmetic is misoptimized pinskia@physics.uc.edu
2003-06-09 6:02 ` aj@gcc.gnu.org
@ 2003-07-05 3:07 ` pinskia at physics dot uc dot edu
2003-07-28 1:17 ` pinskia at physics dot uc dot edu
` (4 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-05 3:07 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=9196
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|0000-00-00 00:00:00 |2003-07-05 03:07:33
date| |
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-05 03:07 -------
still happens on the mainline (20030704).
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/9196] [3.4 regression] Inlining of function with void * arithmetic is misoptimized
[not found] <20030106103602.9196.aj@suse.de>
` (2 preceding siblings ...)
2003-07-05 3:07 ` pinskia at physics dot uc dot edu
@ 2003-07-28 1:17 ` pinskia at physics dot uc dot edu
2003-08-11 2:55 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-28 1:17 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=9196
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Priority|P2 |P1
Last reconfirmed|2003-07-05 03:07:33 |2003-07-28 01:17:21
date| |
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-28 01:17 -------
Still happens on the mainline (20030727).
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/9196] [3.4 regression] Inlining of function with void * arithmetic is misoptimized
[not found] <20030106103602.9196.aj@suse.de>
` (3 preceding siblings ...)
2003-07-28 1:17 ` pinskia at physics dot uc dot edu
@ 2003-08-11 2:55 ` pinskia at gcc dot gnu dot org
2003-08-11 18:02 ` [Bug optimization/9196] [3.4 regression] Inlining of function with pointer " pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-11 2:55 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=9196
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2003-07-28 01:17:21 |2003-08-11 02:55:06
date| |
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-11 02:55 -------
It is not the char * arithmetic that is being miscompiled as if I replace the void* inside __memrchr
with char*, I still get the miscompile. Also the code is wrong it uses D when it really meant to use
d and it should be using "+" instead of "=" aqnd it has enouns additions of accesing the memory.
__inline void *
__memrchr (__const char *__s, int __c, size_t __n)
{
register unsigned long int __d0;
register char *__res;
if (__n == 0)
return ((void *)0);
__res = __s + __n - 1;
__d0 = __n;
__asm__ __volatile__
("std\n\t"
"repne; scasb\n\t"
"je 1f\n\t"
"orl $-1,%0\n"
"1:\tcld"
: "+d" (__res), "+c" (__d0)
: "a" (__c)
: "cc");
return (void*)(__res + 1);
}
If I change "register char *__res;" to "register int __res;", it works so it looks like it is the pointer
which causes this.
Also it goes wrong in combine (GCC sets __res dead after asm for some reason).
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/9196] [3.4 regression] Inlining of function with pointer arithmetic is misoptimized
[not found] <20030106103602.9196.aj@suse.de>
` (4 preceding siblings ...)
2003-08-11 2:55 ` pinskia at gcc dot gnu dot org
@ 2003-08-11 18:02 ` pinskia at gcc dot gnu dot org
2003-08-23 18:57 ` [Bug optimization/9196] [3.4 regression] " pinskia at gcc dot gnu dot org
2003-08-25 20:10 ` zack at gcc dot gnu dot org
7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-11 18:02 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=9196
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[3.4 regression] Inlining of|[3.4 regression] Inlining of
|function with void * |function with pointer
|arithmetic is misoptimized |arithmetic is misoptimized
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-11 18:02 -------
Change summary based on my anlysis last night.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/9196] [3.4 regression] pointer arithmetic is misoptimized
[not found] <20030106103602.9196.aj@suse.de>
` (5 preceding siblings ...)
2003-08-11 18:02 ` [Bug optimization/9196] [3.4 regression] Inlining of function with pointer " pinskia at gcc dot gnu dot org
@ 2003-08-23 18:57 ` pinskia at gcc dot gnu dot org
2003-08-25 20:10 ` zack at gcc dot gnu dot org
7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-23 18:57 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=9196
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2003-08-11 02:55:06 |2003-08-23 18:57:02
date| |
Summary|[3.4 regression] Inlining of|[3.4 regression] pointer
|function with pointer |arithmetic is misoptimized
|arithmetic is misoptimized |
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-23 18:57 -------
The inner has nothing to do with this bug as I can reproduce it when I inlined it myself:
static void test_memrchr (void)
{
it = "memrchr";
void *ret;
{
__const char *__s = "abcd";
int __c = 'z';
size_t __n = 5;
{
register unsigned long int __d0;
register void *__res;
if (__n == 0)
{
ret = (void*)0;
goto end;
}
__res = __s + __n - 1;
__d0 = __n;
__asm__ __volatile__
("std\n\t"
"repne; scasb\n\t"
"je 1f\n\t"
"orl $-1,%0\n"
"1:\tcld"
: "+d" (__res), "+c" (__d0)
: "a" (__c)
: "cc");
ret = (void*)(__res + 1);
}
goto end;
}
end:
check (ret == ((void *)0), 1);
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/9196] [3.4 regression] pointer arithmetic is misoptimized
[not found] <20030106103602.9196.aj@suse.de>
` (6 preceding siblings ...)
2003-08-23 18:57 ` [Bug optimization/9196] [3.4 regression] " pinskia at gcc dot gnu dot org
@ 2003-08-25 20:10 ` zack at gcc dot gnu dot org
7 siblings, 0 replies; 8+ messages in thread
From: zack at gcc dot gnu dot org @ 2003-08-25 20:10 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=9196
zack at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From zack at gcc dot gnu dot org 2003-08-25 20:10 -------
The C semantics for pointer arithmetic mean that GCC is allowed to assume that
this line
return __res + 1;
never causes a null pointer to be returned. The "mis-optimized" code has been
optimized based on that assumption. In short, the bug is in glibc.
The simplest fix is to write "incl %0" as the last instruction of the assembly
block rather than trying to do this calculation in C.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-08-25 20:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20030106103602.9196.aj@suse.de>
2003-06-03 19:14 ` [Bug optimization/9196] [3.4 regression] Inlining of function with void * arithmetic is misoptimized pinskia@physics.uc.edu
2003-06-09 6:02 ` aj@gcc.gnu.org
2003-07-05 3:07 ` pinskia at physics dot uc dot edu
2003-07-28 1:17 ` pinskia at physics dot uc dot edu
2003-08-11 2:55 ` pinskia at gcc dot gnu dot org
2003-08-11 18:02 ` [Bug optimization/9196] [3.4 regression] Inlining of function with pointer " pinskia at gcc dot gnu dot org
2003-08-23 18:57 ` [Bug optimization/9196] [3.4 regression] " pinskia at gcc dot gnu dot org
2003-08-25 20:10 ` zack 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).