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 libstdc++/17005] wide character strings don't work on HP-UX 11i using gcc 3.4.1


------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-08-15 19:53 -------
Subject: Re:  wide character strings don't work on HP-UX

> You mean *result1.data() is a '\0'? Or result1.data() is a null pointer?

I believe the former.

> Anyway, time_put::do_put basically does this, in "C terms":
> 
> #include <locale.h>
> #include <time.h>
> #include <wchar.h>
> #include <string.h>
> #include <assert.h>
> 
> int main()
> {
>   wchar_t __s[64];
>   int __maxlen = 64;
>   wchar_t __format[3] = L"%a";
>   struct tm __tm = { 0, 0, 12, 4, 3, 71, 0, 93, 0 };
>   
>   wcsftime(__s, __maxlen, __format, &__tm);
>   
>   assert(wcscmp(__s, L"Sun") == 0);
> }
> 
> Can you debug a bit further? Thanks, Paolo.

The wcsftime call isn't working.  The return value is 0 indicating
that the results in __s are undefined.  Changing the third argument
to "const char *" works.

I think that I have found the problem.

#  ifdef _INCLUDE__STDC_A1_SOURCE
         extern size_t  wcsftime __((wchar_t *, size_t, const wchar_t *,
				    const struct tm *));
#  else /* ! _INCLUDE__STDC_A1_SOURCE  */
         extern size_t  wcsftime __((wchar_t *, size_t, const char *,
				    const struct tm *));
#  endif /* _INCLUDE_STDC_A1_SOURCE */

The third argument is different when _INCLUDE__STDC_A1_SOURCE is defined.
It would appear that we either need to do something different when
_INCLUDE__STDC_A1_SOURCE is defined.

We seem have the following in libc.a:

Symbols from libc.a[wcsftime.o]:
__wcsftime_std      |         0|extern|entry  |$CODE$
_wcsftime           |       252|extern|entry  |$CODE$
wcsftime            |       252|sdef  |entry  |$CODE$
__wcsftime_std      |          |undef |code   |

Dave


-- 


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


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