Why is GCC 4.8.2 complaining about addition under strict overflow?

后端 未结 2 653
温柔的废话
温柔的废话 2020-12-11 17:00

Consider this code (bits.c):

#include 
#include 
#include 

static uint64_t pick_bits(unsigned          


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-11 17:07

    My assumption is that gcc is inlining pick_bits and thus compiling with the knowledge that hi == lo+3 which allows it to assume that hi >= lo is always true as long as lo is low enough that lo+3 doesn't overflow.

提交回复
热议问题