[Insight-developers] ITK and gcc 4.4.0

Bill Lorensen bill.lorensen at gmail.com
Wed Jun 10 12:10:26 EDT 2009


The correct place to initialize is when the array is used. I have
fixed these sorts of warnings in the past. Sometimes they actually
uncover errors. Other times, the logic is too complicated for the
compiler to recognize.

Several occur when the GetPoint method is applied to a mesh, since the
point may not exists. We don't seem to always check the return of this
method.

Bill

On Wed, Jun 10, 2009 at 11:55 AM, Luis Ibanez<luis.ibanez at kitware.com> wrote:
>
> Hi Arnaud,
>
> I think that we were not initializing the internal array on purpose.
>
> This is because FixedArray is the base class for
>
>   Index
>   Point
>   Vector
>   CovariantVector
>
> and therefore when you allocate a large collection of them
> (for example Points) you pay for the time of initializing
> all of its internal components.
>
>
> Probably the right place to fix those warnings is in the
> code that invoke the FixedArray...
> (but I must confess that I have not looked at the code yet...)
>
>
>   Luis
>
>
> --------------------
> Arnaud Gelas wrote:
>>
>> Luis,
>>
>> By initializing m_InternalArray in itk::FixedArray, it would reduce a lot
>> the number of warning.
>> Should we initialize all values to zero by default?
>>
>> Arnaud
>>
>> Arnaud Gelas wrote:
>>
>>> Hi Luis,
>>>
>>> I have updated the OS from Fedora Core 10 to Fedora Core 11, and the
>>> default compiler is now gcc 4.4.0
>>>
>>> Arnaud
>>>
>>> Luis Ibanez wrote:
>>>
>>>>
>>>> Hi Arnaud,
>>>>
>>>> Thanks for pointing this out.
>>>>
>>>> The warning
>>>>
>>>> **
>>>> /.../Insight/Utilities/gdcm/src/gdcmDocument.cxx:2182: warning:
>>>> dereferencing type-punned pointer will break strict-aliasing rules
>>>>
>>>>  **
>>>>  for the expression:
>>>>
>>>>   char deb[256];
>>>>   uint16_t  s16;
>>>>
>>>>   s16 = *((uint16_t *)(deb));
>>>>
>>>>
>>>> Indicates a real problem.
>>>>
>>>>
>>>> I believe, the correct way of performing this conversion
>>>> is by using a union {}.
>>>>
>>>>
>>>> We may have to rework some expressions to fix these
>>>> warnings.
>>>>
>>>>
>>>> Just out of curiosity:
>>>> Did you updated gcc as a package ?
>>>> or did you build it in your system ?
>>>>
>>>>
>>>>
>>>>   Thanks
>>>>
>>>>
>>>>      Luis
>>>>
>>>>
>>>> ---------------------------------------
>>>> On Wed, Jun 10, 2009 at 9:31 AM, Arnaud Gelas
>>>> <arnaud_gelas at hms.harvard.edu <mailto:arnaud_gelas at hms.harvard.edu>> wrote:
>>>>
>>>>    Hi guys,
>>>>
>>>>    Yesterday I updated sanchome's OS. From last night this machine
>>>>    has now gcc 4.4.0 installed (despite it was reported gcc 4.3.2 on
>>>>    the dashboard).
>>>>    Apparently it has generated a lot of warnings...
>>>>
>>>>    http://www.cdash.org/CDash/viewBuildError.php?type=1&buildid=352211
>>>>    <http://www.cdash.org/CDash/viewBuildError.php?type=1&buildid=352211>
>>>>    http://www.cdash.org/CDash/viewBuildError.php?type=1&buildid=352274
>>>>    <http://www.cdash.org/CDash/viewBuildError.php?type=1&buildid=352274>
>>>>
>>>>    Regards,
>>>>    Arnaud
>>>>    _______________________________________________
>>>>    Powered by www.kitware.com <http://www.kitware.com>
>>>>
>>>>    Visit other Kitware open-source projects at
>>>>    http://www.kitware.com/opensource/opensource.html
>>>>
>>>>    Please keep messages on-topic and check the ITK FAQ at:
>>>>    http://www.itk.org/Wiki/ITK_FAQ
>>>>
>>>>    Follow this link to subscribe/unsubscribe:
>>>>    http://www.itk.org/mailman/listinfo/insight-developers
>>>>
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>
>>
>>
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list