[llvm-bugs] [Bug 31530] New: UINT16_TYPE and INT16_TYPE are defined as short instead of int for AVR

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 4 01:35:33 PST 2017


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

            Bug ID: 31530
           Summary: UINT16_TYPE and INT16_TYPE are defined as short
                    instead of int for AVR
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dylanmckay34 at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

UINT16_TYPE and INT16_TYPE are implicitly defined by the preprocessor
   to the short type, rather than int. While shorts and ints are both
   16 bits wide on the avr, gcc picks ints to represent 16 bits wherever
   possible, and picking short can cause issues with C++ name mangling
   (see https://reviews.llvm.org/D27123#615854). Therefore, clang should
   define the two types to short.

   Clang's lib/Frontend/InitPreprocessor.cpp::DefineExactWidthIntType does not
   use TargetInfo::getIntTypeByWidth. Instead,
   InitializePredefinedMacros calls
   the function with the specific type (SignedShort/UnsignedShort), because
   getShortWidth() > getCharWidth(), but getIntWidth() ==
   getShortWidth().

-- 
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/20170104/31ac6b13/attachment.html>


More information about the llvm-bugs mailing list