This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [3.1.1] Re: GCC performance regression - its memset!
- From: Glen Nakamura <glen at imodulo dot com>
- To: roger at eyesopen dot com
- Cc: jakub at redhat dot com, jh at suse dot cz, gcc at gcc dot gnu dot org
- Date: Mon, 20 May 2002 09:24:23 -1000
- Subject: Re: [3.1.1] Re: GCC performance regression - its memset!
> Hi Jakub,
>
> As I've mentioned in a previous e-mail, I believe that this test
> case is poorly formed; quite clearly the x argument to foo is
> incorrectly aligned for the type. On many platforms, the above
> code (and even with foo defined as "*x = 0;") will fail at runtime.
>
> The benefit of Jan's patch is that on machines without alignment
> restrictions, we'll still produce the "expected behaviour" for
> incorrectly written programs. Mozilla's source code is incorrect
> and needs to be fixed (use void* rather than void**). This isn't
> really a correctness PR, more a quality of implementation for
> undefined behaviour PR.
>
> Roger
Aloha,
FWIW, I think this really is a regression... The problem is really
that memset doesn't properly set bytes at the tail of the buffer.
How about this testcase?
- Glen Nakamura
/* PR optimization/6703 */
extern void abort (void);
extern void exit (int);
void foo (int *x, int y)
{
__builtin_memset (x, 0, y);
}
int main ()
{
int x[2] = { 0x5a5a5a5a, 0x5a5a5a5a };
if (x[1] != 0x5a5a5a5a)
abort ();
foo (x, 5);
if (x[1] == 0x5a5a5a5a)
abort ();
exit (0);
}