Fix PR c/55570.

From-SVN: r194084
This commit is contained in:
Marek Polacek 2012-12-03 13:10:18 +00:00 committed by Marek Polacek
parent 01f849caa1
commit 9c84866a16
4 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2012-12-03 Marek Polacek <polacek@redhat.com>
Backported from mainline
2012-12-03 Marek Polacek <polacek@redhat.com>
PR c/55570
* c-common.c (check_user_alignment): Swap order of tests,
check TREE_CODE first.
2012-09-20 Release Manager
* GCC 4.7.2 released.

View File

@ -6741,8 +6741,8 @@ check_user_alignment (const_tree align, bool allow_zero)
{
int i;
if (!INTEGRAL_TYPE_P (TREE_TYPE (align))
|| TREE_CODE (align) != INTEGER_CST)
if (TREE_CODE (align) != INTEGER_CST
|| !INTEGRAL_TYPE_P (TREE_TYPE (align)))
{
error ("requested alignment is not an integer constant");
return -1;

View File

@ -1,3 +1,11 @@
2012-12-03 Marek Polacek <polacek@redhat.com>
Backported from mainline
2012-12-03 Marek Polacek <polacek@redhat.com>
PR c/55570
* gcc.dg/pr55570.c: New test.
2012-12-01 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* gcc.dg/torture/pr54920.c: Add "-fno-common" option on hppa*-*-hpux*.

View File

@ -0,0 +1,4 @@
/* PR c/55570 */
/* { dg-do compile } */
char array[16] __attribute__((aligned (SOME_NOT_DEFINED_MACRO))); /* { dg-error "requested alignment is not an integer constant" } */