This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH,gfortran] Fix for PR 17941


On Sat, Jan 15, 2005 at 11:07:44AM +0000, Paul Brook wrote:
> On Friday 31 December 2004 05:57, Steve Kargl wrote:
> > The attached patch fixes PR 17941.  The attached program
> > is a test program suitable for inclusion in the gfortran
> > testsuite.
> >
> > Briefly, gfortran could not deal with spaces between an
> > uniary plus/minus sign in a complex constant.  That is,
> > "complex, parameter :: c = (-   1.0,   +  2)" would invoke
> > an error.
> 
> This is supposed to be an error. Your code is illegal in free-form source,
> and already accepted in fixed-form.
> 
> Section 4.3.1.3 "Complex type" defines a complex literal constant as a pair of 
> signed real literal constants (plus "(,)" separators).
> Section 3.2 "Low-level syntax" says that a real literal constant is a single 
> lexical token.
> Section 3.3.1 "Free source form" says that whitespace may not occur within a 
> lexical token.

Section 3.2 states (where I'm preserving the line numbers from the F2003
draft standard):

3.2       Low-level syntax
1 The low-level syntax describes the fundamental lexical tokens of a
  program unit.  Lexical tokens are
2 sequences of characters that constitute the building blocks of a
  program.  They are keywords, names,
3 literal constants other than complex literal constants, operators,
  labels, delimiters, comma, =, =>, :, ::,
4 ;, and %.

Notice the part "literal constants other than complex literal constants".
So, it appears that whitespace is permitted with a complex literal
constant because it is not a lexical token. 


Here a new patch.  Bootstrapped and regtested on i386-*-freebsd6.0.

2005-01-15  Steven G. Kargl  <kargls@comcast.net>

      PR fortran/17941
      * primary.c (match_const_complex_part): Deal with whitespace in between
      uniary sign and the number

-- 
Steve

Attachment: primary.c.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]