This is the mail archive of the gcc-bugs@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]

Re: gcc 2.95.2 PPC code generation bug


At 17:43 25.04.00, Ralph Schmidt wrote:
>In a rekursive dynamicly initialized array gcc forgets to set the result of
>a function call. Please look into the .c file to see a closer description
>of the problem.
>
>.s contains the ppc assembler with the problem
>_noif.s contains the ppc assembler without the problem by simply uncommenting
>the previous <if>
>_68k.s contains the 68k assembler...no problem.
>.e contains the preprocessor version...highly confusing..i know

I think this was fixed in the mainline by this patch:

2000-03-06  Mark Mitchell  <mark@codesourcery.com>

         * function.c (free_temps_for_rtl_expr): Don't free slots
         that have been pushed into a higher level.

I backported it to gcc-2.95.3pre and it seems to solve your testcase. Be 
aware that your testcase contains a bug (? I think, I don't know the exact 
limitations of stmt expressions) too, you have one pair of braces too much, 
I rewrote it like this:

#define LP1(offs, rt, name, t1, v1, r1, bt, bn, cm1, cs1, cl1, cm2, cs2, 
cl2 )  \
({                                                              \
    struct EmulCaos MyCaos;                                              \
       rt _##name##_re;                                          \
       MyCaos.reg_##r1           = (unsigned long) v1;                   \
       MyCaos.reg_a6             = (unsigned long) bn;                   \
       MyCaos.caos_Un.Offset     =       (-offs);                \
       _##name##_re = (rt) 
(*MyEmulHandle->EmulCallOS)(&MyCaos);                 \
       _##name##_re;                                             \
})

Btw, preprocessed sources have a .i extension, as you can see with -save-temps.

Please try the patch and tell me the results, I've got a small regression 
in the C++ testsuite, but that maybe due to other reasons, I'm currently 
rechecking.

Also it would be very kind of you, if you could convert the preprocessed 
testcase to a runnable one. It should abort() if miscompiled, and exit(0) 
otherwise.

Franz.


Index: function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.90.4.2
diff -u -p -r1.90.4.2 function.c
--- function.c  1999/09/07 07:34:04     1.90.4.2
+++ function.c  2000/04/26 09:11:31
@@ -1428,7 +1428,16 @@ free_temps_for_rtl_expr (t)

    for (p = temp_slots; p; p = p->next)
      if (p->rtl_expr == t)
-      p->in_use = 0;
+      {
+       /* If this slot is below the current TEMP_SLOT_LEVEL, then it
+          needs to be preserved.  This can happen if a temporary in
+          the RTL_EXPR was addressed; preserve_temp_slots will move
+          the temporary into a higher level.   */
+       if (temp_slot_level <= p->level)
+         p->in_use = 0;
+       else
+         p->rtl_expr = NULL_TREE;
+      }

    combine_temp_slots ();
  }

stackslot.patch


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