This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why convert to pointer type before added to a pointer



Jeffrey A Law wrote:
The other approach is to relax the type system.  That's bad from the
standpoint of being able to perform internal consistency checking.

I try this patch, bootstraped and tested for gcc. It failed gcc.dg/tree-ssa/20030815-1.c. But I think it is not a regression. This test check there is one and only one (struct rtx_def * *) case. Even this one is eliminated with this patch. I have not touched the front end of C++, Fortran or Java. This patch is an initial trial, but I think it show that this idea works. How will this affect gcc performing internal consistency checking?


cheers -- Jie

--- c-common.c  2004-08-15 23:44:49.000000000 +0800
+++ c-common.c.new      2004-08-20 10:38:26.952057800 +0800
@@ -2282,9 +2282,8 @@ pointer_int_sum (enum tree_code resultco
      Do this multiplication as signed, then convert to the appropriate
      pointer type (actually unsigned integral).  */

- intop = convert (result_type,
- build_binary_op (MULT_EXPR, intop,
- convert (TREE_TYPE (intop), size_exp), 1));
+ intop = build_binary_op (MULT_EXPR, intop,
+ convert (TREE_TYPE (intop), size_exp), 1));


   /* Create the sum or difference.  */
   return fold (build2 (resultcode, result_type, ptrop, intop));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]