This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31821] New: character pointer => target(range) should detect if lengths don't match
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 May 2007 19:10:57 -0000
- Subject: [Bug fortran/31821] New: character pointer => target(range) should detect if lengths don't match
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
character (len=4), s1
character (len=20), pointer :: p1
s1 = 'abcd'
p1 => s1(2:3)
should be rejected at compile time as len(s1(2:3)) == 2 but p1 has the length
20.
This is not detected because primary.c's match_varspec contains:
if (substring)
primary->ts.cl = NULL;
If one removes this check, the proper error:
Error: Different character lengths in pointer assignment at (1)
is shown. The solution is to resolve ts.cl->length for substrings if possible
and only set it to NULL if it is not known at compile time.
--
Summary: character pointer => target(range) should detect if
lengths don't match
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821