Frama-C Bug Tracking System - Frama-C
View Issue Details
0002417Frama-CPlug-in > E-ACSLpublic2018-12-12 15:082018-12-12 16:25
rmalak 
signoles 
normalmajoralways
confirmedopen 
x86_64Linux 4.18 OCaml 4.07.0Debian Sid
Frama-C 18-Argon 
 
0002417: Invalid label with spaghetti code and E-ACSL full mmodel
Hi, Don't know if this should go in E-ACSL or Kernel category. /////////////////// spaghetti.c int check(void) { return 0; } int main(void) { if( !check() || check() ) { goto mylabel; } mylabel: return 0; } ////////////////////////
$ frama-c spaguetti.c -e-acsl -e-acsl-full-mmodel -then-last -print -ocode spaguetti.e-acsl.c [kernel] Parsing FRAMAC_SHARE/e-acsl/e_acsl_gmp_api.h (with preprocessing) [kernel] Parsing FRAMAC_SHARE/e-acsl/e_acsl.h (with preprocessing) [kernel] Parsing spaguetti.c (with preprocessing) [e-acsl] beginning translation. [e-acsl] translation done in project "e-acsl". [kernel] User Error: Cannot find label for target of goto: _LOR: __e_acsl_store_block_duplicate((void *)(& tmp_0), (size_t)4); __e_acsl_delete_block((void *)(& tmp_0)); goto mylabel;
There is no problem in the following cases : * remove -e-acsl-full-mmodel * remove bracket * substitution "!check()" with "check()" * substitution "goto mylabel;" with "(void)0;"
No tags attached.
c spaguetti.c (136) 2018-12-12 15:08
https://bts.frama-c.com/file_download.php?file_id=1293&type=bug
Issue History
2018-12-12 15:08rmalakNew Issue
2018-12-12 15:08rmalakStatusnew => assigned
2018-12-12 15:08rmalakAssigned To => signoles
2018-12-12 15:08rmalakFile Added: spaguetti.c
2018-12-12 16:09signolesNote Added: 0006700
2018-12-12 16:09signolesStatusassigned => confirmed
2018-12-12 16:17signolesNote Added: 0006701
2018-12-12 16:21signolesNote Added: 0006702
2018-12-12 16:22signolesNote Edited: 0006701View Revisions
2018-12-12 16:25rmalakNote Added: 0006703

Notes
(0006700)
signoles   
2018-12-12 16:09   
Thank you for the precise bug report. That is definitely a bug when monitoring memory locations in presence of some "special" gotos. To myself: here is a minimal example that reproduces the bug without using -e-acsl-full-mmodel. int main(void) { if (0) { int x; if (0) _LOR: /*@ assert \valid(&x); */ ; } else goto _LOR; return 0; } $ frama-c a.c -check -e-acsl [e-acsl] beginning translation. [kernel] a.c:12: Failure: [AST Integrity Check] AST of e-acsl Statement is referenced by \at or goto without having a label: /*@ assert \valid(&x); */ { int __gen_e_acsl_valid; __gen_e_acsl_valid = __e_acsl_valid((void *)(& x),sizeof(int), (void *)(& x),(void *)0); __e_acsl_assert(__gen_e_acsl_valid,(char *)"Assertion",(char *)"main", (char *)"\\valid(&x)",6); _LOR: __e_acsl_store_block_duplicate((void *)(& x),(size_t)4); }
(0006701)
signoles   
2018-12-12 16:17   
(edited on: 2018-12-12 16:22)
Even simpler example: the crash arises when handling the local inside the block in which the goto goes back. int main(void) { { int x; _LOR: /*@ assert \valid(&x); */ ; } goto _LOR; return 0; }
(0006702)
signoles   
2018-12-12 16:21   
To rmallac: a workaround consists in moving the calls to check outside the conditional. (I know that modifying the code is not fully satisfactory, but at least it solves your issue while waiting a bug fix).
(0006703)
rmalak   
2018-12-12 16:25   
In my use-case (Contiki-NG), I changed temporary a if (!A||!B) into a if (!(A&&B)) in 2 places in the code.