Menu

#866 icon-theme.c:174: broken code ?

None
open
nobody
5
2021-03-21
2017-02-27
dcb
No

icon-theme.c:174:25: warning: variable 'theme' is uninitialized when used here [-Wuninitialized]

Suggest initialise local variable 'theme' before first use.

Discussion

  • Mamoru TASAKA

    Mamoru TASAKA - 2017-03-16

    Ah, looks like this is really strange. Note that gcc6.3.1 -O2 -Wall does not warn this, perhaps because gcc has optimized out as "both" variable is always 0 or so.

    I guess the attached patch is what is really intended.

     
  • Mamoru TASAKA

    Mamoru TASAKA - 2017-03-16

    Ah, assembler code generated by compiler shows that

    • gcc6.3.1 -O2 -Wall just uses uninitialized "theme" value
    • On the other hand, clang-3.8.1 -O2 -Wall warns this, and after that clang optimizes out uninitialized "theme" and "both", and assume that "both" is always 0.

    Anyway the code needs fixing.

     
  • Lonely Stranger

    Lonely Stranger - 2017-03-18
    • labels: --> lxappearance
    • Group: -->
     
  • Mamoru TASAKA

    Mamoru TASAKA - 2021-03-21

    Actually this causes lxappeance segfault when trying to remove icon theme. Forwarded: https://github.com/lxde/lxappearance/pull/4

     

Log in to post a comment.

MongoDB Logo MongoDB