Git Product home page Git Product logo

milu's People

Contributors

anonymitystudent avatar fanwuucl avatar thiagodnf avatar wetzlmaier avatar yuejia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

milu's Issues

ERROR: cannot compile original program

I was trying to run the examples provided with the scripts provided, but the console outputs the following problem:

(milu:113789): Milu-ERROR **: 20:55:45.413: Cannot compile the original program.
Trace/breakpoint trap

so i don't know how to fix it. I would apreciate help, please.

problem in core dumped

hi when in run this code
#include <stdio.h>
#include <stdlib.h>
void func()
{
int a = 5 ;
int b = 2;
int ret = 0 ;
if(a<b){
ret = a;
}
if(a>b){
ret = b;
}
printf( "Max value is : %d\n", ret );
}

void main(int argc, char** argv){
func();
exit();
}

with this statment gcc ../Desktop/c1/main.c -E && ./bin/milu --debug=dot -f func.txt ../Desktop/c1/main.c
i get this message:
1.Segmentation fault (core dumped)

Compilation error after mutation

I used Milu to create mutants for my benchmark code, namely grep.c in SIR-C. However I met compilation error when using gcc to compile the generate source code.

If you need the code that met error, contact me at [email protected], thx!

fix_function_attribute and clean_ast functions causing problems to the AST

I'm trying to generate mutants for the following source code:

#include <stdio.h>
#include <stdlib.h>

void func() {
  int a = 5 ;
  int b = 2;
  int ret = 0 ;
  
  if(a<b){
    ret = a;
  }
  if(a>b){
    ret = b;
  }
  printf( "Max value is : %d\n", ret );
}

void main(int argc, char** argv){
  func();
  exit();
}

When launching Milu with the parameter '--func-name=func', I'm obtaining a segmentation fault in the line if(g_strcmp0(func_name, tmp_node->text)==0) of the milu_project_load_function_settings function in Project.c.
In particular, gdb says the following about tmp_node->text variable:

$1 = (gchar *) 0xe <Address 0xe out of bounds>

However, if within the function 'libclang_parse_file' in ASTUnit.c I comment the 'fix_function_attribute' and the 'clean_ast' calls I get Milu to work and to correctly produce mutants.

Do you know how to fix those both functions to make work Milu correctly?
Thanks in advance,

[Bug Report] Milu prints additional ";" between *if* and *else* statements

Bug description:
When Milu generates mutants, in some special cases, Milu will insert an additional ";" symbol between paired if and else statements, causing the mutants failed being compiled.

How to recreate the bug:

  1. Write the following code to a file, say "bug.c":

include<stdlib.h>

static void func( int new_state )
{
int* arr = 0;
if ( new_state==0 )
arr = (int *) malloc( 8 );
else
arr = (int *) malloc( 16 );
}

void main(int argc, char** argv){
func(0);
}
2. Run Milu to generate mutants on "bug.c", with the default set of operators, but add option "--debug=src":
$ path\to\milu --debug=src bug.c
3. The output will be the original code being parsed and printed without any modification:

include<stdlib.h>

static void func ( int new_state )
{
int * arr = 0 ;
if ( new_state == 0 )
arr = ( int * ) malloc ( 8 ) ;
;
else arr = ( int * ) malloc ( 16 ) ;
;

}

;
void main ( int argc , char * * argv )
{
func ( 0 ) ;
}
4. There is a redundant ";" symbol between the if and the else statement. If you compile this output, the compiler will complain about 'else' without a previous 'if'.

* Temporary Solution for users:*
Put brackets around the if-statement block like this:
if ( new_state==0 )
{ arr = (int *) malloc( 8 ); }
else
arr = (int *) malloc( 16 );

Contact information missing

Hi!

We have been using Milu and we have found some bugs and have some questions about the tool/framework. Is there a way to get in contact with you, Yue Jia? We were not able to find contact information on GitHub or in any Readme file.

Regards,
Anthony Pilkjaer

[Bug Report] Missing array size expression if multiple variables are declared together

Bug description:
When multiple variables are declared at the same time, one or more are array variables, unless it's the first variable in the declaration, the array size represented by an expression will be missing in the mutants.

