Menu

#286 Compilation error: left shift of negative value

None
closed
nobody
None
5
2017-07-24
2016-07-22
Sven Hesse
No

oprofile (git repo checkout from today, HEAD is 3a5515f85ea2e007343c225e78cba66dde133327) fails to compile with GCC 6.1 (gcc (Debian 6.1.1-7) 6.1.1 20160620, to be specific).

The error is:
op_alloc_counter.c: In function ‘map_event_to_counter’:
op_alloc_counter.c:174:31: error: left shift of negative value [-Werror=shift-negative-value]
unavailable_counters = (~0) << nr_counters;

In file libop/op_alloc_counter.c

Replacing ~0 by ~0U should do the trick, I think. With that change, oprofile compiles successfully.

Discussion

  • William Cohen

    William Cohen - 2016-07-25

    Thanks for the report. The fix has been pushed into the upstrem oprofile git repository.

     
  • William Cohen

    William Cohen - 2017-06-12
    • status: open --> open-fixed
    • Group: -->
     
  • William Cohen

    William Cohen - 2017-07-24
    • status: open-fixed --> closed
     
  • William Cohen

    William Cohen - 2017-07-24

    Fixed in oprofile-1.2.0

     

Log in to post a comment.