diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2014-10-13 09:00:12 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2014-10-13 09:00:12 +0200 |
commit | 1915258c8b2cd2e171bbce93658047a765232bc9 (patch) | |
tree | 2f4e5d6acf77a0bc30c9816394a65f868c39a6c0 /cfrontend/PrintCsyntax.ml | |
parent | 8d2a0c12b27e82c67acc2693ecd6f1e2fede3b88 (diff) | |
download | compcert-kvx-1915258c8b2cd2e171bbce93658047a765232bc9.tar.gz compcert-kvx-1915258c8b2cd2e171bbce93658047a765232bc9.zip |
Revised translation of '&&' and '||' to Clight.
The previous translation (in SimplExpr) produced references to the
same temporary variable with two different types (bool and int),
which is not nice if we want to typecheck the generated Clight.
The new translation avoids this and also gets rid of the double
cast to bool then to int. The trick is to change Eparen
(in CompCert C expressions) to take two types: the type to which the
argument must be converted, and the type with which the resulting
expression is seen.
Diffstat (limited to 'cfrontend/PrintCsyntax.ml')
-rw-r--r-- | cfrontend/PrintCsyntax.ml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cfrontend/PrintCsyntax.ml b/cfrontend/PrintCsyntax.ml index 4e0ee7f3..e1b53af8 100644 --- a/cfrontend/PrintCsyntax.ml +++ b/cfrontend/PrintCsyntax.ml @@ -272,8 +272,8 @@ let rec expr p (prec, e) = fprintf p "%s@[<hov 1>(%a)@]" (extern_atom id) exprlist (true, args) | Ebuiltin(_, _, args, _) -> fprintf p "<unknown builtin>@[<hov 1>(%a)@]" exprlist (true, args) - | Eparen(a1, ty) -> - fprintf p "(%s) %a" (name_type ty) expr (prec', a1) + | Eparen(a1, tycast, ty) -> + fprintf p "(%s) %a" (name_type tycast) expr (prec', a1) end; if prec' < prec then fprintf p ")@]" else fprintf p "@]" |