0

I am new to Frama-c and quite new to programming in general. I installed Frama-C on my Mac. I am using OSX. From the Command Line I enter Frama-C-Gui which opens fine at which time I select "New Project" Frama-C GUI then adding a new Project

I navigate through my files and then select my VERY simple .C file however when I select it I receive an error saying:

"Frama-C aborter: invalid user input. Reverting to previous state. Look at the console for additional information (if any)."

Frama-C Gui with error message

My file is very simple and just the loop below:

for (int j=-100;j<=100;j++){i=j;
    while (i!=0){i=i+2; x=x-5; y=y-y/x;}}

Any assistance on how to be able to run files here successfully would be very appreciated!

Jens
  • 69,818
  • 15
  • 125
  • 179
  • 1
    That is neither a complete C program, nor even a complete C function. What do you expect frama-c to do with it? Make sure it compiles without any warnings before you check it. – Jens Apr 04 '18 at 18:33
  • I have been given 17 similar loops and been instructed to perform -val analysis on them using Frama-c to test loop termination. Perhaps there needs to be a larger encompassing file for this loop that would allow it to run successfully? – Lukas Bell Apr 04 '18 at 18:45
  • These loops are incomplete and useless, since for example the one you gave does not even have initializations for variables x and y. Just so we know your C skills: on a scale from 0 (never wrote hello world) to 10 (I won the IOCCC), what is your C expertise? – Jens Apr 04 '18 at 19:42
  • Definitely a 0. Programming wise I have some Java & HTML experience and understand programming basics and concepts however I am certainly not a developer and have never worked with C. – Lukas Bell Apr 04 '18 at 19:54
  • 1
    The error message in the screenshot says: "Look at the console for additional information (if any)". This means the *Console* tab in the GUI. If you click on it, it should contain a more descriptive error message. Also, if you are starting using Frama-C/EVA ("-val analysis"), I recommend this post from the Frama-C blog, which should help with the initial setup: http://blog.frama-c.com/index.php?post/2017/03/07/A-simple-EVA-tutorial – anol Apr 05 '18 at 06:41
  • 1
    (Although, as Jens remarked, using Frama-C does require some knowledge of C, it will not help you learn the basics of the language, and it is not very user-friendly for complete C beginners.) – anol Apr 05 '18 at 07:02

1 Answers1

2

Maybe a complete C program gets you further. For the given loop, save this in foo.c preferably with a lower case .c.

int main(void) {
    int i, x = 0, y = 0;

    for (int j = -100; j <= 100; j++) {
         i = j;
         while (i != 0) {
              i = i + 2;
              x = x - 5;
              y = y - y / x;
         }
    }
    return 0;
}
Jens
  • 69,818
  • 15
  • 125
  • 179