This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR56434
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 22 Mar 2013 11:06:53 +0100 (CET)
- Subject: [PATCH] Fix PR56434
This fixes PR56434 - the use of BIGGEST_ALIGNMENT to annotate
the pointer returned by malloc is wrong - BIGGEST_ALIGNMENT
has nothing to do with the alignment guaranteed by the ABI
for allocated memory. For example on x86_64 it depends on
-mavx and thus can result in wrong code being generated.
The following patch fixes it to use what we use on the
GIMPLE level - MALLOC_ABI_ALIGNMENT.
Ok for trunk?
Thanks,
Richard.
2013-03-22 Richard Biener <rguenther@suse.de>
PR middle-end/56434
* calls.c (expand_call): Use MALLOC_ABI_ALIGNMENT to annotate
the pointer returned by calls with ECF_MALLOC set.
Index: gcc/calls.c
===================================================================
--- gcc/calls.c (revision 196899)
+++ gcc/calls.c (working copy)
@@ -3186,7 +3186,7 @@ expand_call (tree exp, rtx target, int i
/* The return value from a malloc-like function is a pointer. */
if (TREE_CODE (rettype) == POINTER_TYPE)
- mark_reg_pointer (temp, BIGGEST_ALIGNMENT);
+ mark_reg_pointer (temp, MALLOC_ABI_ALIGNMENT);
emit_move_insn (temp, valreg);