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

Re: libiberty configure fails on svr4/svr5 native


> |> #include <assert.h>
> |> 
> |> int main()
> |> {
> |>   char memcpy();
> |>   char (*f)() = memcpy;
> |>   return 0;
> |> }
> 
> I think the assignment should use a global variable, otherwise an
> optimising compiler could completely omit it.

True.  So make that:

#include <assert.h>

char memcpy();
char (*f)();

int main()
{
  f = memcpy;
  return 0;
}

It would be tempting to make f volatile for good measure, however I've
heard that some early compilers don't support volatile.

Do we have to be wary of interprocedural optimizations in autoconf?

*** acgeneral.m4	Mon Nov  9 21:02:51 1998
--- acgeneral.m4-new	Mon Nov  9 21:16:00 1998
*************** extern "C"
*** 1777,1782 ****
--- 1777,1783 ----
  [/* We use char because int might match the return type of a gcc2
      builtin and then its argument prototype would still apply.  */
  char $1();
+ char (*f)();
  ], [
  /* The GNU C library defines this for functions which it implements
      to always fail with ENOSYS.  Some functions are actually named
*************** char $1();
*** 1784,1790 ****
  #if defined (__stub_$1) || defined (__stub___$1)
  choke me
  #else
! $1();
  #endif
  ], eval "ac_cv_func_$1=yes", eval "ac_cv_func_$1=no")])
  if eval "test \"`echo '$ac_cv_func_'$1`\" = yes"; then
--- 1785,1791 ----
  #if defined (__stub_$1) || defined (__stub___$1)
  choke me
  #else
! f = $1;
  #endif
  ], eval "ac_cv_func_$1=yes", eval "ac_cv_func_$1=no")])
  if eval "test \"`echo '$ac_cv_func_'$1`\" = yes"; then


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