Allocators return pointer to void internally so the derived alignment is the
minimal one for known_alignment, although we know that it's always larger.
Tested on x86_64-suse-linux, applied on the mainline.
2016-06-13 Eric Botcazou <ebotca...@adacore.com>
* gcc-interface/utils2.c (known_alignment) <CALL_EXPR>: Deal specially
with calls to malloc.
--
Eric Botcazou
Index: gcc-interface/utils2.c
===================================================================
--- gcc-interface/utils2.c (revision 237323)
+++ gcc-interface/utils2.c (working copy)
@@ -171,6 +171,10 @@ known_alignment (tree exp)
case CALL_EXPR:
{
+ tree func = get_callee_fndecl (exp);
+ if (func && DECL_IS_MALLOC (func))
+ return get_target_system_allocator_alignment () * BITS_PER_UNIT;
+
tree t = maybe_inline_call_in_expr (exp);
if (t)
return known_alignment (t);