Bootstrap failure compiling ada/misc.c

Matt Kraai kraai@alumni.cmu.edu
Thu Jul 3 11:24:00 GMT 2003


On Wed, Jul 02, 2003 at 07:50:12PM -0400, John David Anglin wrote:
> stage1/xgcc -Bstage1/ -B/home/dave/opt/gnu/hppa-linux/bin/ -c   -gstabs -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes    -Werror -fno-common   -DHAVE_CONFIG_H    -I. -Iada -I../../gcc/gcc -I../../gcc/gcc/ada -I../../gcc/gcc/config -I../../gcc/gcc/../include ../../gcc/gcc/ada/misc.c -o ada/misc.o
> ../../gcc/gcc/ada/misc.c: In function `gnat_handle_option':
> ../../gcc/gcc/ada/misc.c:272: warning: assignment discards qualifiers from pointer target type
> ../../gcc/gcc/ada/misc.c: In function `gnat_init_options':
> ../../gcc/gcc/ada/misc.c:289: warning: assignment discards qualifiers from pointer target type

Neil has committed a patch that makes gnat_argv const.  I don't
think this will work, because it produced warnings during the
first stage of the bootstrap

 gcc -c   -g  -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes     -fno-common   -DHAVE_CONFIG_H    -I. -Iada -I../../gcc/gcc -I../../gcc/gcc/ada -I../../gcc/gcc/config -I../../gcc/gcc/../include ../../gcc/gcc/ada/misc.c -o ada/misc.o
 ../../gcc/gcc/ada/misc.c: In function `gnat_handle_option':
 ../../gcc/gcc/ada/misc.c:262: warning: assignment of read-only location
 ../../gcc/gcc/ada/misc.c:263: warning: passing arg 1 of `strcpy' discards qualifiers from pointer target type
 ../../gcc/gcc/ada/misc.c: In function `gnat_init_options':
 ../../gcc/gcc/ada/misc.c:288: warning: assignment from incompatible pointer type

but I didn't let the bootstrap proceed far enough to be sure.

I used the following patch instead.

Bootstrapped on powerpc-unknown-linux-gnu.

OK to commit (and revert Neil's patch)?

-- 
Matt Kraai          kraai@alumni.cmu.edu          Debian GNU/Linux

	* misc.c (gnat_handle_option, gnat_init_options): Copy
	arguments.

Index: gcc/ada/misc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/misc.c,v
retrieving revision 1.60
diff -3 -c -p -r1.60 misc.c
*** gcc/ada/misc.c	2 Jul 2003 20:40:41 -0000	1.60
--- gcc/ada/misc.c	3 Jul 2003 05:30:24 -0000
*************** gnat_handle_option (size_t scode, const 
*** 269,275 ****
  	    if (save_argv[++i][0] != '-')
  	      {
  		/* Preserve output filename as GCC doesn't save it for GNAT. */
! 		gnat_argv[gnat_argc] = save_argv[i];
  		gnat_argc++;
  		break;
  	      }
--- 269,275 ----
  	    if (save_argv[++i][0] != '-')
  	      {
  		/* Preserve output filename as GCC doesn't save it for GNAT. */
! 		gnat_argv[gnat_argc] = xstrdup (save_argv[i]);
  		gnat_argc++;
  		break;
  	      }
*************** gnat_init_options (unsigned int argc, co
*** 286,292 ****
  {
    /* Initialize gnat_argv with save_argv size.  */
    gnat_argv = (char **) xmalloc ((argc + 1) * sizeof (argv[0])); 
!   gnat_argv[0] = argv[0];     /* name of the command */ 
    gnat_argc = 1;
  
    save_argc = argc;
--- 286,292 ----
  {
    /* Initialize gnat_argv with save_argv size.  */
    gnat_argv = (char **) xmalloc ((argc + 1) * sizeof (argv[0])); 
!   gnat_argv[0] = xstrdup (argv[0]);     /* name of the command */ 
    gnat_argc = 1;
  
    save_argc = argc;



More information about the Gcc-patches mailing list