“Unexpected address space” compilation error while using shared memory in PTX

I have written a trivial kernel in which I declare my shared memory array as

extern shared float As[100];

In my kernel launch I specify the number_of_bytes of shared memory. I get the error “Unexpected address space” while compiling the kernel(to PTX). I am using fairly new version of LLVM from svn(3.3 in progress). Any ideas what I am doing wrong here ? the problem seems to be with extern keyword, but then how else am I gonna specify it?(Shared memory). Should I use a different LLVM build?

Config CUDA 5.0 , Nvidia Tesla C1060

If you know how many elements your shared memory array has (e.g. 100 elements), you should not use the extern keyword, and you don’t have to specify the number of bytes of shared memory in the kernel launch (the compiler can figure it out by himself). Only if you don’t know how many elements you will need, you have to specify this in the kernel launch, and in your kernel you have to write “extern shared float *As”.

Got it. Thanks a lot. You rock Gert-Jan (as always) :)