calls.c (emit_library_call_value): Don't use a fixed argument after VA_CLOSE, i.e.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Fri, 31 Aug 2001 19:28:58 +0000 (19:28 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Fri, 31 Aug 2001 19:28:58 +0000 (19:28 +0000)
* calls.c (emit_library_call_value): Don't use a fixed
argument after VA_CLOSE, i.e. out of scope in traditional C.

* emit-rtl.c (gen_rtvec): Likewise.

From-SVN: r45332

gcc/ChangeLog
gcc/calls.c
gcc/emit-rtl.c

index f4037caa0baf99bb8ca114d522103fa1e0af243a..8caa502347372c58a4b98769fd232b368a78e6ee 100644 (file)
@@ -1,3 +1,10 @@
+2001-08-31  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * calls.c (emit_library_call_value): Don't use a fixed
+       argument after VA_CLOSE, i.e. out of scope in traditional C.
+
+       * emit-rtl.c (gen_rtvec): Likewise.
+
 2001-08-31  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Makefile.in (c-pragma.o): Depend on output.h.
index 275ca1d53f5378ead38ac6107d54db9daf75fdbc..8d6d0849148299895589825a86c3cf4aa2ddb12b 100644 (file)
@@ -4227,6 +4227,8 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value,
                                 enum libcall_type fn_type,
                                 enum machine_mode outmode, int nargs, ...))
 {
+  rtx result;
+  
   VA_OPEN (p, nargs);
   VA_FIXEDARG (p, rtx, orgfun);
   VA_FIXEDARG (p, rtx, value);
@@ -4234,11 +4236,12 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value,
   VA_FIXEDARG (p, enum machine_mode, outmode);
   VA_FIXEDARG (p, int, nargs);
 
-  value = emit_library_call_value_1 (1, orgfun, value, fn_type, outmode, nargs, p);
+  result = emit_library_call_value_1 (1, orgfun, value, fn_type, outmode,
+                                     nargs, p);
 
   VA_CLOSE (p);
 
-  return value;
+  return result;
 }
 \f
 #if 0
index 379bfb6b80932a739f593f2feb71f7b0ebc6c879..d04e3d23ba4d8b6f1ae41a79fa4f38e3419c6b50 100644 (file)
@@ -517,7 +517,7 @@ gen_rtx VPARAMS ((enum rtx_code code, enum machine_mode mode, ...))
 rtvec
 gen_rtvec VPARAMS ((int n, ...))
 {
-  int i;
+  int i, save_n;
   rtx *vector;
 
   VA_OPEN (p, n);
@@ -530,9 +530,12 @@ gen_rtvec VPARAMS ((int n, ...))
 
   for (i = 0; i < n; i++)
     vector[i] = va_arg (p, rtx);
+
+  /* The definition of VA_* in K&R C causes `n' to go out of scope.  */
+  save_n = n;
   VA_CLOSE (p);
 
-  return gen_rtvec_v (n, vector);
+  return gen_rtvec_v (save_n, vector);
 }
 
 rtvec