This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][C] Fix PR39712
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 10 Apr 2009 11:39:25 +0200 (CEST)
- Subject: [PATCH][C] Fix PR39712
This fixes the wrong-types ICE in PR39712. My previous check wasn't
enough to catch multi-dimensional array address mismatches.
Fixed with the following, bootstrapped and tested on
x86_64-unknown-linux-gnu. Ok for trunk?
Thanks,
Richard.
2009-04-10 Richard Guenther <rguenther@suse.de>
PR c/39712
* c-gimplify.c (c_gimplify_expr): Adjust check for mismatched
address expressions.
* gcc.dg/pr39712.c: New testcase.
Index: gcc/c-gimplify.c
===================================================================
*** gcc/c-gimplify.c (revision 145876)
--- gcc/c-gimplify.c (working copy)
*************** c_gimplify_expr (tree *expr_p, gimple_se
*** 201,207 ****
ADDR_EXPR instead and wrap a conversion around it. */
if (code == ADDR_EXPR
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (*expr_p, 0))) == ARRAY_TYPE
! && TREE_CODE (TREE_TYPE (TREE_TYPE (*expr_p))) != ARRAY_TYPE)
{
tree type = TREE_TYPE (*expr_p);
TREE_TYPE (*expr_p)
--- 201,208 ----
ADDR_EXPR instead and wrap a conversion around it. */
if (code == ADDR_EXPR
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (*expr_p, 0))) == ARRAY_TYPE
! && !c_types_compatible_p (TREE_TYPE (TREE_TYPE (*expr_p)),
! TREE_TYPE (TREE_OPERAND (*expr_p, 0))))
{
tree type = TREE_TYPE (*expr_p);
TREE_TYPE (*expr_p)
Index: gcc/testsuite/gcc.dg/pr39712.c
===================================================================
*** gcc/testsuite/gcc.dg/pr39712.c (revision 0)
--- gcc/testsuite/gcc.dg/pr39712.c (revision 0)
***************
*** 0 ****
--- 1,9 ----
+ /* { dg-do compile } */
+
+ int is_table[2][16];
+ int is_table_lsf[2][2][16];
+ void compute_stereo()
+ {
+ int (*is_tab)[16];
+ is_tab = is_table;
+ }