/test/gnu/gcc/objdir/./prev-gcc/xgcc -B/test/gnu/gcc/objdir/./prev-gcc/ -B/opt/gnu64/gcc/gcc-4.3.0/hppa64-hp-hpux11.11/bin/ -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAV E_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I/opt/gnu64/gcc/gcc-4.3.0/include -I../../gc c/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber \ -DSTANDARD_STARTFILE_PREFIX=\"../../../\" -DSTANDARD_EXEC_PREFIX=\"/opt/gnu64/ gcc/gcc-4.3.0/lib/gcc/\" -DSTANDARD_LIBEXEC_PREFIX=\"/opt/gnu64/gcc/gcc-4.3.0/li bexec/gcc/\" -DDEFAULT_TARGET_VERSION=\"4.3.0\" -DDEFAULT_TARGET_MACHINE=\"hppa6 4-hp-hpux11.11\" -DSTANDARD_BINDIR_PREFIX=\"/opt/gnu64/gcc/gcc-4.3.0/bin/\" -DTO OLDIR_BASE_PREFIX=\"../../../../\" `test "X${SHLIB_LINK}" = "X" || test "yes" ! = "yes" || echo "-DENABLE_SHARED_LIBGCC"` \ -c ../../gcc/gcc/gcc.c -o gcc.o) cc1: warnings being treated as errors ../../gcc/gcc/gcc.c: In function 'main': ../../gcc/gcc/gcc.c:6236: error: passing argument 1 of 'xputenv' discards qualif iers from pointer target type Ugh.
I think I'll let Kaveh fix this one... On hpux and in libiberty, putenv takes a const char * while on other os's it takes a char *. xputenv doesn't do anything that would affect the constantness of its argument. Thus, it doesn't seem reasonable to do something ugly to the definition of INIT_ENVIRONMENT in pa64-hpux.h to resolve this regression.
(In reply to comment #1) > I think I'll let Kaveh fix this one... To what exactly do I owe this honor? :-) AFAICT, this is a -Wwrite-strings error caused by a patch by FX: http://gcc.gnu.org/ml/gcc-patches/2007-08/msg02280.html A quick fix might be to do ASTRDUP on the INIT_ENVIRONMENT string. It's okay to use stack space for putenv strings here because we're in main(). However I seem to recall a problem with alloca passed as a function argument in some ancient version of gcc. So it'll need an intermediate tmp variable, or use xstrdup to avoid alloca. Another option would be to constify xputenv and use CONST_CAST on the argument passed to putenv. A third option would be to constify xputenv and fixinclude putenv on those platforms where it isn't const.
(In reply to comment #2) > Another option would be to constify xputenv and use CONST_CAST on the argument > passed to putenv. Like this? Index: gcc.c =================================================================== --- gcc.c (revision 128046) +++ gcc.c (working copy) @@ -297,7 +297,7 @@ static void set_spec (const char *, cons static struct compiler *lookup_compiler (const char *, size_t, const char *); static char *build_search_list (const struct path_prefix *, const char *, bool, bool); -static void xputenv (char *); +static void xputenv (const char *); static void putenv_from_prefixes (const struct path_prefix *, const char *, bool); static int access_check (const char *, int); @@ -2602,11 +2602,11 @@ add_to_obstack (char *path, void *data) /* Add or change the value of an environment variable, outputting the change to standard error if in verbose mode. */ static void -xputenv (char *string) +xputenv (const char *string) { if (verbose_flag) notice ("%s\n", string); - putenv (string); + putenv (CONST_CAST (string)); } /* Build a list of search directories from PATHS.
Subject: Re: gcc.c:6236: error: passing argument 1 of 'xputenv' discards qualifiers from pointer target type > ------- Comment #2 from ghazi at gcc dot gnu dot org 2007-09-05 06:17 ------- > (In reply to comment #1) > > I think I'll let Kaveh fix this one... > > To what exactly do I owe this honor? :-) Insufficient research on my part ;( Dave
(In reply to comment #3) > (In reply to comment #2) > > Another option would be to constify xputenv and use CONST_CAST on the argument > > passed to putenv. > Like this? > + putenv (CONST_CAST (string)); Almost, CONST_CAST takes a type argument now: CONST_CAST (char *, string)
Subject: Re: gcc.c:6236: error: passing argument 1 of 'xputenv' discards qualifiers from pointer target type > > > Another option would be to constify xputenv and use CONST_CAST on the argument > > > passed to putenv. > > Like this? > > + putenv (CONST_CAST (string)); > > Almost, CONST_CAST takes a type argument now: > > CONST_CAST (char *, string) The change with the above mod works for me on hpux. Dave
What is the status here? I tested the patch below on hppa64-hp-hpux11.11, i686-pc-linux-gnu and i686-apple-darwin8. It brings the pa target past the failure. The others completed bootstrap. I'm not able to test on the other targets I have access to since they are blocked by 32283. Index: gcc.c =================================================================== --- gcc.c (revision 128287) +++ gcc.c (working copy) @@ -297,7 +297,7 @@ static struct compiler *lookup_compiler (const char *, size_t, const char *); static char *build_search_list (const struct path_prefix *, const char *, bool, bool); -static void xputenv (char *); +static void xputenv (const char *); static void putenv_from_prefixes (const struct path_prefix *, const char *, bool); static int access_check (const char *, int); @@ -2602,11 +2602,11 @@ /* Add or change the value of an environment variable, outputting the change to standard error if in verbose mode. */ static void -xputenv (char *string) +xputenv (const char *string) { if (verbose_flag) notice ("%s\n", string); - putenv (string); + putenv (CONST_CAST (char *, string)); } /* Build a list of search directories from PATHS.
Subject: Re: gcc.c:6236: error: passing argument 1 of 'xputenv' discards qualifiers from pointer target type > What is the status here? > I tested the patch below on hppa64-hp-hpux11.11, i686-pc-linux-gnu and > i686-apple-darwin8. It brings the pa target past the failure. The others > completed bootstrap. I'm not able to test on the other targets I have access to > since they are blocked by 32283. Your change is the same as I've been using. I guess someone needs to do it. Want to do it? I'm heading home at the moment. Dave
It is the same, I just wanted to summarize in patch form. If we have an approval then I can commit asap. Kaveh? I'm heading towards bed ;)
(In reply to comment #9) > It is the same, I just wanted to summarize in patch form. If we have an > approval then I can commit asap. > Kaveh? I can't approve it, but it looks correct to me.
(In reply to comment #9) > It is the same, I just wanted to summarize in patch form. If we have an > approval then I can commit asap. Sorry for being so slow on that one, I only have limited net access. I have submitted the patch for approval (http://gcc.gnu.org/ml/gcc-patches/2007-09/msg00954.html) since Kaveh can't approve it.
Subject: Bug 33309 Author: fxcoudert Date: Thu Sep 13 10:10:11 2007 New Revision: 128457 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128457 Log: PR driver/33309 * gcc.c (xputenv): Make argument const, and use CONST_CAST. Modified: trunk/gcc/ChangeLog trunk/gcc/gcc.c
Fixed.