[Bug c/64619] New: No -Wsign-conversion warning

chengniansun at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 16 00:41:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64619

            Bug ID: 64619
           Summary: No -Wsign-conversion warning
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

I think "a" should be converted to unsigned long, so there is a signedness
change in this expression. 

$: cat s.c
int a;
void fn() /*    */
{
  a ^ 0x1UL;
}
$: 
$: gcc-trunk -Wsign-conversion s.c -c
$: 
$: clang-trunk -Wno-unused-value -Wsign-conversion s.c -c
s.c:4:3: warning: implicit conversion changes signedness: 'int' to
      'unsigned long' [-Wsign-conversion]
  a ^ 0x1UL;
  ^ ~
1 warning generated.
$: 
$:



More information about the Gcc-bugs mailing list