------- Comment #8 from kargl at gcc dot gnu dot org 2009-07-03 17:44 ------- (In reply to comment #7) > I will add that I suspect that the bug may be latent in 4.5 since I did change > the error code when I added NEWUNIT to 4.5. After we get to the bottom of it, > we need to consider backporting a fix to 4.4 since this is a regression > relative to g77 >
The -fdump-tree-original code is D.536 = lun; if ((logical(kind=4)) __builtin_expect (D.536 < 0, 0)) { _gfortran_generate_error (&open_parm.1, 5005, &"Negative unit number in I/O statement"[1]{lb: 1 sz: 1}); } if ((logical(kind=4)) __builtin_expect (D.536 > -1, 0)) { _gfortran_generate_error (&open_parm.1, 5005, &"Unit number in I/O statement too large"[1]{lb: 1 sz: 1}); } open_parm.1.common.unit = (integer(kind=4)) D.536; _gfortran_st_open (&open_parm.1); Clearly, the second if() is bogus. The dump with 4.5.0 does not contain either if() block. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40638