[llvm-bugs] [Bug 8718] No warning on casting between pointer and non-pointer-sized int

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 5 22:36:10 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=8718

Mark de Wever <koraq at xs4all.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |koraq at xs4all.nl
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from Mark de Wever <koraq at xs4all.nl> ---
I just tested with a recent master and the original test gives:
/tmp/int-ptr-cast-size-mismatch.c:23:10: warning: cast to 'void *' from smaller
integer type 'short' [-Wint-to-void-pointer-cast]
  return (void *)s;

Arnd's code gives
bug.cc:1275:12: error: cast from pointer to smaller type 'int' loses
information
          switch ((int)&a) {}
                  ^~~~~~~
bug.cc:1276:13: error: cast from pointer to smaller type 'int' loses
information
            return (int)&a;
                   ^~~~~~~

-- 
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/20191206/44429a2f/attachment-0001.html>


More information about the llvm-bugs mailing list