Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > 82156e51e136cf1c3e3b0cfb61ec2f5a > files > 80

ocaml-cil-doc-1.3.7-5.fc13.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>

<META http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<META name="GENERATOR" content="hevea 1.10">

<base target="main">
<script language="JavaScript">
<!-- Begin
function loadTop(url) {
  parent.location.href= url;
}
// -->
</script>
<LINK rel="stylesheet" type="text/css" href="cil.css">
<TITLE>Known Bugs and Limitations</TITLE>
</HEAD>
<BODY >
<A HREF="cil011.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
<A HREF="ciltoc.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
<A HREF="merger.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
<HR>
<H2 CLASS="section"><A NAME="htoc43">12</A>&#XA0;&#XA0;Known Bugs and Limitations</H2><H3 CLASS="subsection"><A NAME="toc29"></A><A NAME="htoc44">12.1</A>&#XA0;&#XA0;Code that CIL won&#X2019;t compile</H3><UL CLASS="itemize"><LI CLASS="li-itemize">
We do not support tri-graph sequences (ISO 5.2.1.1).</LI><LI CLASS="li-itemize">CIL cannot parse arbitrary <TT>#pragma</TT> directives. Their
syntax must follow gcc&#X2019;s attribute syntax to be understood. If you
need a pragma that does not follow gcc syntax, add that pragma&#X2019;s name
to <TT>no_parse_pragma</TT> in <TT>src/frontc/clexer.mll</TT> to indicate that
CIL should treat that pragma as a monolithic string rather than try
to parse its arguments.<P>CIL cannot parse a line containing an empty <TT>#pragma</TT>.</P></LI><LI CLASS="li-itemize">CIL only parses <TT>#pragma</TT> directives at the "top level", this is,
outside of any enum, structure, union, or function definitions.<P>If your compiler uses pragmas in places other than the top-level,
you may have to preprocess the sources in a special way (sed, perl,
etc.) to remove pragmas from these locations.</P></LI><LI CLASS="li-itemize">CIL cannot parse the following code (fixing this problem would require
extensive hacking of the LALR grammar):
<PRE CLASS="verbatim"><FONT COLOR=blue>int bar(int ()); // This prototype cannot be parsed
int bar(int x()); // If you add a name to the function, it works
int bar(int (*)()); // This also works (and it is more appropriate)
</FONT></PRE></LI><LI CLASS="li-itemize">CIL also cannot parse certain K&amp;R old-style prototypes with missing
return type:
<PRE CLASS="verbatim"><FONT COLOR=blue>g(); // This cannot be parsed
int g(); // This is Ok
</FONT></PRE></LI><LI CLASS="li-itemize">CIL does not understand some obscure combinations of type
specifiers (&#X201C;signed&#X201D; and &#X201C;unsigned&#X201D; applied to typedefs that
themselves contain a sign specification; you could argue that this
should not be allowed anyway):
<PRE CLASS="verbatim"><FONT COLOR=blue>typedef signed char __s8;
__s8 unsigned uchartest; // This is unsigned char for gcc
</FONT></PRE></LI><LI CLASS="li-itemize">CIL does not support constant-folding of floating-point values,
because it is difficult to simulate the behavior of various
C floating-point implementations in Ocaml. Therefore, code such as
this will not compile:
<PRE CLASS="verbatim"><FONT COLOR=blue>int globalArray[(1.0 &lt; 2.0) ? 5 : 50]
</FONT></PRE></LI><LI CLASS="li-itemize">CIL uses Ocaml ints to represent the size of an object.
Therefore, it can&#X2019;t compute the size of any object that is larger
than 2<SUP>30</SUP> bits (134 MB) on 32-bit computers, or 2<SUP>62</SUP> bits on
64-bit computers.</LI></UL><H3 CLASS="subsection"><A NAME="toc30"></A><A NAME="htoc45">12.2</A>&#XA0;&#XA0;Code that behaves differently under CIL</H3><UL CLASS="itemize"><LI CLASS="li-itemize">
GCC has a strange feature called &#X201C;extern inline&#X201D;. Such a function can
be defined twice: first with the &#X201C;extern inline&#X201D; specifier and the second
time without it. If optimizations are turned off then the &#X201C;extern inline&#X201D;
definition is considered a prototype (its body is ignored). <P>With old versions of gcc, if optimizations
are turned on then the extern inline function is inlined at all of its
occurrences from the point of its definition all the way to the point where the
(optional) second definition appears. No body is generated for an extern
inline function. A body is generated for the real definition and that one is
used in the rest of the file. </P><P>With new versions of gcc, the extern inline function is used only if there is no
actual (non-extern) second definition (i.e. the second definition is used in the
whole file, even for calls between the extern inline definition and the second
definition).</P><P>By default, CIL follows the current gcc behavior for extern
inline. However, if you set <TT>oldstyleExternInline</TT> to true, you will
get an emulation of gcc&#X2019;s old behaviour (under the assumption that
optimizations are enabled): CIL will rename your extern inline
function (and its uses) with the suffix <TT>__extinline</TT>. This means
that if you have two such definition, that do different things and the
optimizations are not on, then the CIL version might compute a
different answer! Also, if you have multiple extern inline
declarations then CIL will ignore but the first one. This is not so
bad because GCC itself would not like it.</P></LI><LI CLASS="li-itemize">The implementation of <TT>bitsSizeOf</TT> does not take into account the
packing pragmas. However it was tested to be accurate on cygwin/gcc-2.95.3,
Linux/gcc-2.95.3 and on Windows/MSVC.</LI><LI CLASS="li-itemize"><TT>-malign-double</TT> is ignored.</LI><LI CLASS="li-itemize">The statement <TT>x = 3 + x ++</TT> will perform the increment of <TT>x</TT>
before the assignment, while <TT>gcc</TT> delays the increment after the
assignment. It turned out that this behavior is much easier to implement
than gcc&#X2019;s one, and either way is correct (since the behavior is unspecified
in this case). Similarly, if you write <TT>x = x ++;</TT> then CIL will perform
the increment before the assignment, whereas GCC and MSVC will perform it
after the assignment. </LI><LI CLASS="li-itemize">Because CIL uses 64-bit floating point numbers in its internal
representation of floating point numbers, <TT>long double</TT> constants
are parsed as if they were <TT>double</TT> constants.</LI></UL><H3 CLASS="subsection"><A NAME="toc31"></A><A NAME="htoc46">12.3</A>&#XA0;&#XA0;Effects of the CIL translation</H3><UL CLASS="itemize"><LI CLASS="li-itemize">
CIL cleans up C code in various ways that may suppress compiler
warnings. For example, CIL will add casts where they are needed
while <TT>gcc</TT> might print a warning for the missing cast. It is
not a goal of CIL to emit such warnings &#X2014; we support several
versions of several different compilers, and mimicking the warnings
of each is simply not possible. If you want to see compiler
warnings, compile your program with your favorite compiler before
using CIL.</LI><LI CLASS="li-itemize">When you use variable-length arrays, CIL turns them into calls
to <TT>alloca</TT>. This means that they are deallocated when the
function returns and not when the local scope ends.<P>Variable-length arrays are not supported as fields of a struct or union.</P></LI><LI CLASS="li-itemize">In the new versions of <TT>glibc</TT> there is a function
<TT>__builtin_va_arg</TT> that takes a type as its second argument. CIL
handles that through a slight trick. As it parses the function it changes a
call like:
<PRE CLASS="verbatim">  mytype x = __builtin_va_arg(marker, mytype)
</PRE>into 
<PRE CLASS="verbatim"> mytype x;
 __builtin_va_arg(marker, sizeof(mytype), &amp;x);
</PRE><P>The latter form is used internally in CIL. However, the CIL pretty printer
will try to emit the original code. </P><P>Similarly, <TT>__builtin_types_compatible_p(t1, t2)</TT>, which takes
types as arguments, is represented internally as
<TT>__builtin_types_compatible_p(sizeof t1, sizeof t2)</TT>, but the
sizeofs are removed when printing.</P></LI></UL><HR>
<A HREF="cil011.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
<A HREF="ciltoc.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
<A HREF="merger.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>