Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Posix / fgetln.cpp
blob68b4ad5b887d1ab99c33a3d26a800719e7c2a4fd
1 // RUN: %clangxx -O0 -g %s -o %t && %run %t
2 // fgetln is BSD-only.
3 // UNSUPPORTED: target={{.*(linux|solaris).*}}
5 #include <assert.h>
6 #include <stdio.h>
7 #include <stdlib.h>
9 int main(void) {
10 FILE *fp = fopen("/etc/hosts", "r");
11 assert(fp);
13 size_t len;
14 char *s = fgetln(fp, &len);
16 printf("%.*s\n", (int)len, s);
18 assert(!fclose(fp));
20 return 0;