Frama-C Bug Tracking System

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002304Frama-CPlug-in > E-ACSLpublic2017-05-29 13:462017-12-06 09:10
Reporterevdenis 
Assigned Tosignoles 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionFrama-C 14-Silicon 
Target VersionFixed in VersionFrama-C 16-Sulfur 
Summary0002304: E-ACSL: compilation fail: generated functions doesn't have static inline attributes
DescriptionThe absence of static inline attributes forces optional dependencies to be strict. This leads to undefined reference errors during compilation.

Test (inline.c):
extern int do_mmap(int *a);

static inline int test_extern(int *a) // Static inline
{
   return do_mmap(a);
}

int main(void)
{
   return 0;
}

GCC Run:
$ gcc ./inline.c # There is no error about do_mmap
$ echo $?
0

Generated Code (inline_generated.c):
...
/*@ assigns \result, *a;
    assigns \result \from *a;
    assigns *a \from *a; */
int __gen_e_acsl_do_mmap(int *a);
...
__inline static int test_extern(int *a)
{
  int tmp;
  /*@ behavior pre_do_mmap:
        assigns tmp, *a;
        assigns tmp \from *a;
        assigns *a \from *a;
  */
  tmp = __gen_e_acsl_do_mmap(a);
  return tmp;
}
...
/*@ assigns \result, *a;
    assigns \result \from *a;
    assigns *a \from *a; */
int __gen_e_acsl_do_mmap(int *a) // <== ERROR
{
  int __retres;
  __retres = do_mmap(a);
  return __retres;
}

GCC Run:
$ gcc ./inline_generated.c
/tmp/cczBUd0r.o: In function `__gen_e_acsl_do_mmap':
inline_generated.c:(.text+0x24): undefined reference to `do_mmap'
collect2: error: ld returned 1 exit status
Steps To Reproduceframa-c -e-acsl-prepare -rte -rte-precond ./inline.c -then -e-acsl -then-last -print > inline_generated.c
gcc inline_generated.c
Additional InformationQuickfix:
diff --git a/dup_functions.ml b/dup_functions.ml
index 5774115..3b25fde 100644
--- a/dup_functions.ml
+++ b/dup_functions.ml
@@ -197,6 +197,8 @@ let dup_global loc old_prj spec bhv kf vi new_vi =
   let name = vi.vname in
   Options.feedback ~dkey ~level:2 "entering in function %s" name;
   let fundec = dup_fundec loc spec bhv kf vi new_vi in
+ fundec.svar.vinline <- true;
+ fundec.svar.vstorage <- Static;
   let fct = Definition(fundec, loc) in
   let new_spec = fundec.sspec in
   let new_kf = { fundec = fct; spec = new_spec } in
TagsNo tags attached.
Attached Filesc file icon inline.c [^] (126 bytes) 2017-05-29 13:46 [Show Content]
patch file icon inline.patch [^] (540 bytes) 2017-05-29 13:47 [Show Content]

- Relationships

-  Notes
(0006468)
signoles (manager)
2017-10-25 15:38

Thanks for having reported this issue. It is solved in the current dev version.

- Issue History
Date Modified Username Field Change
2017-05-29 13:46 evdenis New Issue
2017-05-29 13:46 evdenis Status new => assigned
2017-05-29 13:46 evdenis Assigned To => signoles
2017-05-29 13:46 evdenis File Added: inline.c
2017-05-29 13:47 evdenis File Added: inline.patch
2017-05-29 14:33 signoles Assigned To signoles => kvorobyov
2017-10-24 17:42 signoles Assigned To kvorobyov => signoles
2017-10-25 15:38 signoles Note Added: 0006468
2017-10-25 15:38 signoles Status assigned => resolved
2017-10-25 15:38 signoles Fixed in Version => Frama-C 16-Sulfur
2017-10-25 15:38 signoles Resolution open => fixed
2017-12-06 09:10 signoles Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker