This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[PATCH] Avoid segfault invoking f771 with no args


This patch is the g77 equivalent of the gcj patch I've just posted.

I realize that mainline's gcc/f directory is already scheduled for
"termination" and even if patches are approved there, they'll only
exist in CVS for a few weeks at most.  However, this is also a regression
in 3.4, which takes on additional significance as that'll be the last
release series for GNU g77.

If nothing else, perhaps this'll set the "ante", such that if g95
dumps core when invoked without command line options, it can/will
be considered a regression from a recent/previous snapshot :>.


The following patch has been tested on i686-pc-linux-gnu with a
full bootstrap and regression tested with no new failures.

Ok for 3.4?  And temporarily on mainline (to minimize delta)?



2004-02-28  Roger Sayle  <roger@eyesopen.com>

	* parse.c (ffe_parse_file): Handle the case that main_input_filename
	is NULL.


Index: parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/parse.c,v
retrieving revision 1.14
diff -c -3 -p -r1.14 parse.c
*** parse.c	12 Jan 2003 02:32:39 -0000	1.14
--- parse.c	29 Feb 2004 03:52:34 -0000
*************** extern FILE *finput;
*** 31,36 ****
--- 31,37 ----
  void
  ffe_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
  {
+   const char *fname;
    ffewhereFile wf;

    if (ffe_is_version ())
*************** ffe_parse_file (int set_yydebug ATTRIBUT
*** 39,46 ****
    if (!ffe_is_pedantic ())
      ffe_set_is_pedantic (pedantic);

!   wf = ffewhere_file_new (main_input_filename, strlen (main_input_filename));
!   ffecom_file (main_input_filename);
    ffe_file (wf, finput);

    ffecom_finish_compile ();
--- 40,48 ----
    if (!ffe_is_pedantic ())
      ffe_set_is_pedantic (pedantic);

!   fname = main_input_filename ? main_input_filename : "<stdin>";
!   wf = ffewhere_file_new (fname, strlen (fname));
!   ffecom_file (fname);
    ffe_file (wf, finput);

    ffecom_finish_compile ();


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


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