How to recreate the bug:

  1. Write the following code to a file, say "bug.c":

include<stdlib.h>

static void func( int x )
{
int i[4+1], arr[4+1];
if(x==0);
}

void main(int argc, char** argv){
func(0);
}
2. Run Milu to generate mutants on "bug.c", with the default set of operators, but add option "--debug=src":
$ path\to\milu --debug=src bug.c
3. The output will be the original code being parsed and printed without any modification:

include<stdlib.h>

static void func ( int x )
{
int i [ 4 + 1 ] , arr [ ];
if ( x == 0 ) ;

}

;
void main ( int argc , char * * argv )
{
func ( 0 ) ;
}
4. The array size of the second declared variable is missing.

Temporary Solution for users:
Declare array variables separately.

SIGABRT on using Milu with sqlite.c

I took sqlite3 current version (linked), created an amalgamated sqlite3.c, passed through gcc -E, and fed it into Milu as described in Readme. I added all functions in https://www.sqlite.org/c3ref/funclist.html in the func.txt, and executed below

./bin/milu -f func.txt sqlite3.c

I get SIGABRT (coredump analysis from gdb)

ERROR:src/mutation/ASTPrinter.c:1254:print_source_expr: code should not be reached

Program received signal SIGABRT, Aborted.
0x0000003482c32625 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install clang-3.4.2-4.el6.x86_64 glib2-2.28.8-4.el6.x86_64 glibc-2.12-1.166.el6_7.7.x86_64 libffi-3.0.5-3.2.el6.x86_64 libgcc-4.4.7-16.el6.x86_64 libstdc++-4.4.7-16.el6.x86_64 llvm-libs-3.4.2-4.el6.x86_64 ncurses-libs-5.7-3.20090208.el6.x86_64
(gdb) where
#0  0x0000003482c32625 in raise () from /lib64/libc.so.6
#1  0x0000003482c33e05 in abort () from /lib64/libc.so.6
#2  0x0000003484467324 in g_assertion_message () from /lib64/libglib-2.0.so.0
#3  0x0000000000407aea in print_source_expr (node=0x1a35f20, buffer=0x24fccc0, is_stmt=0) at src/mutation/ASTPrinter.c:1254
#4  0x00000000004074c5 in print_source_unexposed_expr (parent=0x1a35e40, buffer=0x24fccc0) at src/mutation/ASTPrinter.c:1042
#5  0x00000000004078c7 in print_source_expr (node=0x1a35e40, buffer=0x24fccc0, is_stmt=0) at src/mutation/ASTPrinter.c:1163
#6  0x0000000000406ae2 in print_source_call_expr (parent=0x1a355e0, buffer=0x24fccc0) at src/mutation/ASTPrinter.c:708
#7  0x0000000000408112 in print_source_stmt (node=0x1a355e0, buffer=0x24fccc0) at src/mutation/ASTPrinter.c:1405
#8  0x0000000000406c51 in print_source_compound_stmt (parent=0x1a2aea0, buffer=0x24fccc0) at src/mutation/ASTPrinter.c:749
#9  0x0000000000407022 in print_source_function_decl (parent=0x1a2ac00, buffer=0x24fccc0) at src/mutation/ASTPrinter.c:853
#10 0x000000000040590b in ASTNode_print_source (parent=0x632480, output=0x23f6a00) at src/mutation/ASTPrinter.c:125
#11 0x000000000040ccc7 in ASTUnit_print (au=0x630e80, mode=PrintSource, output=0x23f6a00) at src/mutation/ASTUnit.c:1159
#12 0x000000000040f9f1 in mutant_save (mut=0x245f800) at src/mutation/Mutant.c:132
#13 0x0000000000411b42 in mutants_save (muts=0x2688020) at src/mutation/MutantSet.c:215
#14 0x000000000040f505 in milu_multi_process_mutants (mutants=0x2688020, mfunc=0x411af5 <mutants_save>) at src/mutation/MultiProcessing.c:59
#15 0x000000000040e8eb in milu_save_mutants (mutants=0x2688020) at src/mutation/Milu3.c:81
#16 0x000000000040289b in main (argc=4, argv=0x7fffffffda58) at src/App.c:118

Environment: Centos 6.6

