[LLVMbugs] [Bug 18562] New: Incorrect description of warning message for -Wconversion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 20 16:02:01 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18562

            Bug ID: 18562
           Summary: Incorrect description of warning message for
                    -Wconversion
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

For the assignment "int g = 0x828D9300L;", clang warns:
implicit conversion changes signedness: 'long' to 'int'

However, the conversion from signed long to signed int does not change the
signedness. The only changed part is the value. 

Please refer to the following steps for more details.




$: cat signedness-chang.c
int g = 0x828D9300L;
$: clang-trunk -Wconversion -c signedness-chang.c
signedness-chang.c:1:9: warning: implicit conversion changes signedness: 'long'
to 'int'
      [-Wsign-conversion]
int g = 0x828D9300L;
    ~   ^~~~~~~~~~~
1 warning generated.
$: clang-trunk --version
clang version 3.5 (trunk 199549)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$: gcc-trunk -Wconversion -c signedness-chang.c
signedness-chang.c:1:1: warning: conversion to ‘int’ alters ‘long int’ constant
value [-Wconversion]
 int g = 0x828D9300L;
 ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140121/811482a8/attachment.html>


More information about the llvm-bugs mailing list