This is the mail archive of the 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, fortran] Simplify constant substrings

On Friday 22 July 2005 18:29, David Edelsohn wrote:
> >>>>> Steven Bosscher writes:
> Steven> In a number of places we add an extra '\0' at the end of the string
> Steven> value for debugging purposes.  That would mean for your patch, if
> we Steven> want to be consistent with, well, everywhere else in gfortran,
> that Steven> you'd have to add the extra '\0' too:
> Steven> However, Paul dislikes the idea of the extra '\0'.  I think that if
> Steven> we are going to drop it here, then we should drop it everywhere
> else Steven> too.  But I actually think the extra '\0' is useful because it
> allows Steven> you to print value.character.string from gdb.
> Steven> Thoughs, anyone?
> 	I was trying to follow the implementation in
> data.c:create_character_initializer().  That function does not appear to
Nice catch.  That 'i' seems to be missing in data.c :-)

> append a NULL terminator to the string, although
> primary.c:match_string_constant() does.

Hm.  I don't feel strong either way, but it'd be nice if we are at
least consistent, i.e. end with a '\0' everywhere, or nowhere.  But
we can deal with this later.

> 	My patch does need to allocate an extra byte if the string should
> have a NULL terminator.  "start--" sets the correct beginning of the C
> zero-based array of characters relative to Fortran one-based numbering.
> "end-start" is the length of the active Fortran string without the NULL
> terminator.  Position "end" is never referenced directly.  For example,
> Fortran string str(3:10) begins at C array value.character.string[2] and
> has length 10-2=8.  Or did I misunderstand the Fortran internals?

Nope, your understanding is correct.


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