Vim 7.3a compile warning (undo.c:1265) 'uhp' may be used uninitialized

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Vim 7.3a compile warning (undo.c:1265) 'uhp' may be used uninitialized

Tony Mechelynck
Compiling vim 7.3a (huge) at changeset aa6412cab544 (2010-15-29 20:33:07
+0200) on Linux using gcc 4.4.1

 > undo.c: In function ‘u_read_undo’:
 > undo.c:1265: warning: ‘uhp’ may be used uninitialized in this function

I don't feel qualified to determine with certainty whether or not that
warning is a false alarm; anyway I suppose it wouldn't hurt to
initialize the pointer (a local variable used at lines 1368 to 1530) to
NULL at entry into the function.

Best regards,
Tony.
--
ARTHUR:  You fight with the strength of many men, Sir knight.
          I am Arthur, King of the Britons.  [pause]
          I seek the finest and the bravest knights in the land to join me
          in my Court of Camelot.  [pause]
          You have proved yourself worthy; will you join me?  [pause]
          You make me sad.  So be it.  Come, Patsy.
BLACK KNIGHT:  None shall pass.
                                   The Quest for the Holy Grail (Monty
Python)

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Vim 7.3a compile warning (undo.c:1265) 'uhp' may be used uninitialized

Bram Moolenaar

Tony Mechelynck wrote:

> Compiling vim 7.3a (huge) at changeset aa6412cab544 (2010-15-29 20:33:07
> +0200) on Linux using gcc 4.4.1
>
>  > undo.c: In function ‘u_read_undo’:
>  > undo.c:1265: warning: ‘uhp’ may be used uninitialized in this function
>
> I don't feel qualified to determine with certainty whether or not that
> warning is a false alarm; anyway I suppose it wouldn't hurt to
> initialize the pointer (a local variable used at lines 1368 to 1530) to
> NULL at entry into the function.

Thanks for reporting this.  Somehow my compiler doesn't warn for this
type of error.  I need to check the arguments...

It was actually a valid error, there was a free(uhp) that should not be
there.  copy/paste gone wrong.

--
I have a watch cat! Just break in and she'll watch.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Vim 7.3a compile warning (undo.c:1265) 'uhp' may be used uninitialized

Dominique Pellé
Bram Moolenaar wrote:

> Tony Mechelynck wrote:
>
>> Compiling vim 7.3a (huge) at changeset aa6412cab544 (2010-15-29 20:33:07
>> +0200) on Linux using gcc 4.4.1
>>
>>  > undo.c: In function ‘u_read_undo’:
>>  > undo.c:1265: warning: ‘uhp’ may be used uninitialized in this function
>>
>> I don't feel qualified to determine with certainty whether or not that
>> warning is a false alarm; anyway I suppose it wouldn't hurt to
>> initialize the pointer (a local variable used at lines 1368 to 1530) to
>> NULL at entry into the function.
>
> Thanks for reporting this.  Somehow my compiler doesn't warn for this
> type of error.  I need to check the arguments...

Maybe you compiled with -O0?  If so, gcc would not complain about it.

This warning is only reported when compiling with optimization -O1
-O2 or -O3.  See info about -Wuninitialized (which is enabled with -Wall)
in man gcc.

-- Dominique

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php