Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ARIZONA.EDU!modular!moonunit!olson From: modular!moonunit!olson@ARIZONA.EDU (Jon Olson) Newsgroups: gnu.gcc.bug Subject: (none) Message-ID: <8907112046.AA02174@moonunit.> Date: 11 Jul 89 20:46:22 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 52 Good day, This morning, I sent over a bug report regarding GCC's handling of variable-length argument lists. Since then I have dug into the source code and come up with a fix to the problem. Turns out the function `expand_builtin()' was moving the instruction preceding the __builtin_saveregs call also when rearranging the instructions. Below find a patch for this bug. Hopefully, it will get incorporated into future releases of GCC. 1) GCC Version: 1.34 2) Processor Type: SPARC (SUN-4) 3) Operating System: SUNOS 4.0.3 4) Command Line: gcc -O (optimized compilation) 5) md: sparc.md 6) tm.h: tm-sparc.h 7) Problem: GCC occasionally corrupts variable length arg lists by placing an instruction before the __builtin_saveregs call which steps on `i0' through `i5'. --------------------------------------------------------------------------- *** expr.c-old Tue Jul 11 13:34:32 1989 --- expr.c Tue Jul 11 13:32:23 1989 *************** *** 3184,3190 **** /* Now really call the function. `expand_call' does not call expand_builtin, so there is no danger of infinite recursion here. */ expand_call (exp, target, 1); ! reorder_insns (last, get_last_insn (), get_insns ()); } case BUILT_IN_ALLOCA: --- 3184,3192 ---- /* Now really call the function. `expand_call' does not call expand_builtin, so there is no danger of infinite recursion here. */ expand_call (exp, target, 1); ! last = NEXT_INSN(last); ! if( last ) ! reorder_insns (last, get_last_insn (), get_insns ()); } case BUILT_IN_ALLOCA: --------------------------------------------------------------------------- Jon Olson, Modular Mining Systems 1210 E. Pennsylvania St. Tucson, AZ 85714 USENET: {allegra,cmcl2,hao!noao}!arizona!modular!olson INTERNET: modular!olson@arizona.edu