Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/gcc.c-torture/execute/920810-1.c @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 #include <stdio.h> |
2 #include <string.h> | |
3 #include <stdlib.h> | |
4 | |
5 typedef struct{void*super;int name;int size;}t; | |
6 t*f(t*clas,int size) | |
7 { | |
8 t*child=(t*)malloc(size); | |
9 memcpy(child,clas,clas->size); | |
10 child->super=clas; | |
11 child->name=0; | |
12 child->size=size; | |
13 return child; | |
14 } | |
15 main() | |
16 { | |
17 t foo,*bar; | |
18 memset(&foo,37,sizeof(t)); | |
19 foo.size=sizeof(t); | |
20 bar=f(&foo,sizeof(t)); | |
21 if(bar->super!=&foo||bar->name!=0||bar->size!=sizeof(t))abort(); | |
22 exit(0); | |
23 } |