[LLVMbugs] [Bug 21924] New: Vector types do not emit size when it differs from calculable size

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 15 19:00:35 PST 2014


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

            Bug ID: 21924
           Summary: Vector types do not emit size when it differs from
                    calculable size
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: douglas_yung at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang allows you to create a vector using gcc's vector_size attribute. However,
if the vector's size is not equal to a power of two, it looks to be rounded up
to the nearest one.

For example, consider the following code:

=====
#include <stdio.h>

typedef float vec6f __attributes__((__vector_size__(24)));

int main(int argc, char *argv[]) {
  vec6f v01[2] = {{1.0f,2.0f,3.0f,4.0f,5.0f,6.0f},
{7.0f,8.0f,9.0f,10.0f,11.0f,12.0f}};

  printf("sizeof(vec6f) = %lu\n", sizeof(vec6f));
  printf("sizeof(v01) = %lu\n", sizeof(v01));

  return 0;
=====

If you compile that with -O0 -g and then run the resulting binary through a
debugger (say gdb), you get interesting output.

The program when run will print the following:

sizeof(vec6f) = 32
sizeof(v01) = 64

However, if evaluate the same expressions in the debugger, you will get the
following:

(gdb) p sizeof(vec6f)
$1 = 24
(gdb) p sizeof(v01)
$2 = 48

Additionally, if you ask the debugger to print out v01, this is what you get:

(gdb) p v01
$3 = {{1, 2, 3, 4, 5, 6}, {0, 0, 7, 8, 9, 10}}

It has been suggested that this could be fixed if the compiler emitted either a
DW_AT_byte_size or DW_AT_byte_stride attribute.

-- 
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/20141216/b46412ad/attachment.html>


More information about the llvm-bugs mailing list