[Bug Report] Functions having static variables will be changed to static functions

Bug description:
When a function is declared not static but contains a static declaration of a variable, the function will be interpreted as static in mutants. This may cause compilation problems if the function is also declared somewhere else (header files for example).

How to recreate the bug:

  1. Write the following code to a file, say "bug.c":

include<stdlib.h>

void func();

void func()
{
static char c;
if(1==0);
}

void main(int argc, char** argv){
func();
}
2. Run Milu to generate mutants on "bug.c", with the default set of operators, but add option "--debug=src":
$ path\to\milu --debug=src bug.c
3. The output will be the original code being parsed and printed without any modification:

include<stdlib.h>

void func();

static void func ( )
{
static char c ;
if ( 1 == 0 ) ;

}

;
void main ( int argc , char * * argv )
{
func ( ) ;
}
4. The function 'func' is changed to static at its implementation, but the first occurrence (declaration) remains the same. If you compile the above code, the compiler will complain about inconsistent declaration.

Temporary Solution for users:
I'll be damned.

Build failure

Debian 11 (Bullseye), x86-64

$ make

gcc App.o ASTNode.o ASTNodeUtil.o ASTPrinter.o ASTUnit.o Milu3.o MultiProcessing.o Mutant.o MutantExecutor.o MutantSet.o MutationId.o MutationOperator.o MutationTemplate.o Mutator.o Options.o Project.o TestInput.o Utility.o Austin_CRCR.o Austin_OAAN.o Austin_OLLN.o Austin_OLNG.o Austin_ORRN.o CRCR.o ABS.o OAAA.o OAAN.o OBBA.o OBBN.o OCNG.o OIDO.o OLLN.o OLNG.o ORRN.o SBRC.o SSDL.o SSDL0.o UOI.o add_arithmetic_assignment_replacement.o add_arithmetic_replacement.o and_logical_negation.o and_logical_replacement.o austin_add_arithmetic_replacement.o austin_and_logical_negation.o austin_and_logical_replacement.o austin_divide_arithmetic_replacement.o austin_equal_relational_replacement.o austin_greater_equal_relational_replacement.o austin_greater_relationa_replacement.o austin_integer_constant_replacement.o austin_less_equal_relational_replacement.o austin_less_relational_replacement.o austin_modulus_arithmetic_replacement.o austin_multiply_arithmetic_replacement.o austin_not_equal_relational_replacement.o austin_or_logical_negation.o austin_or_logical_replacement.o austin_subtract_arithmetic_replacement.o bitwise_and_logical_assignment_replacement.o bitwise_and_logical_replacement.o bitwise_or_logical_assignment_replacement.o bitwise_or_logical_replacement.o divide_arithmetic_assignment_replacement.o divide_arithmetic_replacement.o equal_relational_replacement.o greater_equal_relational_replacement.o greater_relational_replacement.o if_expression_negation_replacement.o integer_constant_replacement.o less_equal_relational_replacement.o less_relational_replacement.o modulus_arithmetic_assignment_replacement.o modulus_arithmetic_replacement.o multiply_arithmetic_assignment_replacement.o multiply_arithmetic_replacement.o not_equal_relational_replacement.o or_logical_negation.o or_logical_replacement.o postfix_decrement_replacement.o postfix_increment_replacement.o prefix_decrement_replacement.o prefix_increment_replacement.o subtract_arithmetic_assignment_replacement.o subtract_arithmetic_replacement.o break_continue_replacement.o float_constant_replacement.o statement_deletion.o statement_deletion0.o integer_var_abs_insertion.o float_var_abs_insertion.o integer_var_uoi_insertion.o while_expression_negation_replacement.o -o bin/milu -O2 -l clang `/usr/bin/llvm-config --ldflags` `/usr/bin/pkg-config --libs glib-2.0` 
/usr/bin/ld: cannot open output file bin/milu: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:24: milu] Error 1

Segmentation Faults/Run Errors

When I run Milu with my uncommented source code, I get five errors that repeat that say:

(milu:2824): Parsing error-WARNING **: 12:32:09:787: Unknown: 409,

and then a segmentation fault. I have not been able to find any information on this. Can anyone help me with this?

