------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-30 
14:14 -------
The easiest fix would be to fold it in the front-end for all INT_CST's like the 
following with a slight 
comment fix above:
Index: c-typeck.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.415
diff -u -p -r1.415 c-typeck.c
--- c-typeck.c  29 Jan 2005 16:12:38 -0000      1.415
+++ c-typeck.c  30 Jan 2005 14:13:00 -0000
@@ -2683,7 +2683,7 @@ build_unary_op (enum tree_code code, tre
         when we have proper support for integer constant expressions.  */
       val = get_base_address (arg);
       if (val && TREE_CODE (val) == INDIRECT_REF
-         && integer_zerop (TREE_OPERAND (val, 0)))
+          && TREE_CODE (TREE_OPERAND (val, 0)) == INTEGER_CST)
        return fold_convert (argtype, fold_offsetof (arg));
 
       val = build1 (ADDR_EXPR, argtype, arg);


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0 Regression] fold does  |[4.0 Regression] does not
                   |not fold "&int_cst->a"      |fold "&int_cst->a" to just
                   |                            |INT_CST


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19708

Reply via email to