From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2561 invoked by alias); 11 Aug 2003 02:55:07 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 2550 invoked by uid 48); 11 Aug 2003 02:55:07 -0000 Date: Mon, 11 Aug 2003 02:55:00 -0000 Message-ID: <20030811025507.2548.qmail@sources.redhat.com> From: "pinskia at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20030106103602.9196.aj@suse.de> References: <20030106103602.9196.aj@suse.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug optimization/9196] [3.4 regression] Inlining of function with void * arithmetic is misoptimized X-Bugzilla-Reason: CC X-SW-Source: 2003-08/txt/msg01301.txt.bz2 List-Id: 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).