[LLVMbugs] [Bug 6574] New: clang silently ignore __attribute__((mode(QI)))

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 10 10:37:27 PST 2010


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

           Summary: clang silently ignore __attribute__((mode(QI)))
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: quickslyver at free.fr
                CC: llvmbugs at cs.uiuc.edu


This attribute say that the integer is 8bits length.

from gcc torture test:

/* { dg-do run } */

extern void abort (void);
extern void exit (int);

#define small   __attribute__((mode(QI))) int
int main()
{
  int x, y = 0x400;

  x = (small) y;                                /* { dg-bogus "ignored" } */
  if (sizeof (small) != sizeof (char))          /* { dg-bogus "ignored" } */
    abort ();
  if (sizeof (x) != sizeof (char) && x == y)
    abort ();
  return 0;
}

generated llvm code without any warning:

$clang tests/run/gcc.dg/20011214-1.c -Wall -c -emit-llvm -o - -O0 | llvm-dis
; ModuleID = '<stdin>'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
target triple = "i386-pc-linux-gnu"

define i32 @main() nounwind {
entry:
  %retval = alloca i32, align 4                   ; <i32*> [#uses=2]
  %x = alloca i32, align 4                        ; <i32*> [#uses=1]
  %y = alloca i32, align 4                        ; <i32*> [#uses=2]
  store i32 0, i32* %retval
  store i32 1024, i32* %y
  %tmp = load i32* %y                             ; <i32> [#uses=1]
  store i32 %tmp, i32* %x
  call void @abort() noreturn
  unreachable

return:                                           ; No predecessors!
  %0 = load i32* %retval                          ; <i32> [#uses=1]
  ret i32 %0
}

declare void @abort() noreturn

As we can obviously see: the attribute is ignored

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list