public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/28081] New: Undue compile-time error for zero-sized substring
@ 2006-06-19 11:39 fxcoudert at gcc dot gnu dot org
2006-06-19 11:52 ` [Bug fortran/28081] " fxcoudert at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-06-19 11:39 UTC (permalink / raw)
To: gcc-bugs
The following error should not happen:
$ cat substr_3.f
implicit none
character(len=10) :: s, t
integer :: i, j
s = "abcdefghij"
t(:10) = s(1:)
s(16:15) = "foo"
if (s /= t) call abort
end
$ gfortran substr_3.f
In file substr_3.f:9
s(16:15) = "foo"
1
Error: Substring end index at (1) is out of bounds
--
Summary: Undue compile-time error for zero-sized substring
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: fxcoudert at gcc dot gnu dot org
ReportedBy: fxcoudert at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28081
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/28081] Undue compile-time error for zero-sized substring
2006-06-19 11:39 [Bug fortran/28081] New: Undue compile-time error for zero-sized substring fxcoudert at gcc dot gnu dot org
@ 2006-06-19 11:52 ` fxcoudert at gcc dot gnu dot org
2006-06-24 18:24 ` fxcoudert at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-06-19 11:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from fxcoudert at gcc dot gnu dot org 2006-06-19 11:39 -------
Here is a patch that fixes this problem (and gives a slightly better, IMHO,
error message):
Index: resolve.c
===================================================================
--- resolve.c (revision 114721)
+++ resolve.c (working copy)
@@ -2542,7 +2542,9 @@
return FAILURE;
}
- if (compare_bound_int (ref->u.ss.start, 1) == CMP_LT)
+ if (compare_bound_int (ref->u.ss.start, 1) == CMP_LT
+ && (compare_bound (ref->u.ss.end, ref->u.ss.start) == CMP_EQ
+ || compare_bound (ref->u.ss.end, ref->u.ss.start) == CMP_GT))
{
gfc_error ("Substring start index at %L is less than one",
&ref->u.ss.start->where);
@@ -2570,9 +2572,11 @@
}
if (ref->u.ss.length != NULL
- && compare_bound (ref->u.ss.end, ref->u.ss.length->length) == CMP_GT)
+ && compare_bound (ref->u.ss.end, ref->u.ss.length->length) == CMP_GT
+ && (compare_bound (ref->u.ss.end, ref->u.ss.start) == CMP_EQ
+ || compare_bound (ref->u.ss.end, ref->u.ss.start) == CMP_GT))
{
- gfc_error ("Substring end index at %L is out of bounds",
+ gfc_error ("Substring end index at %L exceeds the string length",
&ref->u.ss.start->where);
return FAILURE;
}
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Keywords| |patch
Known to fail| |4.2.0 4.1.2
Last reconfirmed|0000-00-00 00:00:00 |2006-06-19 11:39:33
date| |
Target Milestone|--- |4.1.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28081
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/28081] Undue compile-time error for zero-sized substring
2006-06-19 11:39 [Bug fortran/28081] New: Undue compile-time error for zero-sized substring fxcoudert at gcc dot gnu dot org
2006-06-19 11:52 ` [Bug fortran/28081] " fxcoudert at gcc dot gnu dot org
@ 2006-06-24 18:24 ` fxcoudert at gcc dot gnu dot org
2006-07-02 21:17 ` [Bug fortran/28081] [4.1 only] " fxcoudert at gcc dot gnu dot org
2006-07-02 21:23 ` [Bug fortran/28081] " fxcoudert at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-06-24 18:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from fxcoudert at gcc dot gnu dot org 2006-06-24 18:10 -------
Subject: Bug 28081
Author: fxcoudert
Date: Sat Jun 24 18:10:47 2006
New Revision: 114972
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114972
Log:
PR fortran/28081
* resolve.c (resolve_substring): Don't issue out-of-bounds
error messages when the range has zero size.
* gfortran.dg/substr_3.f: New test.
* gfortran.dg/equiv_2.f90: Update expected error message.
Added:
trunk/gcc/testsuite/gfortran.dg/substr_3.f
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/equiv_2.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28081
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/28081] [4.1 only] Undue compile-time error for zero-sized substring
2006-06-19 11:39 [Bug fortran/28081] New: Undue compile-time error for zero-sized substring fxcoudert at gcc dot gnu dot org
2006-06-19 11:52 ` [Bug fortran/28081] " fxcoudert at gcc dot gnu dot org
2006-06-24 18:24 ` fxcoudert at gcc dot gnu dot org
@ 2006-07-02 21:17 ` fxcoudert at gcc dot gnu dot org
2006-07-02 21:23 ` [Bug fortran/28081] " fxcoudert at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-07-02 21:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from fxcoudert at gcc dot gnu dot org 2006-07-02 21:17 -------
Subject: Bug 28081
Author: fxcoudert
Date: Sun Jul 2 21:17:05 2006
New Revision: 115134
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115134
Log:
PR fortran/28094
* trans-intrinsic.c (gfc_conv_intrinsic_mod): Support cases where
there is no integer kind equal to the resulting real kind.
* intrinsic.c (add_functions): MODULO is not allowed as an actual
argument.
* Makefile.am: Add _mod_r10.F90 and _mod_r16.F90.
* Makefile.in: Regenerate.
* generated/_mod_r10.F90: New file.
* generated/_mod_r16.F90: New file.
PR fortran/27965
* trans-array.c (gfc_conv_ss_startstride): Correct the runtime
conditions for bounds-checking. Check for nonzero stride.
Don't check the last dimension of assumed-size arrays. Fix the
dimension displayed in the error message.
PR fortran/26801
* trans-intrinsic.c (gfc_conv_associated): Use pre and post blocks
of the scalarization expression.
* gfortran.dg/associated_4.f90: New test.
PR fortran/28081
* resolve.c (resolve_substring): Don't issue out-of-bounds
error messages when the range has zero size.
* gfortran.dg/substr_3.f: New test.
* gfortran.dg/equiv_2.f90: Update expected error message.
PR fortran/23862
* lang-specs.h (f95-cpp-input): Pass -ffree-form to f951 unless
-ffixed-form is explicitly specified.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/associated_4.f90
- copied unchanged from r114757,
trunk/gcc/testsuite/gfortran.dg/associated_4.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/substr_3.f
- copied unchanged from r114972,
trunk/gcc/testsuite/gfortran.dg/substr_3.f
branches/gcc-4_1-branch/libgfortran/generated/_mod_r10.F90
- copied unchanged from r114961, trunk/libgfortran/generated/_mod_r10.F90
branches/gcc-4_1-branch/libgfortran/generated/_mod_r16.F90
- copied unchanged from r114961, trunk/libgfortran/generated/_mod_r16.F90
Modified:
branches/gcc-4_1-branch/gcc/fortran/ChangeLog
branches/gcc-4_1-branch/gcc/fortran/intrinsic.c
branches/gcc-4_1-branch/gcc/fortran/lang-specs.h
branches/gcc-4_1-branch/gcc/fortran/resolve.c
branches/gcc-4_1-branch/gcc/fortran/trans-array.c
branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/equiv_2.f90
branches/gcc-4_1-branch/libgfortran/ChangeLog
branches/gcc-4_1-branch/libgfortran/Makefile.am
branches/gcc-4_1-branch/libgfortran/Makefile.in
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28081
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/28081] Undue compile-time error for zero-sized substring
2006-06-19 11:39 [Bug fortran/28081] New: Undue compile-time error for zero-sized substring fxcoudert at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-07-02 21:17 ` [Bug fortran/28081] [4.1 only] " fxcoudert at gcc dot gnu dot org
@ 2006-07-02 21:23 ` fxcoudert at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-07-02 21:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2006-07-02 21:23 -------
Fixed.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to fail|4.1.2 |
Known to work|4.2.0 |4.2.0 4.1.2
Resolution| |FIXED
Summary|[4.1 only] Undue compile- |Undue compile-time error for
|time error for zero-sized |zero-sized substring
|substring |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28081
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-07-02 21:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-19 11:39 [Bug fortran/28081] New: Undue compile-time error for zero-sized substring fxcoudert at gcc dot gnu dot org
2006-06-19 11:52 ` [Bug fortran/28081] " fxcoudert at gcc dot gnu dot org
2006-06-24 18:24 ` fxcoudert at gcc dot gnu dot org
2006-07-02 21:17 ` [Bug fortran/28081] [4.1 only] " fxcoudert at gcc dot gnu dot org
2006-07-02 21:23 ` [Bug fortran/28081] " fxcoudert at gcc dot gnu dot org
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).