--- layout: fc_discuss_archives title: Message 22 from Frama-C-discuss on April 2009 ---
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] operator %



Hello,

This program is intended to produce a table showing modular arithmetic,
unfortunately this program is bugged, 

analyzing it with frama-c (jessie and value analysis), I was expecting a
division by zero warning or message, but frama-c completely ignored that
fact. am I missing something ?

the program is :

void print_mod(int i, int n) {
	int ans = 0;
	if( n == 0 && i == 0 ) return;
	
	ans = i % n;
	printf( "%d mod %d == %d\n", i, n, ans );
}

int main() {
	int i, j;
	for( i = 0; i < 10; i++ )
		for(j = 0; j < 10; j++ )
			print_mod( i, j );
	return 0;
}

Regards
Omar