ICE hunting..

Janne Blomqvist jblomqvi@cc.hut.fi
Mon May 10 14:01:00 GMT 2004


On Thu, May 06, 2004 at 12:19:59PM -0700, Steve Kargl wrote:
> On Thu, May 06, 2004 at 09:52:52PM +0300, Janne Blomqvist wrote:
> Welcome aboard. 

Thanks.

> > Warning: Nonnegative width required in format string at (1)
> 
> There are two problems.  The above warning should be an error.

I haven't read the standard, is this stated as an error instead of
merely undefined behaviour? I have personally successfully compiled it
with ifort and xlf, and neither treat it as an error. Also the program
is supplied with Makefiles for a lot of compilers, so apparently most
compilers don't treat this as an error either. Of course, that is no
excuse for gfortran (or any other compiler) to treat it as a warning
if the standard explicitly says it's an error. ;-)

> The problem below is more important to understand.  Can you 
> cut xml.f90 down to a small test program?

A couple of other guys guessed that this might be
#15182. Unfortunately I have been unable to access gcc.gnu.org since
friday, so I haven't been able to check it. Somebody mentioned that
the ip address has changed, so apparently this is due to some dns
problems. I have tried with a bunch of name servers, and they either
answer that gcc.gnu.org is 12.107.209.250 (which seems stone dead) or
that it doesn't exist.

Anyway, I succeeded in making a small test program which produces the
bug. I'll check bugzilla and put the program there if it isn't already
reported as soon as I can access gcc.gnu.org again, here it is for
convenience:

! File crash.f90
program crash
  use crashmod
  IMPLICIT none
  WRITE(*,'(A)') blank
end program

! File crashmod.f90
module crashmod
  CHARACTER (LEN=20)               :: blank="                    "
end module crashmod

Now, if the declaration of the blank string is moved to the main
program, the program compiles fine. Also, if the blank string is
declared as a parameter (which implies static storage, right?) in the
module, it also works. The place where the ICE occurs is the line

assert (TREE_STATIC (decl));

apparently meaning that the compiler assumes that the blank string
should be allocated to static storage, and thus the ICE occurs when
blank isn't static.

-- 
Janne Blomqvist



More information about the Fortran mailing list