scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

0218-initialize.c (441B)


      1 struct f {
      2 	int fd;
      3         unsigned char *buf;
      4         unsigned char unbuf[1];
      5 	unsigned char *rp;
      6 };
      7 
      8 #define stderr (&buf[2])
      9 
     10 struct f f;
     11 
     12 struct f buf[] = {
     13 	{
     14 		.fd = 0,
     15 	},
     16 	{
     17 		.fd = -1,
     18 		.buf = f.unbuf,
     19 	},
     20 	{
     21 		.fd = 2,
     22 		.buf = stderr->unbuf,
     23 		.rp = stderr->unbuf,
     24 	},
     25 };
     26 
     27 int
     28 main()
     29 {
     30 	if (buf[2].unbuf != buf[2].rp)
     31 		return 1;
     32 	if (buf[2].unbuf != buf[2].buf)
     33 		return 2;
     34 	if (buf[1].buf != f.unbuf)
     35 		return 3;
     36 	return 0;
     37 }