re PR c/53937 (Pack'ing struct causes gcc to not recognize that an field's address is aligned)

2012-07-13  Richard Guenther  <rguenther@suse.de>

	PR middle-end/53937
	* builtins.c (get_pointer_alignment_1): Handle constant
	pointers.

From-SVN: r189458
This commit is contained in:
Richard Guenther 2012-07-13 09:45:00 +00:00 committed by Richard Biener
parent 57cee56a1e
commit 44fabee4e2
2 changed files with 13 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2012-07-13 Richard Guenther <rguenther@suse.de>
PR middle-end/53937
* builtins.c (get_pointer_alignment_1): Handle constant
pointers.
2012-07-13 Richard Sandiford <rdsandiford@googlemail.com>
Steven Bosscher <steven@gcc.gnu.org>
Bernd Schmidt <bernds@codesourcery.com>

View file

@ -536,6 +536,13 @@ get_pointer_alignment_1 (tree exp, unsigned int *alignp,
return false;
}
}
else if (TREE_CODE (exp) == INTEGER_CST)
{
*alignp = BIGGEST_ALIGNMENT;
*bitposp = ((TREE_INT_CST_LOW (exp) * BITS_PER_UNIT)
& (BIGGEST_ALIGNMENT - 1));
return true;
}
*bitposp = 0;
*alignp = BITS_PER_UNIT;