[Insight-developers] Dashboard Cleanup: RogueResearch6 : itkStatisticsAlgorithmTest : LLVM compiler

Luis Ibanez luis.ibanez at kitware.com
Thu Jan 21 17:52:01 EST 2010


Hi Sean, Brad,

I think I have found the cause of the problem in the LLVM build.

The method itk::Subsample::GetMeasurementVectorByIndex()

had the following signature:

MeasurementVectorType   GetMeasurementVectorByIndex(int index) const;

(returning by copy),
when it should have been:

const MeasurementVectorType & GetMeasurementVectorByIndex(int index) const;


The code in the itkStatisticsAlgorithm was calling this function
Java-style (which is a poor practice anyways, and probably can
be considered part of the error...) as:


549     while (backwardIndex > beginIndex)
550       {
551       if (sample->GetMeasurementVectorByIndex(backwardIndex)[activeDimension]
<
552           sample->GetMeasurementVectorByIndex(backwardIndex -
1)[activeDimension])
553         {
554         sample->Swap(backwardIndex, backwardIndex - 1);
555         }
556       else
557         {
558         break;
559         }
560       --backwardIndex;
561       }


The signature of

             itk::Subsample::GetMeasurementVectorByIndex()

has now been fixed to return a const reference both in

          Insight/Code/Numerics/Statistics       and
          Insight/Code/Review/Statistics

We probably should consider replacing also the expressions:

sample->GetMeasurementVectorByIndex(backwardIndex)[activeDimension]

with something like

    const MeasurementVectorType & mm1 =
         sample->GetMeasurementVectorByIndex(backwardIndex);

    mm1[activeDimension]....


to clean up the style.

----

We will see the effect in tomorrow's
build of RogueResearch6.


Brad:  I didn't apply your patch, since by itself
           it was not fixing this particular problem.
           However, we should still look at committing it.


    Luis


-------------------------------------------------------------------------------
On Thu, Jan 21, 2010 at 11:24 AM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> On Wed, Jan 20, 2010 at 7:21 PM, Sean McBride <sean at rogue-research.com> wrote:
>> On 1/19/10 7:47 PM, Luis Ibanez said:
>>
>>>I have managed to reproduce the problem in my laptop.
>>
>> Glad it's not only on our machine! :)
>>
>>>    *   Ubuntu 9.10 64 bits
>>>    *   Compiler LLVM-gcc-4.2  (64 bits) (1) below
>>>    *   Building for Debug (enabled in ccmake)
>>>
>>>
>>>(1) [ /usr/lib/llvm/llvm/gcc-4.2/bin/x86_64-linux-gnu-llvm-g++ ]
>>
>> Are you using llvm 2.6?  I'm using the one that comes with Xcode 3.2.1
>> which is older:
>>
>> $ llvm-g++ --version
>> i686-apple-darwin10-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build
>> 5646) (LLVM build 2206)
>>
> --------------------------------------------
>
>
> Hi Sean,
>
>
> I'm using the llvm that comes with Ubuntu 9.10:
>
> /usr/lib/llvm/llvm/gcc-4.2/bin/x86_64-linux-gnu-llvm-g++    --version
>
> x86_64-linux-gnu-llvm-g++ (GCC) 4.2.1 (Based on Apple Inc. build 5649)
> (LLVM build)
>
> Copyright (C) 2007 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>
> I still have to try the patch that Brad posted
> yesterday. I'll do that this afternoon.
>
>
>     Luis
>


More information about the Insight-developers mailing list