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

Chengnian Sun <chengniansun at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Spurious warning on         |Spurious warning on
                   |converting const int        |converting const int
                   |variable to unsigned long   |variable to unsigned long
                   |                            |(Also inconsistency between
                   |                            |O0 and O1)

--- Comment #1 from Chengnian Sun <chengniansun at gmail dot com> ---
The warning is gone if I compile the program with -O1. 

I also have a similar example below:

$: cat s.c
unsigned g;
void fn1() {
  int a;
  const unsigned char b = 0;
  a = b & g;
}
$: gcc-trunk -c -Wconversion -O0 s.c
s.c: In function ‘fn1’:
s.c:5:7: warning: conversion to ‘int’ from ‘unsigned int’ may change the sign
of the result [-Wsign-conversion]
   a = b & g;
       ^
$: gcc-trunk -c -Wconversion -O1 s.c
$:

Reply via email to