aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-07-13 09:45:00 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-07-13 09:45:00 +0000
commit44fabee4e252d91ea09daf23f7dd1cce3f63abea (patch)
treecb3d66ebbf28ef10a1d738a2fabefc36d0431206 /gcc/builtins.c
parent57cee56a1efe681eac1a5c427f4ffe1c6f4f77cd (diff)
downloadgcc-44fabee4e252d91ea09daf23f7dd1cce3f63abea.zip
gcc-44fabee4e252d91ea09daf23f7dd1cce3f63abea.tar.gz
gcc-44fabee4e252d91ea09daf23f7dd1cce3f63abea.tar.bz2
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
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index c12eb29..040f352 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -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;