[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Linux / iconv_test.c
blobeb995d21c34346c515c21b76966d1cd1d2b5ec3c
1 // RUN: %clang %s -o %t && %run %t
2 // Verify that even if iconv returned -1
3 // we still treat the initialized part of outbuf as properly initialized.
5 // UNSUPPORTED: android
7 #include <iconv.h>
8 #include <assert.h>
9 #include <stdio.h>
11 int main() {
12 iconv_t cd = iconv_open("UTF-8", "no");
13 assert(cd != (iconv_t)-1);
14 char in[11] = {0x7e, 0x7e, 0x5f, 0x53, 0x55, 0x3e,
15 0x99, 0x3c, 0x7e, 0x7e, 0x7e};
16 fprintf(stderr, "cd: %p\n", (void*)cd);
17 char out[100];
18 char *inbuf = &in[0];
19 size_t inbytesleft = 11;
20 char *outbuf = &out[0];
21 size_t outbytesleft = 100;
22 int ret = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
23 assert(ret == -1);
24 assert(outbuf - &out[0] == 10);
25 for (int i = 0; i < 10; i++) {
26 if (out[i] == 0x77) return 1;
27 fprintf(stderr, "OUT%d 0x%x -- OK\n", i, (unsigned char)out[i]);
29 iconv_close(cd);