Hi Richard,
your guess is correct, it is applied to the outer pointer.

Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team

30.09.2014 4:50, Richard Smith пишет:
On Mon, Sep 29, 2014 at 11:36 AM, Hal Finkel <[email protected] <mailto:[email protected]>> wrote:

    Hi Richard,

    What does all of this suggest to you about the right design?


One more question. Given:

  typedef int * __attribute__((align_value(32))) *Y;

... does the attribute apply to the outer pointer or the inner pointer? (My guess: it surprisingly applies to the outer pointer.) If that's the case, then I think align_value should live entirely outside the type system, in the same way that __attribute__((aligned)) does. Note that, given:

  typedef int __attribute__((aligned(64))) *p __attribute__((aligned(8)))

p is a 64-byte-aligned pointer to int, not an 8-byte-aligned pointer to a 64-byte-aligned int.

If that's the case, I suggest you model it exactly like AlignedAttr -- as an attribute on the TypedefDecl -- and look for it explicitly in the cases where you want to use it by walking the type sugar and looking for a TypedefDecl.

    FWIW, maybe creating some kind of synthetic typedef type for the
    return value from DeduceTemplateArgumentsByTypeMatch would work?

    Thanks again,
    Hal

    ----- Original Message -----
    > From: "Alexey Bataev" <[email protected]
    <mailto:[email protected]>>
    > To: "Hal Finkel" <[email protected] <mailto:[email protected]>>,
    [email protected]
    <mailto:reviews%2bd4635%2bpublic%[email protected]>
    > Cc: [email protected] <mailto:[email protected]>,
    "aaron ballman" <[email protected]
    <mailto:[email protected]>>, [email protected]
    <mailto:[email protected]>, [email protected]
    <mailto:[email protected]>
    > Sent: Friday, September 26, 2014 12:26:29 AM
    > Subject: Re: [PATCH] align_value attribute in Clang
    >
    > 1. ICC does not create a new type for type with this attribute. All
    > types are still the same.
    > 2.
    >
    > int n __attribute__((aligned(32)));
    > decltype(&n) - int*.
    >
    >
    > Best regards,
    > Alexey Bataev
    > =============
    > Software Engineer
    > Intel Compiler Team
    >
    > 26.09.2014 4:28, Hal Finkel пишет:
    > > ----- Original Message -----
    > >> From: "Richard Smith" <[email protected]
    <mailto:[email protected]>>
    > >> To: [email protected] <mailto:[email protected]>, "aaron ballman"
    <[email protected] <mailto:[email protected]>>,
    > >> [email protected] <mailto:[email protected]>,
    [email protected] <mailto:[email protected]>, "a
    > >> bataev" <[email protected] <mailto:[email protected]>>
    > >> Cc: [email protected] <mailto:[email protected]>
    > >> Sent: Thursday, September 25, 2014 7:06:33 PM
    > >> Subject: Re: [PATCH] align_value attribute in Clang
    > >>
    > >> I'd like some more information about how ICC treats this
    > >> attribute.
    > >> Does it produce a new type? For instance:
    > > I did a quick experiment with icc (ICC) 14.0.1 20131008 (with
    -Wall
    > > -O3 -pedantic):
    > >
    > >>    typedef int *I32 __attribute__((align_value(32)));
    > >>    typedef int *I64 __attribute__((align_value(64)));
    > >>
    > >>    typedef I32 X; typedef I64 X; // ill-formed?
    > > No diagnostic.
    > >
    > >>    template<typename> struct Y;
    > >>    typedef Y<I32> Z; typedef Y<I64> Z; // ill-formed?
    > > No diagnostic.
    > >
    > >>    extern I32 i32;
    > >>    I64 i64 = i32; // ill-formed? Is an explicit cast required?
    > > No diagnostic.
    > >
    > >>    I32 i32 = i64; // ill-formed? Is there an implicit conversion
    > >>    that
    > >>    discards alignment?
    > > No diagnostic.
    > >
    > > Alexey, can you please comment on the specifics?
    > >
    > >   -Hal
    > >
    > >> ... and if there's an implicit conversion that discards
    alignment,
    > >> what is its conversion rank?
    > >>
    > >> If I have:
    > >>
    > >>    int n __attribute__((aligned(32)));
    > >>
    > >> ... then what is `decltype(&n)`? Is it `int*`, or `int*
    > >> __attribute__((align_value(32)))`?
    > >>
    > >> http://reviews.llvm.org/D4635
    > >>
    > >>
    > >>
    >
    >

    --
    Hal Finkel
    Assistant Computational Scientist
    Leadership Computing Facility
    Argonne National Laboratory




_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to