public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tobias dot burnus at physik dot fu-berlin dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/27996] Compile time warn for:  character(2) :: str = 'ABC' (expression truncated)
Date: Fri, 23 Jun 2006 13:59:00 -0000	[thread overview]
Message-ID: <20060623130106.10205.qmail@sourceware.org> (raw)
In-Reply-To: <bug-27996-1719@http.gcc.gnu.org/bugzilla/>



------- Comment #1 from tobias dot burnus at physik dot fu-berlin dot de  2006-06-23 13:01 -------
Additional remarks (which I forget to make):

Both cases are valid Fortran as:

(1) If the length of 'variable' is less than that of 'expr', the value of
'expr' is truncated from the right until it is the same length as the
'variable'.

(2) If the length of 'variable' is greater than that of 'expr', the value of
'expr' is extended on the right with blanks until it is the same length as
the variable.

However, I still think it is useful to give a compile-time warning. This for
example should produce a warning:
----------------------------------------
program test
  character(20),parameter :: path = 'mypath/'
  character(20),parameter :: file = path // 'myfile.txt'
  print *, trim(file)
end program test
----------------------------------------
whereas using "trim(path) // 'myfile.txt'" should not.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27996


  parent reply	other threads:[~2006-06-23 13:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-12 10:25 [Bug fortran/27996] New: " tobias dot burnus at physik dot fu-berlin dot de
2006-06-13 17:26 ` [Bug fortran/27996] " pault at gcc dot gnu dot org
2006-06-23 13:59 ` tobias dot burnus at physik dot fu-berlin dot de [this message]
2006-11-29 20:01 ` patchapp at dberlin dot org
2007-01-05 14:46 ` pault at gcc dot gnu dot org
2007-01-14 14:51 ` [Bug fortran/27996] [4.2 and 4.1 only] " pault at gcc dot gnu dot org
2007-01-14 14:53 ` [Bug fortran/27996] [4.1 " pault at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060623130106.10205.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).