]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
utils2.c (known_alignment): Deal specially with calls to malloc.
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 13 Jun 2016 07:40:47 +0000 (07:40 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 13 Jun 2016 07:40:47 +0000 (07:40 +0000)
* gcc-interface/utils2.c (known_alignment) <CALL_EXPR>: Deal specially
with calls to malloc.

From-SVN: r237356

gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils2.c

index 6f2fda6004bfa58be5f45f6d32dff24d0198f927..41a6c619fe283b6585fb5d4d1480710584d4a519 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-13  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/utils2.c (known_alignment) <CALL_EXPR>: Deal specially
+       with calls to malloc.
+
 2016-06-11  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/trans.c (build_binary_op_trapv): If no operand is a
index a0804e8e86dfb7d0cc5c3d3ad656fa42085ca6ad..aeb6cc3a3f7384217911c21e6f70ad27bafe30bf 100644 (file)
@@ -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);