This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
optimization bug on platform with BITS_PER_WORD>8
- From: Andrea Michelotti <amichelo at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 5 Apr 2005 09:19:30 +0200
- Subject: optimization bug on platform with BITS_PER_WORD>8
- Reply-to: Andrea Michelotti <amichelo at gmail dot com>
Hi all,
in my trials to see how gcc behaves on architectures not byte
addressable. I think I found another point that generate problems on
platform not byte addressable like c4x (see also my notes on
fractional int modes).
The problem is located in the function add_standard_iv_candidates (in
tree-ssa-loop-ivopts.c), that create trees of types typically not
handled on not byte addressable architectures.
Problem:
if you try to compile this simple c:
void prova_for(int*res){
int cnt,a=0;
for(cnt=0;cnt<10;cnt++)
res[cnt]=cnt;
}
with optimizations turned on (-O), c4x gcc cross compiler generates
the following right error:
prova_for.c:1: internal compiler error: in integer_all_onesp, at tree.c:1026.
Because a SImode of 96 bits is generated... obviously not handled by c4x.
The patch sent is very simple and maybe does not expect of being the
final solution but can be used to highlight and discuss the problem
for "not usual architectures".
best regards
Andrea
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.55
diff -c -3 -p -r2.55 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c 3 Apr 2005 10:27:51 -0000 2.55
--- tree-ssa-loop-ivopts.c 5 Apr 2005 06:51:15 -0000
*************** static void
*** 1986,1991 ****
--- 1986,1995 ----
add_standard_iv_candidates (struct ivopts_data *data)
{
/* Add 0 + 1 * iteration candidate. */
+
+ // this code will work only for 8 bit based processors
+ #if defined BITS_PER_WORD == 8
+
add_candidate (data,
build_int_cst (unsigned_intSI_type_node, 0),
build_int_cst (unsigned_intSI_type_node, 1),
*************** add_standard_iv_candidates (struct ivopt
*** 1997,2002 ****
--- 2001,2007 ----
build_int_cst (unsigned_intDI_type_node, 0),
build_int_cst (unsigned_intDI_type_node, 1),
true, NULL);
+ #endif
}