[llvm-bugs] [Bug 39210] New: [AVR] uint32_t is incorrectly compiled to i16

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 7 08:31:25 PDT 2018


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

            Bug ID: 39210
           Summary: [AVR] uint32_t is incorrectly compiled to i16
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Headers
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aykevanlaethem at gmail.com
                CC: llvm-bugs at lists.llvm.org

When compiling this function for avr:

    #include <stdint.h>

    uint32_t size32() {
        return 3;
    }

With the following options:
    clang-7 --target=avr-atmel-none -emit-llvm -S -o intsize.ll -c intsize.c

I get the following IR (cut down to the essential parts):

    target datalayout = "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8"
    target triple = "avr-atmel-none"

    ; Function Attrs: noinline nounwind optnone
    define dso_local i16 @size32() #0 {
      ret i16 3
    }

In other words, uint32_t is compiled to i16 instead of i32 as it should.

I hit this problem while trying to build compiler-rt for AVR and hitting lots
of "shift count >= width of type" warnings which are probably caused by this
problem.

I'm running Debian stable (stretch) with clang-7 from apt.llvm.org.

-- 
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/20181007/b406c1a8/attachment.html>


More information about the llvm-bugs mailing list