[Bug Report] Unsupported grammar of sizeof

Bug description:
The sizeof operation in C can be in two forms: "sizeof(var)" or "sizeof var". In the latter case, Milu cannot process such code correctly but print unmatched parenthesis.

How to recreate the bug:

  1. Write the following code to a file, say "bug.c":

include<stdlib.h>

include<stdio.h>

void func()
{
void* msg;
printf("%lu\n", sizeof msg);
if(msg == 0);

}

void main(int argc, char** argv){
func();
}
2. Run Milu to generate mutants on "bug.c", with the default set of operators, but add option "--debug=src":
$ path\to\milu --debug=src bug.c
3. The output will be the original code being parsed and printed without any modification:

include<stdlib.h>

include<stdio.h>

void func ( )
{
void * msg ;
printf ( "%lu\n"
, sizeof msg )
) ;
if ( msg == 0 ) ;

}

;
void main ( int argc , char * * argv )
{
func ( ) ;
}

  1. There is an additional parenthesis after "sizeof msg" in the printf statement.

Temporary Solution for users:
Enclose the argument of sizeof in parentheses.

TCAS error Generate Mutants

I successfully used the Milu to create mutants for the example, but I met error when used Milu to create mutants for the tcas.c in SIR. i get these messages:

Milu-Message: 16:42:41.357: Higher Order Mutation Testing System v3.0
Milu-Message: 16:42:41.357: Initialize project
Milu-Message: 16:42:41.357: Project load parameters
Milu-Message: 16:42:41.357: Project Analyse AST
Milu-Message: 16:42:41.357: Libclang parse file
Milu-PF-Message: 16:42:41.377: __underflow
Milu-PF-Message: 16:42:41.377: __uflow
Milu-PF-Message: 16:42:41.377: __overflow
Milu-PF-Message: 16:42:41.377: _IO_getc
Milu-PF-Message: 16:42:41.377: _IO_putc
Milu-PF-Message: 16:42:41.377: _IO_feof
Milu-PF-Message: 16:42:41.377: _IO_ferror
Milu-PF-Message: 16:42:41.377: _IO_peekc_locked
Milu-PF-Message: 16:42:41.377: _IO_flockfile
Milu-PF-Message: 16:42:41.377: _IO_funlockfile
Milu-PF-Message: 16:42:41.377: _IO_ftrylockfile
Milu-PF-Message: 16:42:41.377: _IO_vfscanf
Segmentation fault (core dumped)

so... why this happens?

Compilation Problem

When I was trying to run the fourth step under the Compilation in Ubuntu which is the "make", I got the following errors:
/usr/bin/x86_64-linux-gnu-ld: cannot open output file bin/milu: No such file or directory
collect2: error: ld returned 1 exit status
Makefile:24: recipe for target 'milu' failed
make: *** [milu] Error 1

What does it mean?How to deal with it?
Thanks in advance.

[Bug Report] Array arguments will be parsed to "forward declaration" in a function

Bug description:
Though normally I don't write a function in this way, but the program I use for Mutation Testing study used this way:
static void func( sym, x )
char sym[];
int x;
{}
In this case, after Milu parse the code, the array argument 'sym' will be interpreted as a forward declaration but not an actual argument.

How to recreate the bug:

  1. Write the following code to a file, say "bug.c":

include<stdlib.h>

static void func( sym, x )
char sym[];
int x;
{
if(x==0);
}

void main(int argc, char** argv){
func(0, 0);
}
2. Run Milu to generate mutants on "bug.c", with the default set of operators, but add option "--debug=src":
$ path\to\milu --debug=src bug.c
3. The output will be the original code being parsed and printed without any modification:

include<stdlib.h>

static void func ( char sym [ ] ; int x )
{
if ( x == 0 ) ;

}

;
void main ( int argc , char * * argv )
{
func ( 0 , 0 ) ;
}
4. Not easy to spot, but in the function declaration of 'func', there is a ';' instead of ',' between the two arguments 'sym' and 'x', so that the first argument is interpreted as a forward declaration. This will cause the compiler to complain that the arguments don't match in any of the invocations of this function.

Temporary Solution for users:
No idea. Avoid this kind of way to declare a function maybe?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.