1 // gcc 4.9.0 introduced an invalid optimization for local weak alias symbols
2 // which drops stdout fflush from exit in musl
3 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61144
12 #define ASSERT(c) do { \
15 t_error("%s failed (errno: %s)\n", #c, strerror(errno)); \
20 char tmp
[] = "/tmp/testsuite-XXXXXX";
24 ASSERT((fd
= mkstemp(tmp
)) > 2);
25 ASSERT((pid
= fork()) >= 0);
27 ASSERT(close(1) == 0);
29 ASSERT(fwrite("x", 1, 1, stdout
) == 1);
32 ASSERT(waitpid(pid
, &status
, 0) == pid
);
33 ASSERT(WIFEXITED(status
) && WEXITSTATUS(status
) == 0);
34 ASSERT(pread(fd
, &c
, 1, 0) == 1);
36 ASSERT(unlink(tmp
) == 0);