Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__attribute__((vector_size)) and templates #16102

Open
ktf mannequin opened this issue Apr 12, 2013 · 8 comments
Open

__attribute__((vector_size)) and templates #16102

ktf mannequin opened this issue Apr 12, 2013 · 8 comments
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party enhancement Improving things as opposed to bug fixing, e.g. new or missing feature

Comments

@ktf
Copy link
Mannequin

ktf mannequin commented Apr 12, 2013

Bugzilla Link 15730
Version trunk
OS Linux
CC @marehr,@pkeir

Extended Description

Hi,

the following bit of code:

template <int N, typename T> struct Foo
{
typedef T attribute((vector_size(N*sizeof(T)))) type;
};

compiles fine with gcc 4.7.2, however when compiled with clang 3.2 I get:

foo.cc:4:41: error: expected ')'
typedef T attribute((vector_size(Nsizeof(T)))) type;
^
)
foo.cc:4:41: error: expected ')'
typedef T attribute((vector_size(N
sizeof(T)))) type;
^
)
foo.cc:4:53: error: expected member name or ';' after declaration specifiers
typedef T attribute((vector_size(N*sizeof(T)))) type;


Moreover even doing:

template <int N, typename T> struct Foo
{
typedef T __attribute__((vector_size(16))) type;
};

does not work and gives:

foo.cc:4:28: error: invalid vector element type 'T'
typedef T __attribute__((vector_size(16))) type;
                         ^

The only way to get it to work is to eliminate the dependency on the T template argument:

template <int N, typename T> struct Foo
{
typedef int __attribute__((vector_size(16))) type;
};

compiles fine on both clang 3.2 and gcc 4.7.2

Any idea?

Ciao,
Giulio
@pkeir
Copy link
Mannequin

pkeir mannequin commented Jun 14, 2014

I see this too under Ubuntu 14.04 with clang version 3.5.0 (trunk 210014).

@llvmbot
Copy link
Collaborator

llvmbot commented May 26, 2015

I'm gonna handle this one by changing vector_size attribute to have an AST node (as aligned and align_value attributes do, for example).

Alexey Frolov

Software Engineer
Intel Compiler Team
Intel

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 5, 2020

Is anyone assigned to this issue?
It seems like Alexey Frolov is not working for Intel anymore, and the most recent activity was a discussion on how to resolve the issue http://lists.llvm.org/pipermail/cfe-dev/2015-June/043653.html

I'm pretty sure llvm/llvm-bugzilla-archive#34878 is a duplicate of this issue.

Best regards,
Lars Bonnichsen

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 5, 2020

llvm/llvm-bugzilla-archive#16986 looks like another duplicate, and it seems the issue was solved in clang 9, yay. /Lars

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 5, 2020

*** Bug llvm/llvm-bugzilla-archive#16986 has been marked as a duplicate of this bug. ***

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 5, 2020

*** Bug llvm/llvm-bugzilla-archive#34878 has been marked as a duplicate of this bug. ***

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#16986

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#34878

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 4, 2021
@llvmbot llvmbot added the confirmed Verified by a second party label Jan 26, 2022
@Endilll Endilll added enhancement Improving things as opposed to bug fixing, e.g. new or missing feature and removed new-feature labels Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party enhancement Improving things as opposed to bug fixing, e.g. new or missing feature
Projects
None yet
Development

No branches or pull requests

2 participants