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)

Reply via email to