<span style="font-family:arial, sans-serif;font-size:13px;background-color:rgb(255, 255, 255)">I convert C to bytecode by LLVM, and then convert the bytecode back to C by LLC, but the generated C code cannot be compiled. Could anyone give me some suggestions? Thanks!<div>


<br></div><div>The initial C file is rather simple (hello world): </div><div><br></div><div><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">#include <stdio.h></p>


<p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">int main() {</p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">


<span>        </span>printf("hello world\n");</p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt"><span>        </span>printf("hello world1\n");</p>


<p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt"><span>        </span>return 0;</p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">


}</p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt"><br></p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">


The two commands:</p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in"><font face="Calibri"><span style="font-size:15px">llvm-gcc -emit-llvm -c -o hello.bc hello.c</span></font></p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in">


<font face="Calibri"><span style="font-size:15px">llc -march=c hello.bc</span></font></p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in"><font face="Calibri"><span style="font-size:15px">Version of LLVM: 2.9</span></font></p>


<p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in"><font face="Calibri"><span style="font-size:15px"><br></span></font></p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in">


<font face="Calibri"><span style="font-size:15px">The source of error in generated c file:</span></font></p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in"><font face="Calibri"><span style="font-size:15px"></span></font></p>


<p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt"><font face="Calibri">/* Global Variable Declarations */</font></p><font face="Calibri"><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">


static _OC_str { unsigned char array[12]; };</p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">static _OC_str1 { unsigned char array[13]; };</p>
<p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt"> </p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">


<br></p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">/* Global Variable Definitions and Initialization */</p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">


static _OC_str { unsigned char array[12]; } = { "hello world" };</p><p style="margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:0in;font-family:Calibri;font-size:11pt">static _OC_str1 { unsigned char array[13]; } = { "hello world1" };</p>


</font><p></p><div><br></div><div>It seems that _OC_str, and _OC_str1 are structure variables, but I have never seen such way of declarations, definitions, and initialization of structure in C code. I guess it may be supported in some standards of C. Could anyone please give me some information about the problem? Thanks!</div>


<div><br>--<br>Best Regards,<br>Fei Jia</div></div><div><br></div></span>