This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/50790] ICE in copy_constant on divide by expression that evaluates to zero
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 19 Oct 2011 17:54:31 +0000
- Subject: [Bug middle-end/50790] ICE in copy_constant on divide by expression that evaluates to zero
- Auto-submitted: auto-generated
- References: <bug-50790-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50790
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org 2011-10-19 17:54:31 UTC ---
Here's a variation on the original code, which removes
the print statement. One does not need to wade through
gfortran IO structure.
program test
implicit none
integer i
i = 3
call foo (3 / (i - i))
end program test
subroutine foo(j)
j = j * 1
end subroutine foo
The dump shows
foo (integer(kind=4) & restrict j)
{
*j = NON_LVALUE_EXPR <*j>;
}
test ()
{
integer(kind=4) i;
i = 3;
{
static integer(kind=4) C.1729 = 3 / 0;
foo (&C.1729);
}
}
An equivalent C program compiles and gives a nearly identical
dump, but dies with a Floating exception(?)
troutmask:sgk[247] cat dw.c
void
foo (int *j)
{
*j = *j * 2;
}
int
main()
{
static int i = 3;
i = 3 / (i - i);
foo(&i);
return 0;
}
troutmask:sgk[248] ~/work/4x/bin/gcc -o z dw.c && ./z
Floating exception (core dumped)