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

arm cross-compiler ICE report



Hello.

Some time ago I posted a patch for gcc-3.3 source package that enables 
cross-compiler build.

Using that patch, I built cross-compilers for arm-linux and started to use 
them to build software for my Ipaq.

Today I've got an ICE.

I was able to cut down the problematic file and to create somewhat minimal 
example that reproceses ICE. It even contains no #include's :)

However, I don't know how to report such bugs correctly.
It seems to be incorrect to report the bug to upstream gcc, because the 
cross-compiler it is bult from Debain package and contains Debian patches.
It seems to be incorrect to report the bug to Debain BTS, because Debian 
curently does not support gcc cross-compilers.

So I am writing this mail.

The example code that triggers the bug is attached. The compiler command 
line and the output is:

nikita@bliss:/tmp> arm-linux-gcc -v -c -march=armv4 -mtune=strongarm1100 
-O2 -fPIC -o bug.o bug.c
Reading specs from /usr/lib/gcc-lib/arm-linux/3.3.3/specs
Configured with: ../src/configure -v --enable-languages=c,c++ --prefix=/usr 
--mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/
usr/arm-linux/include/c++/3.3 --enable-shared --with-system-zlib 
--enable-nls --without-included-gettext --enable-__cxa_atexit 
--enable-clocale=gnu --enable-debug --includedir=/usr/arm-linux/include 
--build=i386-linux --host=i386-linux --target=arm-linux
Thread model: posix
gcc version 3.3.3 20040110 (prerelease) (Debian)
 /usr/lib/gcc-lib/arm-linux/3.3.3/cc1 -quiet -v -D__GNUC__=3 
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D__ARM_ARCH_4__ -D__PIC__ 
-D__pic__ bug.c -quiet -dumpbase bug.c -march=armv4 -mtune=strongarm1100 
-auxbase-strip bug.o -O2 -version -fPIC -o /tmp/ccxt2fwg.s
GNU C version 3.3.3 20040110 (prerelease) (Debian) (arm-linux)
        compiled by GNU C version 3.3.3 20040110 (prerelease) (Debian).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32048
ignoring nonexistent directory "/usr/arm-linux/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc-lib/arm-linux/3.3.3/include
 /usr/arm-linux/include
End of search list.
bug.c: In function `f':
bug.c:39: error: insn does not satisfy its constraints:
(insn:HI 210 501 227 0x402e0370 (set (reg:HI 3 r3 [168])
        (mem:HI (label_ref 668) [0 S2 A16])) 171 {*movhi_insn_arch4} (nil)
    (nil))
bug.c:39: internal compiler error: in final_scan_insn, at final.c:2722
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

All shown compiler options are needed to reproduce the bug; removing any 
one make bug to disappear. Attempt to remove lines of code from the 
problematic function also make bug to disappear.

Most likely the same problem will arise with native arm gcc 3.3 package. 
(but I don't have access to appropriate hardware to test). 
extern double floor(double x);

#define SPLINE_QUANTBITS	14
#define SPLINE_QUANTSCALE	(1L<<SPLINE_QUANTBITS)
#define SPLINE_FRACBITS 	10

static signed short lut[4*(1L<<SPLINE_FRACBITS)];

void f(void)
{
	int _LIi;
	int _LLen = (1L<<SPLINE_FRACBITS);
	float _LFlen = 1.0f / (float)_LLen;
	float _LScale = (float)SPLINE_QUANTSCALE;
	for ( _LIi=0; _LIi<_LLen; _LIi++ )
	{
		float _LCm1, _LC0, _LC1, _LC2;
		int _LSum;
		float _LX = ((float)_LIi)*_LFlen;
		int _LIdx = _LIi<<2;
		_LCm1 = (float)floor( 0.5 + _LScale * (-0.5*_LX*_LX*_LX + 1.0 * _LX*_LX - 0.5 * _LX ) );
		_LC0 = (float)floor( 0.5 + _LScale * ( 1.5*_LX*_LX*_LX - 2.5 * _LX*_LX + 1.0 ) );
		_LC1 = (float)floor( 0.5 + _LScale * (-1.5*_LX*_LX*_LX + 2.0 * _LX*_LX + 0.5 * _LX ) );
		_LC2 = (float)floor( 0.5 + _LScale * ( 0.5*_LX*_LX*_LX - 0.5 * _LX*_LX ) );
		lut[_LIdx+0]	= (signed short)( (_LCm1 < -_LScale) ? -_LScale : ((_LCm1 > _LScale) ? _LScale : _LCm1) );
		lut[_LIdx+1]	= (signed short)( (_LC0  < -_LScale) ? -_LScale : ((_LC0  > _LScale) ? _LScale : _LC0 ) );
		lut[_LIdx+2]	= (signed short)( (_LC1  < -_LScale) ? -_LScale : ((_LC1  > _LScale) ? _LScale : _LC1 ) );
		lut[_LIdx+3]	= (signed short)( (_LC2  < -_LScale) ? -_LScale : ((_LC2  > _LScale) ? _LScale : _LC2 ) );

		_LSum = lut[_LIdx+0]+lut[_LIdx+1]+lut[_LIdx+2]+lut[_LIdx+3];
		if ( _LSum != SPLINE_QUANTSCALE )
		{	int _LMax = _LIdx;
			if( lut[_LIdx+1]>lut[_LMax] ) _LMax = _LIdx+1;
			if( lut[_LIdx+2]>lut[_LMax] ) _LMax = _LIdx+2;
			if( lut[_LIdx+3]>lut[_LMax] ) _LMax = _LIdx+3;
			lut[_LMax] += (SPLINE_QUANTSCALE-_LSum);
		}
	}
}

Reply to: