#131 newTempVar called outside a function

closed-fixed
nobody
None
5
2012-06-14
2012-06-11
Ed Schwartz
No

One of the gnulib tests used in coreutils triggers a CIL bug:

CC test-stdbool.o
gcc -D_GNUCC -E -MT test-stdbool.o -MD -MP -MF .deps/test-stdbool.Tpo -I. -I../lib -DIN_COREUTILS_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../lib -I./../lib -g -O2 -DCIL=1 test-stdbool.c -o ./test-stdbool.i
/home/ed/f11/decompiler-transformer/vendor/cil/1.4.0/obj/x86_LINUX/cilly.asm.exe --out ./test-stdbool.cil.c ./test-stdbool.i
test-stdbool.c:63: Bug: newTempVar called outside a function
test-stdbool.c:63: Error: doPureExp: not pure
Fatal error: exception Errormsg.Error
make[3]: *** [test-stdbool.o] Error 2

I am uploading test-stdbool.i

Discussion

  • Ed Schwartz
    Ed Schwartz
    2012-06-11

    Preprocessed trigger file

     
    Attachments
    • status: open --> closed-wont-fix
     
  • This is because CIL tries to fold the ternary operator ?: but is unable to fold floats. I added your file to the test suite.

    A work-around is to use the feature-question branch: http://github.com/kerneis/cil/commits/feature-question
    I have just rebased it against develop, and your test works in that case (with the --use-logical-operators flag). I used to be reluctant to merge it because it would change the CIL AST, breaking existing code; I might change my mind if people have a strong need for it.

     
    • status: closed-wont-fix --> closed-fixed
     
  • I merged the Question feature into develop.