[ET Trac] [Einstein Toolkit] #2106: Make ParseFile.c more robust

Einstein Toolkit trac-noreply at einsteintoolkit.org
Mon Mar 12 11:43:35 CDT 2018


#2106: Make ParseFile.c more robust
-----------------------+----------------------------------------------------
  Reporter:  eschnett  |       Owner:                     
      Type:  defect    |      Status:  reopened           
  Priority:  unset     |   Milestone:                     
 Component:  Cactus    |     Version:  development version
Resolution:            |    Keywords:                     
-----------------------+----------------------------------------------------

Comment (by rhaas):

 Yes, please. The "< 0" vs. "== -1" is the only thing missing. In line 347
 {{{
 if (*filesize < 0)
 }}}
 it it probably best to actually write
 {{{
 if (*filesize == (unsigned long int)-1)
 }}}
 since in the current version an aggressively optimizing compiler might do
 the following steps:
 * filesize is declared to be {{{unsigned long *filesize}}}
 * unsigned values can never be negative
 * the if statement can never trigger
 * compiler removes the error check (though usually at least generating a
 warning)

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/2106#comment:7>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list