[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-12-03 Thread egall at gwmail dot gwu.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

Eric Gallager  changed:

   What|Removed |Added

 CC||egall at gwmail dot gwu.edu

--- Comment #11 from Eric Gallager  ---
(In reply to David Malcolm from comment #10)
> Build breakage should have been fixed as of r243207 (sorry again).
> 
> Should we poision strndup in system.h?

I think so, I meant to ask that last time this happened in bug 67363 but never
got around to it.

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-12-02 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

--- Comment #10 from David Malcolm  ---
Build breakage should have been fixed as of r243207 (sorry again).

Should we poision strndup in system.h?

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-12-02 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

--- Comment #9 from David Malcolm  ---
Author: dmalcolm
Date: Fri Dec  2 22:39:43 2016
New Revision: 243207

URL: https://gcc.gnu.org/viewcvs?rev=243207=gcc=rev
Log:
selftest.c: remove calls to strndup (PR bootstrap/78616)

gcc/ChangeLog:
PR bootstrap/78616
* selftest.c (selftest::assert_strndup_eq): Rename to...
(selftest::assert_xstrndup_eq): ...this, and remove call to
strndup.
(selftest::test_strndup): Rename to...
(selftest::test_xstrndup): ...this, updating for above renaming.
(selftest::test_libiberty): Update for renaming.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/selftest.c

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-12-01 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

David Malcolm  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |dmalcolm at gcc dot 
gnu.org

--- Comment #8 from David Malcolm  ---
Thanks.  I'm working on a patch to remove the use of strndup.  Sorry for the
breakage.

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-12-01 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
Yeah, I'm susprised strndup isn't poisoned in system.h, strdup is.
selftest.c shouldn't be using strndup, just xstrndup.

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-12-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.0

--- Comment #6 from Richard Biener  ---
Or just use xstrndup like we do in gcc/?

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-11-30 Thread iains at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

--- Comment #5 from Iain Sandoe  ---
Created attachment 40210
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40210=edit
test for strndup and publish it from libiberty if not available from the host.


bootstrap (all langs, checking=yes,rtl,tree) completed at 243033 with this
patch.
I guess the question is why wasn't the function exported from libiberty before?

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-11-30 Thread iains at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

--- Comment #4 from Iain Sandoe  ---
(In reply to Iain Sandoe from comment #3)
> trying this (after regnerating gcc/configure and gcc/config.in)
> 
> $ git diff gcc/configure.ac include/libiberty.h 
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index 703250f..ece1ffa 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -1306,7 +1306,7 @@ AC_CHECK_DECLS([basename(const char*), strstr(const
> char*,const char*)], , ,[
>  #include "system.h"])
>  
>  gcc_AC_CHECK_DECLS(getenv atol atoll asprintf sbrk abort atof getcwd getwd \
> -   madvise stpcpy strnlen strsignal strverscmp \
> +   madvise stpcpy strnlen strndup strsignal strverscmp \
> strtol strtoul strtoll strtoull setenv unsetenv \
> errno snprintf vsnprintf vasprintf malloc realloc calloc \
> free getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[
> diff --git a/include/libiberty.h b/include/libiberty.h
> index 605ff56..0401dac 100644
> --- a/include/libiberty.h
> +++ b/include/libiberty.h
> @@ -670,6 +670,10 @@ extern int vsnprintf (char *, size_t, const char *,
> va_list) ATTRIBUTE_PRINTF(3,
>  extern size_t strnlen (const char *, size_t);
>  #endif
>  

oops pasto on strndup signature; meant char * of course


> +#if defined (HAVE_DECL_STRNDUP) && !HAVE_DECL_STRNDUP
> +extern size_t strndup (const char *, size_t);
> +#endif
> +
>  #if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP
>  /* Compare version strings.  */
>  extern int strverscmp (const char *, const char *);

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-11-30 Thread iains at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

--- Comment #3 from Iain Sandoe  ---
trying this (after regnerating gcc/configure and gcc/config.in)

$ git diff gcc/configure.ac include/libiberty.h 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 703250f..ece1ffa 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1306,7 +1306,7 @@ AC_CHECK_DECLS([basename(const char*), strstr(const
char*,const char*)], , ,[
 #include "system.h"])

 gcc_AC_CHECK_DECLS(getenv atol atoll asprintf sbrk abort atof getcwd getwd \
-   madvise stpcpy strnlen strsignal strverscmp \
+   madvise stpcpy strnlen strndup strsignal strverscmp \
strtol strtoul strtoll strtoull setenv unsetenv \
errno snprintf vsnprintf vasprintf malloc realloc calloc \
free getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[
diff --git a/include/libiberty.h b/include/libiberty.h
index 605ff56..0401dac 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -670,6 +670,10 @@ extern int vsnprintf (char *, size_t, const char *,
va_list) ATTRIBUTE_PRINTF(3,
 extern size_t strnlen (const char *, size_t);
 #endif

+#if defined (HAVE_DECL_STRNDUP) && !HAVE_DECL_STRNDUP
+extern size_t strndup (const char *, size_t);
+#endif
+
 #if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP
 /* Compare version strings.  */
 extern int strverscmp (const char *, const char *);

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-11-30 Thread iains at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

--- Comment #2 from Iain Sandoe  ---
(In reply to David Malcolm from comment #1)
> If I'm reading things right, it looks like libiberty provides an
> implementation of strndup if it's not available, but it doesn't provide a
> decl for it.

indeed
$ grep strndup include/libiberty.h 
extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC
ATTRIBUTE_RETURNS_NONNULL;

not sure exactly what the phasing is supposed to be.

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-11-30 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

--- Comment #1 from David Malcolm  ---
If I'm reading things right, it looks like libiberty provides an implementation
of strndup if it's not available, but it doesn't provide a decl for it.

[Bug bootstrap/78616] [7 regression] bootstrap fails for x86_64-darwin at stage1 after 243030 when the bootstrap compiler doesn't have strndup

2016-11-30 Thread iains at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78616

Iain Sandoe  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-11-30
 CC||dmalcolm at gcc dot gnu.org
 Ever confirmed|0   |1