[Bug target/11476] [arc-elf] gcc ICE on newlib's vfprintf.c

ramana dot radhakrishnan at codito dot com gcc-bugzilla@gcc.gnu.org
Sat Sep 4 10:39:00 GMT 2004


------- Additional Comments From ramana dot radhakrishnan at codito dot com  2004-09-04 10:39 -------
In continuation with this bug, we figured out that there were a few calls to
build with unary operators without side effects. The exact place in tree.c where
this fails had the following comment . 

--- tree.c 
  /* The only one-operand cases we handle here are those with side-effects.
	 Others are handled with build1.  So don't bother checked if the
	 arg has side-effects since we'll already have set it.

	 ??? This really should use build1 too.  */
      if (TREE_CODE_CLASS (code) != 's')
	abort ();

In the case for all these aborts the nodes being passed were unary operators,
for example (INDIRECT_REF which has a code of 'r' ) which is not a side effect
unary node. 


The following patch fixes this .

---ChangeLog 
2004-09-04 Ramana Radhakrishnan <ramana.radhakrishnan@codito.com>

PR/ 11476

arc.c 
  * Fix calls to build for unary operators without sideeffects for ARC. 



--- arc.c.orig  2004-09-04 16:00:15.000000000 +0530
+++ arc.c       2004-09-04 16:00:42.000000000 +0530
@@ -2284,8 +2284,8 @@
     {
       tree type_ptr_ptr = build_pointer_type (type_ptr);

-      addr = build (INDIRECT_REF, type_ptr,
-                   build (NOP_EXPR, type_ptr_ptr, valist));
+      addr = build1 (INDIRECT_REF, type_ptr,
+                   build1 (NOP_EXPR, type_ptr_ptr, valist));

       incr = build (PLUS_EXPR, TREE_TYPE (valist),
                    valist, build_int_2 (UNITS_PER_WORD, 0));
@@ -2305,12 +2305,12 @@
        {
          /* AP = (TYPE *)(((int)AP + 7) & -8)  */

-         addr = build (NOP_EXPR, integer_type_node, valist);
+         addr = build1 (NOP_EXPR, integer_type_node, valist);
          addr = fold (build (PLUS_EXPR, integer_type_node, addr,
                              build_int_2 (7, 0)));
          addr = fold (build (BIT_AND_EXPR, integer_type_node, addr,
                              build_int_2 (-8, 0)));
-         addr = fold (build (NOP_EXPR, TREE_TYPE (valist), addr));
+         addr = fold (build1 (NOP_EXPR, TREE_TYPE (valist), addr));
        }

       /* The increment is always rounded_size past the aligned pointer.  */


and continues with the build.






-- 


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



More information about the Gcc-bugs mailing list