[cfe-dev] wrong clang warning about negative shift count

Matthias Drochner M.Drochner at fz-juelich.de
Tue Sep 15 03:20:51 PDT 2009


Hi -
this warning looks wrong:
$ cat badwarn.c
#define X(a) ((a) > 7 && (a) < 16 ? (1 << ((a) - 8)) : 0)
int a = X(5);
$ clang -c badwarn.c
badwarn.c:2:9: warning: shift count is negative
int a = X(5);
        ^~~~
badwarn.c:1:40: note: instantiated from:
#define X(a) ((a) > 7 && (a) < 16 ? (1 << ((a) - 8)) : 0)
                                       ^  ~~~~~~~~~
1 diagnostic generated.


This is with recent SVN:
$ clang -v
clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk 81778)
Target: i386--netbsdelf
Thread model: posix


best regards
Matthias



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------




More information about the cfe-dev mailing list