[LLVMbugs] [Bug 2657] New: Error when accessing vector component from member variable.

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Aug 9 23:03:34 PDT 2008


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

           Summary: Error when accessing vector component from member
                    variable.
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: syoyofujita at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=1909)
 --> (http://llvm.org/bugs/attachment.cgi?id=1909)
A patch to fix this bug.

clang reports error when accessing vector component from member variable of a
struct.
Here's the code to reproduce the problem.

/* vector_in_struct.c */
typedef float float4 __attribute__((ext_vector_type(4)));

typedef struct _foo {
    float4 v;
} foo;

void
test()
{
    foo m;

    float f0 = m.v.x;
    float f1 = (m.v).x;
}

$ clang vector_in_struct.c

vector_in_strcut.c:12:20: error: vector component access limited to variables
    float f0 = m.v.x;
               ~~~ ^
vector_in_strcut.c:13:22: error: vector component access limited to variables
    float f1 = (m.v).x;
               ~~~~~ ^
2 diagnostics generated.

(clang revision: 54607)

--

I think it'd better to allow above vector expression so that programmers can
operate vector expression conveniently in clang.
Attached is a quick patch to fix this problem.


-- 
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