[llvm-bugs] [Bug 35703] New: Different types share the same TBAA descriptor

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 20 03:26:34 PST 2017


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

            Bug ID: 35703
           Summary: Different types share the same TBAA descriptor
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sepavloff at gmail.com
                CC: llvm-bugs at lists.llvm.org

Run commands:

$ cat bug-02.c 
typedef struct {
   short f16;
   int f32;
} ABC;
typedef struct {
   short v16;
   int v32;
} CDE;

void func(ABC *A, CDE *B) {
  A->f32 = 4;
  B->v32 = 44;
}

$ clang -S -emit-llvm -O1 bug-02.c

The resulting .ll file contains:

%struct.ABC = type { i16, i32 }
%struct.CDE = type { i16, i32 }

; Function Attrs: norecurse nounwind uwtable
define void @func(%struct.ABC* nocapture %A, %struct.CDE* nocapture %B)
local_unnamed_addr #0 {
entry:
  %f32 = getelementptr inbounds %struct.ABC, %struct.ABC* %A, i64 0, i32 1
  store i32 4, i32* %f32, align 4, !tbaa !2
  %v32 = getelementptr inbounds %struct.CDE, %struct.CDE* %B, i64 0, i32 1
  store i32 44, i32* %v32, align 4, !tbaa !2
  ret void
}
...
!2 = !{!3, !7, i64 4}
!3 = !{!"", !4, i64 0, !7, i64 4}
!4 = !{!"short", !5, i64 0}
!5 = !{!"omnipotent char", !6, i64 0}
!6 = !{!"Simple C/C++ TBAA"}
!7 = !{!"int", !5, i64 0}

Two different types use the same descriptor (!3). In C++ mode there is no such
problem, types get their names from typedef names.

-- 
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/20171220/5683c128/attachment.html>


More information about the llvm-bugs mailing list