Message ID | 20100710040444.im0gaauyo4woo0go-nzlynne@webmail.spamcop.net |
---|---|
State | New |
Headers | show |
On Sat, Jul 10, 2010 at 10:04 AM, Joern Rennecke <amylaar@spamcop.net> wrote: > I've tried to do bootstrapping on a playstation, but I couldn't even get a > baseline - although the compilers were built on the first day, it spent six > more days building java libraries (and swapping, CPU usage around 1%), > before the shell aborted for some unknown reason, and the machine locked up. > > With the dearth of PPC connectivity / CPU cycles on the compile farm, > I'm afraid I can only offer cross tests. > > built all-gcc for i686-pc-linux-gnu X ppc-linux-gnu with configure option > --enable-werror-always and gcc (GCC) 4.6.0 20100630 (experimental); > > built all-gcc for i686-pc-linux-gnu X ppc-linux-gnu with configure options > --enable-werror-always --enable-build-with-cxx and > g++ (GCC) 4.6.0 20100630 (experimental). > > 2010-06-23 Joern Rennecke <joern.rennecke@embecosm.com> > > PR bootstrap/44637 > * config/rs6000/rs6000.c (rs6000_xcoff_strip_dollar): Use const char > * > variable for const char * strchr result. > > Index: config/rs6000/rs6000.c > =================================================================== > --- config/rs6000/rs6000.c (revision 161213) > +++ config/rs6000/rs6000.c (working copy) > @@ -21252,12 +21252,13 @@ toc_hash_eq (const void *h1, const void > const char * > rs6000_xcoff_strip_dollar (const char *name) > { > + const char *cp; > char *strip, *p; > int len; > > - p = strchr (name, '$'); > + cp = strchr (name, '$'); > > - if (p == 0 || p == name) > + if (cp == 0 || cp == name) > return name; > > len = strlen (name); Huh, I wonder why the same diagnostic is not issued for the code below which reads strip = (char *) alloca (len + 1); strcpy (strip, name); p = strchr (strip, '$'); while (p) { *p = '_'; p = strchr (p + 1, '$'); } why not use our "friendly" CONST_CAST macro here? Richard. >
On Sat, Jul 10, 2010 at 10:19:49AM +0200, Richard Guenther wrote: > > --- config/rs6000/rs6000.c (revision 161213) > > +++ config/rs6000/rs6000.c (working copy) > > @@ -21252,12 +21252,13 @@ toc_hash_eq (const void *h1, const void > > const char * > > rs6000_xcoff_strip_dollar (const char *name) > > { > > + const char *cp; > > char *strip, *p; > > int len; > > > > - p = strchr (name, '$'); > > + cp = strchr (name, '$'); > > > > - if (p == 0 || p == name) > > + if (cp == 0 || cp == name) > > return name; > > > > len = strlen (name); > > Huh, I wonder why the same diagnostic is not issued for the code below which > reads > > strip = (char *) alloca (len + 1); > strcpy (strip, name); > p = strchr (strip, '$'); > while (p) > { > *p = '_'; > p = strchr (p + 1, '$'); > } > Because strchr is char *strchr (const char *, int); for C and char *strchr (char *, int); const char *strchr (const char *, int); for C++? In the first snippet the argument is const char *, so the result is const char * too (for C++ only, otherwise char *), while in the second snippet the argument is char *, so the result is char * too. > why not use our "friendly" CONST_CAST macro here? Why? Jakub
On Sat, Jul 10, 2010 at 10:32 AM, Jakub Jelinek <jakub@redhat.com> wrote: > On Sat, Jul 10, 2010 at 10:19:49AM +0200, Richard Guenther wrote: >> > --- config/rs6000/rs6000.c (revision 161213) >> > +++ config/rs6000/rs6000.c (working copy) >> > @@ -21252,12 +21252,13 @@ toc_hash_eq (const void *h1, const void >> > const char * >> > rs6000_xcoff_strip_dollar (const char *name) >> > { >> > + const char *cp; >> > char *strip, *p; >> > int len; >> > >> > - p = strchr (name, '$'); >> > + cp = strchr (name, '$'); >> > >> > - if (p == 0 || p == name) >> > + if (cp == 0 || cp == name) >> > return name; >> > >> > len = strlen (name); >> >> Huh, I wonder why the same diagnostic is not issued for the code below which >> reads >> >> strip = (char *) alloca (len + 1); >> strcpy (strip, name); >> p = strchr (strip, '$'); >> while (p) >> { >> *p = '_'; >> p = strchr (p + 1, '$'); >> } >> > > Because strchr is char *strchr (const char *, int); for C > and char *strchr (char *, int); const char *strchr (const char *, int); for C++? > In the first snippet the argument is const char *, so the result is const > char * too (for C++ only, otherwise char *), while in the second snippet > the argument is char *, so the result is char * too. Ah, that makes sense. I didn't look closely enough. >> why not use our "friendly" CONST_CAST macro here? > > Why? Not necessary in that case then. Richard. > Jakub >
Index: config/rs6000/rs6000.c =================================================================== --- config/rs6000/rs6000.c (revision 161213) +++ config/rs6000/rs6000.c (working copy) @@ -21252,12 +21252,13 @@ toc_hash_eq (const void *h1, const void const char * rs6000_xcoff_strip_dollar (const char *name) { + const char *cp; char *strip, *p; int len; - p = strchr (name, '$'); + cp = strchr (name, '$'); - if (p == 0 || p == name) + if (cp == 0 || cp == name) return name; len = strlen (name);