[Bug ada/62065] New: ada/sysdep.c:868: possible coding error ?

dcb314 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Fri Aug 8 16:53:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62065

            Bug ID: 62065
           Summary: ada/sysdep.c:868: possible coding error ?
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

[trunk/gcc/ada/sysdep.c:868] -> [trunk/gcc/ada/sysdep.c:869]: (performance)
Variable 'tz_end' is reassigned a value before the old one has been used.

Normally, I wouldn't bother with this kind of message, but have
a look at this code

    /* The format of the data contained in TIMEZONE is N::U:S:E where N is the
       name of the time zone, U are the minutes difference from UTC, S is the
       start of DST in mmddhh and E is the end of DST in mmddhh. Extracting
       the value of U involves setting two pointers, one at the beginning and
       one at the end of the value. The end pointer is then set to null in
       order to delimit a string slice for atol to process. */

    tz_start = index (tz_str, ':') + 2;
    tz_end = index (tz_start, ':');
    tz_end = '\0';

Maybe

    /* The format of the data contained in TIMEZONE is N::U:S:E where N is the
       name of the time zone, U are the minutes difference from UTC, S is the
       start of DST in mmddhh and E is the end of DST in mmddhh. Extracting
       the value of U involves setting two pointers, one at the beginning and
       one at the end of the value. The end pointer is then set to null in
       order to delimit a string slice for atol to process. */

    tz_start = index (tz_str, ':') + 2;
    tz_end = index (tz_start, ':');
    *tz_end = '\0';

was intended ?



More information about the Gcc-bugs mailing list