xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/2002-09-18-UnionProblem.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s  -o /dev/null
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc struct DWstruct {
5*f4a2713aSLionel Sambuc   char high, low;
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc typedef union {
9*f4a2713aSLionel Sambuc   struct DWstruct s;
10*f4a2713aSLionel Sambuc   short ll;
11*f4a2713aSLionel Sambuc } DWunion;
12*f4a2713aSLionel Sambuc 
__udivmodhi4(char n1,char bm)13*f4a2713aSLionel Sambuc short __udivmodhi4 (char n1, char bm) {
14*f4a2713aSLionel Sambuc   DWunion rr;
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc   if (bm == 0)
17*f4a2713aSLionel Sambuc     {
18*f4a2713aSLionel Sambuc       rr.s.high = n1;
19*f4a2713aSLionel Sambuc     }
20*f4a2713aSLionel Sambuc   else
21*f4a2713aSLionel Sambuc     {
22*f4a2713aSLionel Sambuc       rr.s.high = bm;
23*f4a2713aSLionel Sambuc     }
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc   return rr.ll;
26*f4a2713aSLionel Sambuc }
27