[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] (EXTENDED-CSMITH) --output command line error .



Sameeran, if you're going to try to work in programming, you'll have to learn how to find your own bugs. I mean, this is code YOU wrote.

Here's your pull request: https://github.com/csmith-project/csmith/pull/61
I found it by googling "csmith github" and then clicking on the "Pull requests" tab.

Then I click on "Files changed" and type Ctrl+F ABOVEE to search in the page.
https://github.com/csmith-project/csmith/pull/61/files#diff-90b1b7a24cd655d85a46e3432ac57ccdR844
There's your bug.
cout << "/*\nNUMBER OF GOTO'S IN ABOVEE BLOCK:" << addr_labels.size() << "*\/";

You asked why this was printing to cout instead of out? It's because you wrote the code that way.
If you want the code to do something different, you will have to WRITE DIFFERENT CODE.

–Arthur


On Fri, Jan 4, 2019 at 1:45 PM sameeran joshi <gsocsameeran@gmail.com> wrote:
Hi,
Pardon:(  I didn't understand sir, what you meant by "error is obvious ".

We have implemented in the code base of csmith the extension for
computed-goto as :

EXPECTED:
AFTER USING :
$ ./csmith --computed-goto > filename.c

  {
  /*BLOCK 2 */
/*
NUMBER OF GOTO'S IN ABOVEE BLOCK:1*/
  void *target[] = { &&lbl_3919};
     ......statements
     ......statements
     ......statements
     ......statements
  lbl_3919:
     ......statements
  goto *target[0];
     ......statements
     ......statements
     ......statements
  }


ACTUAL (error code):
AFTER USING :
$ ./csmith --computed-goto --output filename.c
$  /*
NUMBER OF GOTO'S IN ABOVEE BLOCK:1*/
  void *target[] = { &&lbl_3919};

  {
  /*BLOCK 2 */
//THIS STATEMENT IS PRINTED ON TERMINAL when used with --output.
     ......statements
     ......statements
     ......statements
     ......statements
  lbl_3919:
     ......statements
  goto *target[0];
     ......statements
     ......statements
     ......statements
  }

The above error causes when using --output and not when redirecting it
directly into a file.




On 1/4/19, John Regehr <regehr@cs.utah.edu> wrote:
> Hi Sameeran, this is a defect in your pull request that must be fixed.
> Just look for "ABOVEE" in your code and the error is obvious.
>
> John
>
>
> On 1/4/19 8:01 AM, sameeran joshi wrote:
>> Hi,
>> We modified the script for finding the coverage for old and extended
>> csmith.
>>
>> 1.It randomly chooses one of the extensions from a set of all
>> implemented extensions ,generates program based on above extension.
>> 2.Uses same seed from above program but generates another program
>> without extension.
>> 3.We compile both programs using 2 different compiler sources, built
>> with --enable-coverage .
>>
>> repeat above steps for some 10,000 programs
>> (so that may be 20% be of one kind of extension, another 25% of some
>> other kind , and so on.... for all extensions which we implemented)
>>
>> 4.find coverage using lcov at end for both the compiler built sources
>> files and find the gain .
>>
>> I am facing a strange problem for csmith , where
>>      if I use  --output as command line which is supposed to simply
>> redirect the output to some file, it's redirecting the extension's
>> code, to terminal .And the *target[] is not
>> present in the filename.c. Which causes compilation errors.
>>
>> This code is for the --computed-goto extension which we submitted on
>> github as a pull request.
>>
>> The same error occurs for another extensions as well when we use
>> --output , where as when we try redirecting using '>' operator the
>> same error didn't occur.
>>
>> ERROR HERE:
>> $ ./csmith --computed-goto --output filename.c
>>
>> Following is output on terminal , which was supposed to be in
>> file,which causes compilation errors
>> /*
>> NUMBER OF GOTO'S IN ABOVEE BLOCK:1*/
>> void *target[] = { &&lbl_3919};
>> /*
>> NUMBER OF GOTO'S IN ABOVEE BLOCK:1*/
>> void *target[] = { &&lbl_3102};
>>
>> THIS WORKS FINE:
>>
>> $ ./csmith --computed-goto > filename.c
>> ~/workspace/csmith/src$
>>
>> How do I find why is it outputing such to STDOUT?
>>
>> Thanks,
>> Sameeran Joshi
>>
>