]> git.pld-linux.org Git - packages/gcc.git/blame - gcc-pr26565.patch
- fix detection of overflow from multiply expressions.
[packages/gcc.git] / gcc-pr26565.patch
CommitLineData
dae63ac8
PS
1--- gcc/gcc/builtins.c (revision 113409)
2+++ gcc/gcc/builtins.c (revision 113410)
3@@ -275,14 +275,28 @@
4 case ADDR_EXPR:
5 /* See what we are pointing at and look at its alignment. */
6 exp = TREE_OPERAND (exp, 0);
7+ inner = max_align;
8+ while (handled_component_p (exp))
9+ {
10+ /* Fields in a structure can be packed, honour DECL_ALIGN
11+ of the FIELD_DECL. For all other references the conservative
12+ alignment is the element type alignment. */
13+ if (TREE_CODE (exp) == COMPONENT_REF)
14+ inner = MIN (inner, DECL_ALIGN (TREE_OPERAND (exp, 1)));
15+ else
16+ inner = MIN (inner, TYPE_ALIGN (TREE_TYPE (exp)));
17+ exp = TREE_OPERAND (exp, 0);
18+ }
19 if (TREE_CODE (exp) == FUNCTION_DECL)
20 align = FUNCTION_BOUNDARY;
21 else if (DECL_P (exp))
22- align = DECL_ALIGN (exp);
23+ align = MIN (inner, DECL_ALIGN (exp));
24 #ifdef CONSTANT_ALIGNMENT
25 else if (CONSTANT_CLASS_P (exp))
26- align = CONSTANT_ALIGNMENT (exp, align);
27+ align = MIN (inner, (unsigned)CONSTANT_ALIGNMENT (exp, align));
28 #endif
29+ else
30+ align = MIN (align, inner);
31 return MIN (align, max_align);
32
33 default:
This page took 0.321831 seconds and 4 git commands to generate.