summaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.c')
-rw-r--r--gcc/ada/gcc-interface/utils2.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index aeb6cc3a3f7..638d59b6f9c 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -171,8 +171,8 @@ known_alignment (tree exp)
case CALL_EXPR:
{
- tree func = get_callee_fndecl (exp);
- if (func && DECL_IS_MALLOC (func))
+ tree fndecl = get_callee_fndecl (exp);
+ if (fndecl == malloc_decl || fndecl == realloc_decl)
return get_target_system_allocator_alignment () * BITS_PER_UNIT;
tree t = maybe_inline_call_in_expr (exp);
@@ -188,7 +188,8 @@ known_alignment (tree exp)
have a dummy type here (e.g. a Taft Amendment type), for which the
alignment is meaningless and should be ignored. */
if (POINTER_TYPE_P (TREE_TYPE (exp))
- && !TYPE_IS_DUMMY_P (TREE_TYPE (TREE_TYPE (exp))))
+ && !TYPE_IS_DUMMY_P (TREE_TYPE (TREE_TYPE (exp)))
+ && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (exp))))
this_alignment = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)));
else
this_alignment = 0;