[LLVMdev] clang promoting local to global

Richard Smith richard at metafoo.co.uk
Wed Aug 15 17:32:56 PDT 2012


On Wed, Aug 15, 2012 at 4:20 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:

> On Wed, Aug 15, 2012 at 4:10 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>
>> On Wed, Aug 15, 2012 at 3:17 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
>> > So there are some #define (defined outside the function scope) that use
>> > it_tab that are used inside the function, is this why it is promoting
>> it to
>> > a global?
>>
>> Macros shouldn't matter. Please give a complete testcase and steps to
>> reproduce.  And please don't top-post.
>>
>> #define other_def(x, tab, vf, rf, c)     (x ^ tab[0][x ^ c0 ^ vf ^ rf ^ c)
> #define my_def(y,x,k,c)      defs(y,c) = (k}[c] ^ other_def(x, it_tab,
> inv_var, rf1, c)
> void my_func() {
>
>      #define r10(p,q,r,s) 0x##s##r##q##p
>    #undef r
>    #define r r10
>     const word it_tab[4][256] = { r(const, const, const, const),
> r(.......), r(.......) ....... };
> }
>

That's not a complete testcase; it isn't valid C. Also, please give steps
to reproduce the problem (what commands you ran) and tell us what output
you got.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120815/5d08f68a/attachment.html>


More information about the llvm-dev mailing list