http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40752

--- Comment #25 from Chengnian Sun <chengniansun at gmail dot com> ---
Today I encountered a similar case as follows. The conversion warning by gcc is
not true as right-shifting an unsigned short decreases the value. 

BTW clang does not emit warnings for this code snippet. 


$: cat s1.c
unsigned short fn(unsigned short a, int right) {
  return a >> right;
}
$: gcc-trunk -c -Wconversion s1.c
s1.c: In function ‘fn’:
s1.c:2:3: warning: conversion to ‘short unsigned int’ from ‘int’ may alter its
value [-Wconversion]
   return a >> right;
   ^
$: clang-trunk -c -Wconversion s1.c
$:

Reply via email to