[PATCH] Fix specs processing (take 2)

Roger Sayle roger@www.eyesopen.com
Thu Mar 6 01:25:00 GMT 2003


On Tue, 4 Mar 2003, Joern Rennecke wrote:
> On Tue, 4 Mar 2003, Joern Rennecke wrote:
> > 2003-02-08  Roger Sayle  <roger@eyesopen.com>
> >
> > * gcc.c (do_spec_1) ['{']:  Handle pending argument upon return
> >         from handle_braces in "%{...}".
> >
> > This breaks most of the sh targets (sh-elf, sh64-elf, sh3-elf, ...)
>
> Does it work if you put your block of code at the end of do_spec_2
> (saving the return value of do_spec_1 into a temporary variable)?

Indeed it does!  The following patch implements Joern's suggestion
to process the final argument upon return from do_spec_1 in do_spec_2
rather than processing each argument upon return from handle_braces.

The following patch has been bootstraped on both i686-pc-linux-gnu and
alphaev67-dec-osf5.1, all languages except Ada and treelang, with no
new regressions on either from a top-level "make -k check".  I also
checked that just reverting my earlier patch still causes a bootstrap
failure on Tru64.

I've also checked that this patch fixes the SH failures by building a
sh-elf cross-compiler from i686-pc-linux-gnu and running the testsuite
on the sh-hms-sim simulator, both with and without this patch.  Both
build fine, but the patch below cures all but 15 of the ~4960 gcc
FAILs of current CVS on sh-elf.


Ok for mainline?  My apologies again for the inconvenience.



2003-03-05  Roger Sayle  <roger@eyesopen.com>
	    Joern Rennecke <joern.rennecke@superh.com>

	* gcc.c (do_spec_1) ['{']: Revert 2003-02-24 patch.  Don't handle
	pending argument upon return from handle_braces here.
	(do_spec_2): Instead handle it upon return from do_spec_1 here.


Index: gcc.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.366
diff -c -3 -p -r1.366 gcc.c
*** gcc.c	2 Mar 2003 14:09:30 -0000	1.366
--- gcc.c	5 Mar 2003 03:34:03 -0000
*************** static int
*** 4244,4249 ****
--- 4244,4252 ----
  do_spec_2 (spec)
       const char *spec;
  {
+   const char *string;
+   int result;
+
    clear_args ();
    arg_going = 0;
    delete_this_arg = 0;
*************** do_spec_2 (spec)
*** 4252,4258 ****
    input_from_pipe = 0;
    suffix_subst = NULL;

!   return do_spec_1 (spec, 0, NULL);
  }


--- 4255,4276 ----
    input_from_pipe = 0;
    suffix_subst = NULL;

!   result = do_spec_1 (spec, 0, NULL);
!
!   /* End any pending argument.  */
!   if (arg_going)
!     {
!       obstack_1grow (&obstack, 0);
!       string = obstack_finish (&obstack);
!       if (this_is_library_file)
! 	string = find_file (string);
!       store_arg (string, delete_this_arg, this_is_output_file);
!       if (this_is_output_file)
! 	outfiles[input_file_number] = string;
!       arg_going = 0;
!     }
!
!   return result;
  }


*************** do_spec_1 (spec, inswitch, soft_matched_
*** 5155,5172 ****
  	    p = handle_braces (p);
  	    if (p == 0)
  	      return -1;
- 	    /* End any pending argument.  */
- 	    if (arg_going)
- 	      {
- 		obstack_1grow (&obstack, 0);
- 		string = obstack_finish (&obstack);
- 		if (this_is_library_file)
- 		  string = find_file (string);
- 		store_arg (string, delete_this_arg, this_is_output_file);
- 		if (this_is_output_file)
- 		  outfiles[input_file_number] = string;
- 		arg_going = 0;
- 	      }
  	    break;

  	  case ':':
--- 5173,5178 ----

Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833



More information about the Gcc-patches mailing list