This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Don't reject valid code with _Alignas (PR c/61053)
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 2 Sep 2014 15:39:10 -0700
- Subject: Re: [C PATCH] Don't reject valid code with _Alignas (PR c/61053)
- Authentication-results: sourceware.org; auth=none
- References: <20140505202703 dot GR11802 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1405071714390 dot 29322 at digraph dot polyomino dot org dot uk> <CAMe9rOpr5yPfP_hqEvBtOo+GdbWLvgkbW4wx3oum2G72m8L81w at mail dot gmail dot com> <20140508181934 dot GD11802 at redhat dot com> <CAMe9rOqjbdkt4JjWOx8OXdkx6mrDnAgWWYoBsL7mo3QXS30nUw at mail dot gmail dot com>
On Tue, Sep 2, 2014 at 3:29 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, May 8, 2014 at 11:19 AM, Marek Polacek <polacek@redhat.com> wrote:
>> On Wed, May 07, 2014 at 11:31:38AM -0700, H.J. Lu wrote:
>>> > OK, though I'm not sure if the "lp64" conditions are right in the testcase
>>>
>>> It should be !ia32 instead of lp64.
>>
>> Ok, I changed lp64 to ! { ia32 } and committed the patch now.
>>
>> Marek
>
> The change is insufficient for x32, which has the same alignments
> for floating point types and the integer types with the same size as
> x86-64. This patch is needed for x32. OK for trunk and 4.8 branch?
>
>
> --
> H.J.
> ---
> 2014-09-02 H.J. Lu <hongjiu.lu@intel.com>
>
> * gcc.dg/pr61053.c: Updated for x32.
>
Here is the patch as an attachment.
--
H.J.
2014-09-02 H.J. Lu <hongjiu.lu@intel.com>
* gcc.dg/pr61053.c: Updated for x32.
diff --git a/gcc/testsuite/gcc.dg/pr61053.c b/gcc/testsuite/gcc.dg/pr61053.c
index 4fd5319..5557784 100644
--- a/gcc/testsuite/gcc.dg/pr61053.c
+++ b/gcc/testsuite/gcc.dg/pr61053.c
@@ -31,17 +31,17 @@ _Alignas (long double) int ild;
_Alignas (char) long int lic; /* { dg-error "cannot reduce alignment" } */
_Alignas (short int) long int lis; /* { dg-error "cannot reduce alignment" } */
-_Alignas (int) long int lii; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */
+_Alignas (int) long int lii; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 || x32 } } } } */
_Alignas (long int) long int lil;
_Alignas (long long int) long int lill;
-_Alignas (float) long int lif; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */
+_Alignas (float) long int lif; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 || x32 } } } } */
_Alignas (double) long int lid;
_Alignas (long double) long int lild;
_Alignas (char) long long int llic; /* { dg-error "cannot reduce alignment" } */
_Alignas (short int) long long int llis; /* { dg-error "cannot reduce alignment" } */
_Alignas (int) long long int llii; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */
-_Alignas (long int) long long int llil;
+_Alignas (long int) long long int llil; /* { dg-error "cannot reduce alignment" "" { target { x32 } } } */
_Alignas (long long int) long long int llill;
_Alignas (float) long long int llif; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */
_Alignas (double) long long int llid;
@@ -59,7 +59,7 @@ _Alignas (long double) float fld;
_Alignas (char) double dc; /* { dg-error "cannot reduce alignment" } */
_Alignas (short int) double ds; /* { dg-error "cannot reduce alignment" } */
_Alignas (int) double di; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */
-_Alignas (long int) double dl;
+_Alignas (long int) double dl; /* { dg-error "cannot reduce alignment" "" { target { x32 } } } */
_Alignas (long long int) double dll;
_Alignas (float) double df; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */
_Alignas (double) double dd;