[Patch, fortran] PR28762 - program name 'write' causes compiler crash on if statements containing write commands.

Paul Thomas paulthomas2@wanadoo.fr
Fri Aug 18 13:38:00 GMT 2006


:ADDPATCH fortran:

This is a wierd regression.  It only occurs with 4.2 and apparently has 
been present sometime between the end of May and the present.  Comparing 
4.1 and 4.2 however, I have been unable to find the patch that caused 
it.  Stranger still is that it is not obvious to me how 4.1 is working, 
given that the fix is so obvious and that there is nothing like it in 
4.1!  Ah well...

The error occurs when program write contains a simple if that executes a 
write statement.  match_variable finds a symbol and matches the flavor 
to default, which gives the error, "Expected VARIABLE at %C".  The fix 
is to add a case for FL_PROGRAM, which returns a MATCH_NO.  Note that 
"write" could be any other keyword that starts a statement.  The 
testcase is that posted by the reporter.

Regtested on FC5/Athlon - OK for trunk and 4.1?

Paul

! { dg-do compile }
! Tests the fix for PR28762 in which the program name would cause
! the compiler to test the write statement as a variable thereby generating
! an "Expecting VARIABLE" error.
!
! Contributed by David Ham  <David@ham.dropbear.id.au>
!
program allocate
  integer :: debuglevel = 1
  integer, allocatable :: x(:)
  if (0 < debuglevel) allocate (x(10))
end program allocate


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr28762.diff
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060818/c0fb2013/attachment.bin>


More information about the Gcc-patches mailing list