This is the mail archive of the gcc-bugs@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]

[Bug bootstrap/33309] 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? :-)

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.


-- 

ghazi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33309


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