On 04/05/2016 03:43 AM, Dominik Vogt wrote:
On Mon, Jan 04, 2016 at 12:33:21PM +0100, Dominik Vogt wrote:
On Fri, Jan 01, 2016 at 05:53:08PM -0700, Martin Sebor wrote:
On 12/31/2015 04:50 AM, Dominik Vogt wrote:
The attached patch fixes C++-11 handling of "alignas(0)" which
should be ignored but currently generates an error message.  A
test case is included; the patch has been tested on S390x.  Since
it's a language issue it should be independent of the backend
used.

The patch doesn't handle value-dependent expressions(*).

It
seems that the problem is in handle_aligned_attribute() calling
check_user_alignment() with the second argument (ALLOW_ZERO)
set to false.  Calling it with true fixes the problem and handles
value-dependent expressions (I haven't done any more testing beyond
that).

Like the attached patch?  (Passes the testsuite on s390x.)

But wouldn't an "aligned" attribute be added, allowing the backend
to possibly generate an error or a warning?

Also, in the test, I noticed the definition of the first struct
is missing the terminating semicolon.

Yeah.

gcc/c-family/ChangeLog

        PR/69089
        * c-common.c (handle_aligned_attribute): Allow 0 as an argument to the
        "aligned" attribute.

gcc/testsuite/ChangeLog

        PR/69089
        * g++.dg/cpp0x/alignas5.C: New test.
OK for the trunk.
jeff

Reply via email to