bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: btowc(0) configure check hangs clang? [was: Possible configure bug]


From: Bruno Haible
Subject: Re: btowc(0) configure check hangs clang? [was: Possible configure bug]
Date: Sat, 3 Sep 2011 02:52:05 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Aleksander Balicki wrote:
> it was checked with clang-2.9 and trunk - the same effect
> 
> it compiles under gcc-4.4.5

For reference, the test program is this one:

================ foo.c ====================
#include <string.h>
#include <stddef.h>
#include <stdio.h>
#include <time.h>
#include <wchar.h>
int main ()
{
  if (btowc ('\0') != 0)
    return 1;
  return 0;
}
===========================================

I guess that clang hangs or produces an endless loop because of
this inline definition in <wchar.h>:

extern wint_t __btowc_alias (int __c) __asm ("btowc");
__extern_inline wint_t
__NTH (btowc (int __c))
{ return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
          ? (wint_t) __c : __btowc_alias (__c)); }

Evidently, clang gives a different semantics to __asm than GCC.
But GCC's semantics of __asm is fixed for 20 years.

Conclusion: Needs to be fixed in clang.

Btw, in clang 1.0 (target: x86_64-pc-linux-gnu) it works fine:

$ clang -O2 -D__USE_EXTERN_INLINES foo.c
$ nm a.out | grep btowc
                 U btowc@@GLIBC_2.2.5
$ ./a.out ; echo $?
0

Bruno
-- 
In memoriam Robert Mensah <http://en.wikipedia.org/wiki/Robert_Mensah>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]