-----Original Message-----
> From: <owner-src-committ...@freebsd.org> on behalf of Kyle Evans 
> <kevan...@ksu.edu>
> Date: 2016-12-02, Friday at 20:44
> To: "Kenneth D. Merry" <k...@freebsd.org>
> Cc: <src-committ...@freebsd.org>, <svn-src-all@freebsd.org>, 
> <svn-src-h...@freebsd.org>
> Subject: Re: svn commit: r309374 - in head: sbin/camcontrol sys/cam/scsi
> 
>> [...]
>> +
>> +       if (action == TIMESTAMP_REPORT) {
>> +               error = report_timestamp(device, &ts, retry_count,
>> +                   timeout);
>> +               if (error != 0) {
>> +                       goto bailout;
>> +               } else if (strcmp(format_string, MIL) == 0) {
>> +                       printf("Timestamp in milliseconds: %ju\n",
>> +                           (uintmax_t)ts);
>> +               } else {
>> +                       char temp_timestamp_string[100];
>> +                       time_t time_var = ts / 1000;
> 
> Hi,
> 
> FWIW: Building -CURRENT on mips.mips (w/ freebsd-wifi-build),
> mips-gcc gets upset at the above line with the following error:
> 
> /wifi-build/src/sbin/camcontrol/timestamp.c: In function 'timestamp':
> /wifi-build/src/sbin/camcontrol/timestamp.c:459:25: error: 'ts' may be
> used uninitialized in this function [-Werror=maybe-uninitialized]
>     time_t time_var = ts / 1000;

Interesting. I just did a tinderbox build earlier this evening, and this wasn't 
reported.

> I understand that this is a bogus error because at this point it
> pretty much *has* to be set by the report_timestamp call just prior,
> but is there a clean way to trick GCC into agreeing, or is it just a
> matter of explicitly initializing it to 0 before the report_timestamp
> call?

Actually, it's a valid warning. While all paths to that point in timestamp() go 
through report_timestamp(), not all paths through report_timestamp() set *ts. 
Specifically, if cam_getccb() or cam_send_ccb() fail, or the request was not 
completed, report_timestamp() does 'goto bailout' without setting *ts.

I'm disappointed that `clang' (on i386 and amd64) didn't notice this; I was 
under the impression `clang' did more of that type of deep path analysis than 
`gcc'. <shrug>

-Ravi (rpokala@)

> Thanks,
> 
> Kyle Evans



_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to