[PATCH] Propagate alignment for _Complex

Eli Friedman eli.friedman at gmail.com
Mon Jul 15 11:42:39 PDT 2013


On Mon, Jul 15, 2013 at 9:09 AM, JF Bastien <jfb at google.com> wrote:
> I've attached an updated patch, and a test. I also updated other tests
> which had ``volatile _Complex``.
>
> Two questions:
>  - ``align 0`` means "suitably aligned", right? It seems to occur on
> stack values, I assume the value gets determined later.

"align 0" means there's code which hasn't been updated to correctly
set an alignment.  Unfortunately, the initial IRGen implementation
wasn't properly alignment-aware, and we're been paying the price ever
since.

>  - What should we do with less-than-naturally-aligned _Complex? It
> seems like we should warn instead of silently handling it, same with
> atomic. I could do that in a separate patch.

Our rule is generally that we propagate alignment for lvalue, but not
pointers.  This allows some convenient constructs like packed structs
to work as expected without requiring the impossible of the compiler.

-Eli



More information about the cfe-commits mailing list