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

--- Comment #1 from Chengnian Sun <chengniansun at gmail dot com> ---
I think the following case is similar to the reported case. The only difference
is the message content. The following case also triggers "gcc -O0" to emit two
duplicate warnings. But "gcc -O1" emits only one warning.

$: cat s.c
extern short fn2(short, short);
unsigned long g;
void fn1() {
  int const l = 0;
  fn2(((g = l != 0) < 10LL) | 91608LL, 0);
}
$: gcc-trunk -c -Wconversion -std=c99 s.c
s.c: In function ‘fn1’:
s.c:5:7: warning: conversion to ‘short int’ alters ‘long long int’ constant
value [-Wconversion]
   fn2(((g = l != 0) < 10LL) | 91608LL, 0);
       ^
s.c:5:7: warning: conversion to ‘short int’ alters ‘long long int’ constant
value [-Wconversion]
$: gcc-trunk -c -Wconversion -std=c99 s.c -O1
s.c: In function ‘fn1’:
s.c:5:7: warning: conversion to ‘short int’ from ‘long long int’ may alter its
value [-Wconversion]
   fn2(((g = l != 0) < 10LL) | 91608LL, 0);
       ^
$:

Reply via email to