ckeh / vtr-verilog-to-routing

Automatically exported from code.google.com/p/vtr-verilog-to-routing
0 stars 0 forks source link

abc does not compile correctly on an ARM due to an int/char typecasting problem #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
---What steps will reproduce the problem?

1.  Compile and run "abc" on an ARM processor (this is the latest abc in
    the vtr distribution, source downloaded by svn from google code).

2.  "abc" refuses to believe that the command line is correct, no matter
    what is put on the command line, and always goes straight to printing
    the usage and exiting.

---Please provide any additional information below.

This may be a problem with the Linux headers for the ARM.  However, it's true 
that the typecasting is ambiguous.  In src/base/main/main.c, line 79, 
Extra_UtilGetopt returns type "int", but "c" is type "char", and "EOF" returned 
from Extra_UtilGetopt and converted to type char is not obviously the same as 
"EOF" that it is compared to in main.c line 79.  Frankly, I think this is a 
compiler error, since it works for me on Intel platforms.  But the ambiguity is 
easily avoided by changing "c" from type "char" to type "int" at the top of 
main(), and then changing line 80 from

   switch(c) {

to

   switch((char)c) {

This change treats EOF as an int, both where it is returned from 
Extra_UtilGetopt() and where it is compared against the result in main().

   ---Tim

Original issue reported on code.google.com by rtedwar...@gmail.com on 4 Aug 2013 at 12:16

GoogleCodeExporter commented 9 years ago
Unfortunately, we do not have the manpower to support VTR in an ARM 
environment.  There is currently work done to port over the latest version of 
ABC over to VTR.  If it's fixed in that version then great, if not, then 
there's really not much we can do.

Let us know if this fix that you propose works.  If it does, then we can refer 
others to this patch if they needs to run VTR in an ARM environment.

Original comment by JasonKai...@gmail.com on 4 Aug 2013 at 12:42