~mcf/cproc

Bug report: division by zero in decl.c

Details
Message ID
<c7a795d2-c2d9-4049-a770-8854aa1e043a@gmail.com>
DKIM signature
pass
Download raw message
Hi,
there is a division by zero bug in decl.c:declarator at line 701.

	if (e->u.constant.u > ULLONG_MAX / base.type->size)
		error(&tok.loc, "array length is too large");

The bug is hidden when you compile with gcc because it replaces the 
division even when no optimization is enabled.

To reproduce the bug:

	$ make CC=clang
	$ ./cproc-qbe test/compatible-vla-types.c
	Floating point exception (core dumped)

The target is x86_64-linux-gnu and I cloned cproc from github.

Hope it helps.
Reply to thread Export thread (mbox)