[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#323646: gcc-4.0: -O1 -msse2 -ftree-vectorize breaks certain code



close 323646 4.0.1-5
thanks

fixed at least in gcc-4.0_4.0.1-5

Alexander Toresson writes:
> Package: gcc-4.0
> Version: 4.0.1-2
> Severity: normal
> 
> 
> When compiled with -O1 -msse2 -ftree-vectorize, the following code
> snippet segfaults on data[i] = 1;:
> 
> #include <stdlib.h>
> 
> void *NM_First;
> 
> void *NM_Allocate(int bytes)
> {
> 	void *ret;
> 	while (1)
> 	{
> 		ret = NM_First;
> 		NM_First = (void*) ((long) NM_First + bytes);
> 		return ret;
> 	}
> 	return 0;
> }
> 
> 
> void* repeat_atom()
> {
> 	double *data;
> 	void* item;
> 	int i;
> 	data = NM_Allocate(16);
> 	for (i=0; i < 4; i++)
> 	{
> 		data[i] = 1;
> 	}
> 	item = NM_Allocate(12);
> 	return item;	
> }
> 
> int main()
> {
> 	struct ITEM *array1, *array2;
> 	
> 	NM_First = malloc(256);
> 	
> 	array1 = repeat_atom();
> 	array2 = repeat_atom();
> 	
> 	return 0;
> }
> 
> This was tested on a Pentium M Sonoma.
> 
> Regards, Alexander Toresson
> 
> -- System Information:
> Debian Release: testing/unstable
>   APT prefers testing
>   APT policy: (500, 'testing')
> Architecture: i386 (i686)
> Shell:  /bin/sh linked to /bin/bash
> Kernel: Linux 2.6.12.1.custom.1.1
> Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)
> 
> Versions of packages gcc-4.0 depends on:
> ii  binutils                      2.16.1-3   The GNU assembler, linker and bina
> ii  cpp-4.0                       4.0.1-2    The GNU C preprocessor
> ii  gcc-4.0-base                  4.0.1-2    The GNU Compiler Collection (base 
> ii  libc6                         2.3.5-4    GNU C Library: Shared libraries an
> ii  libgcc1                       1:4.0.1-2  GCC support library
> 
> Versions of packages gcc-4.0 recommends:
> ii  libc6-dev                     2.3.5-4    GNU C Library: Development Librari
> pn  libmudflap0-dev               <none>     (no description available)
> 
> -- no debconf information



Reply to: