[PATCH] ipa struct reorg: Fix wrong result type of generated mallocs

Andreas Krebbel Andreas.Krebbel@de.ibm.com
Wed Jan 23 17:41:00 GMT 2008


Hello,

the ipa struct reorg pass currently generates malloc calls with int as
result type breaking 64bit targets.

The ipa testcases on x86_64 didn't show any problems since the
returned addresses all lie below 2G.

Bootstrapped on x86_64, s390 and s390x.
No testsuite regressions on s390 and s390x.

On s390x the following testcases are fixed with the patch:

< FAIL: gcc.dg/struct/wo_prof_global_var.c execution test
< FAIL: gcc.dg/struct/wo_prof_local_var.c execution test
< FAIL: gcc.dg/struct/wo_prof_mult_field_peeling.c execution test
< FAIL: gcc.dg/struct/wo_prof_two_strs.c execution test
< FAIL: gcc.dg/struct/w_prof_global_var.c execution,    -O3 -fwhole-program -combine -fipa-type-escape -fprofile-use -fipa-struct-reorg -fdump-ipa-all
< FAIL: gcc.dg/struct/w_prof_local_var.c execution,    -O3 -fwhole-program -combine -fipa-type-escape -fprofile-use -fipa-struct-reorg -fdump-ipa-all
< FAIL: gcc.dg/struct/w_prof_two_strs.c execution,    -O3 -fwhole-program -combine -fipa-type-escape -fprofile-use -fipa-struct-reorg -fdump-ipa-all

Unfortunately with the patch I see a new failure on x86_64.  The
wo_prof_malloc_size_var testcases ICEes in safe_cond_expr_check.  But
since I'm able to provoke this failure also without my patch I don't
think it is related to this trivial change.  It seems to be the
problem from PR34472 which is triggered accidently by this patch as
well.

Ok for mainline?

Bye,

-Andreas-


2008-01-23  Andreas Krebbel  <krebbel1@de.ibm.com>

	* ipa-struct-reorg.c (create_new_malloc): Use pointer type as
	malloc result type.


Index: gcc/ipa-struct-reorg.c
===================================================================
*** gcc/ipa-struct-reorg.c.orig	2008-01-22 17:19:06.000000000 +0100
--- gcc/ipa-struct-reorg.c	2008-01-22 17:19:30.000000000 +0100
*************** create_new_malloc (tree malloc_stmt, tre
*** 1730,1736 ****
    append_to_statement_list (new_stmt, new_stmts);
  
    /* Generate new call for malloc.  */
!   malloc_res = create_tmp_var (integer_type_node, NULL);
  
    if (malloc_res)
      add_referenced_var (malloc_res);
--- 1730,1736 ----
    append_to_statement_list (new_stmt, new_stmts);
  
    /* Generate new call for malloc.  */
!   malloc_res = create_tmp_var (ptr_type_node, NULL);
  
    if (malloc_res)
      add_referenced_var (malloc_res);



More information about the Gcc-patches mailing list