[patch] Fix scalar_blocks to work with GCC 3.4

Jules Bergmann jules at codesourcery.com
Mon Jun 18 20:30:56 UTC 2007


This patch scales back the scalar-block optimization a bit when using 
GCC 3.x (anything pre 4.0).

GCC 3.4.4 was having trouble compiling expressions like this one from 
threshold.cpp:

	Vector<float> A, C;
	float b = 0.5;

	C = ite(A >= b, A, 0.0)

The scalar value for b (0.5) was being replaced by the scalar value 
(0.0).  Any of the following changes made the error go away:

  - compiling with lower optimization levels
  - compiling with less aggressive inlining options
  - using printfs to examine the values stored in the
    expression blocks
  - using later versions of GCC

Similar errors occured in the coverage_ternary_*.cpp tests, but were 
even more difficult to debug because most attempts to simplify the test 
case or print debugging information caused the error go away.

The fix adds a copy constructor equivalent to the default copy 
constructor, which IIUC forces GCC to store scalar_blocks (and any 
expression containing scalar_blocks) on the stack.

This patch also separates benchmark installation into a separate rule. 
The rationale for this is that building the benchmarks takes much longer 
than building the core library and installing the benchmarks isn't 
necessary to use the library.

Patch applied, snapshot started!

				-- Jules

-- 
Jules Bergmann
CodeSourcery
jules at codesourcery.com
(650) 331-3385 x705
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix-sb.diff
URL: <http://sourcerytools.com/pipermail/vsipl++/attachments/20070618/545823ca/attachment.ksh>


More information about the vsipl++ mailing list