public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/25073] New: better diagnostic needed
@ 2005-11-26 17:55 jv244 at cam dot ac dot uk
2005-11-26 19:54 ` [Bug fortran/25073] CASEs overlap fxcoudert at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: jv244 at cam dot ac dot uk @ 2005-11-26 17:55 UTC (permalink / raw)
To: gcc-bugs
using GNU Fortran 95 (GCC) 4.1.0 20051126 (prerelease) with '-g -pedantic
-std=f95', I get a bad / no diagnostic for the following invalid code:
LOGICAL :: L
SELECT CASE(L)
CASE(.true.)
CASE(.false.)
CASE(.true.)
END SELECT
END
--
Summary: better diagnostic needed
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jv244 at cam dot ac dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
@ 2005-11-26 19:54 ` fxcoudert at gcc dot gnu dot org
2006-02-26 19:53 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-11-26 19:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from fxcoudert at gcc dot gnu dot org 2005-11-26 19:54 -------
gfortran doesn't detect that the CASEs overlap.
## g95 ##
In file foo.f90:3
CASE(.true.)
1
In file foo.f90:5
CASE(.true.)
2
Error: CASEs at (1) and (2) overlap
## Intel ##
fortcom: Error: foo.f90, line 5: This case-value or case-value-range matches a
case-value in another case-value-range within the same case-construct.
CASE(.true.)
-----^
compilation aborted for foo.f90 (code 1)
## Portland ##
PGF90-S-0310-Duplicate case value (foo.f90: 5)
0 inform, 0 warnings, 1 severes, 0 fatal for MAIN
## Sun ##
CASE(.true.)
^
"foo.f90", Line = 5, Column = 6: ERROR: The case value has the same value as a
case value on line 3.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |accepts-invalid
Last reconfirmed|0000-00-00 00:00:00 |2005-11-26 19:54:13
date| |
Summary|better diagnostic needed |CASEs overlap
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
2005-11-26 19:54 ` [Bug fortran/25073] CASEs overlap fxcoudert at gcc dot gnu dot org
@ 2006-02-26 19:53 ` pinskia at gcc dot gnu dot org
2006-04-17 19:38 ` tkoenig at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-26 19:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-02-26 19:49 -------
We do get a warning:
In file t.f90:2
SELECT CASE(L)
1
Warning: Logical SELECT CASE block at (1) has more that two cases
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
2005-11-26 19:54 ` [Bug fortran/25073] CASEs overlap fxcoudert at gcc dot gnu dot org
2006-02-26 19:53 ` pinskia at gcc dot gnu dot org
@ 2006-04-17 19:38 ` tkoenig at gcc dot gnu dot org
2006-05-05 21:47 ` [Bug fortran/25073] [missing testcase] " fxcoudert at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-17 19:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from tkoenig at gcc dot gnu dot org 2006-04-17 19:38 -------
This is now fixed on mainline and 4.1:
$ cat case.f90
program main
logical :: l
select case (l)
case (.true.)
case (.true.)
end select
end program main
$ gfortran case.f90
In file case.f90:4
case (.true.)
1
In file case.f90:5
case (.true.)
2
Error: CASE label at (1) overlaps with CASE label at (2)
$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../../gcc/trunk/configure --prefix=/home/ig25
--enable-languages=c,fortran
Thread model: posix
gcc version 4.2.0 20060412 (experimental)
All we need now is a test case, then we can close this.
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] [missing testcase] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
` (2 preceding siblings ...)
2006-04-17 19:38 ` tkoenig at gcc dot gnu dot org
@ 2006-05-05 21:47 ` fxcoudert at gcc dot gnu dot org
2006-05-08 9:49 ` fxcoudert at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-05 21:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2006-05-05 21:47 -------
I'll commit a testcase when I find some time this week-end...
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Keywords|accepts-invalid |
Last reconfirmed|2005-11-26 19:54:13 |2006-05-05 21:47:50
date| |
Summary|CASEs overlap |[missing testcase] CASEs
| |overlap
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] [missing testcase] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
` (3 preceding siblings ...)
2006-05-05 21:47 ` [Bug fortran/25073] [missing testcase] " fxcoudert at gcc dot gnu dot org
@ 2006-05-08 9:49 ` fxcoudert at gcc dot gnu dot org
2006-05-08 22:15 ` tkoenig at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-08 9:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from fxcoudert at gcc dot gnu dot org 2006-05-08 09:48 -------
Humpf, I created a testcase for inclusion in the testsuite, but it reveals that
overlap of logical cases is not detected when they're separated from each
other:
select case (l)
case (.true.)
case (.false.)
case (.true.)
end select
In this case, the overlap is not detected. The "same" code works fine with
integer or character variables, and I'm not sure why logicals are a special
case.
Thomas, can you give it a try since you designed the original patch?
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] [missing testcase] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
` (4 preceding siblings ...)
2006-05-08 9:49 ` fxcoudert at gcc dot gnu dot org
@ 2006-05-08 22:15 ` tkoenig at gcc dot gnu dot org
2006-05-31 21:10 ` [Bug fortran/25073] " tkoenig at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-05-08 22:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from tkoenig at gcc dot gnu dot org 2006-05-08 22:15 -------
> Thomas, can you give it a try since you designed the original patch?
Actually, I didn't; I completely missed the original test case,
checked this with my own (which didn't expose the error) and
then rashly concluded that this was indeed fixed. Sorry.
I'll have a look at this, though.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
` (5 preceding siblings ...)
2006-05-08 22:15 ` tkoenig at gcc dot gnu dot org
@ 2006-05-31 21:10 ` tkoenig at gcc dot gnu dot org
2006-06-22 14:27 ` paul dot richard dot thomas at cea dot fr
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-05-31 21:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from tkoenig at gcc dot gnu dot org 2006-05-31 21:10 -------
This is a real bug, and not an issue of a missing
test case.
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[missing testcase] CASEs |CASEs overlap
|overlap |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
` (6 preceding siblings ...)
2006-05-31 21:10 ` [Bug fortran/25073] " tkoenig at gcc dot gnu dot org
@ 2006-06-22 14:27 ` paul dot richard dot thomas at cea dot fr
2006-06-22 15:36 ` paul dot richard dot thomas at cea dot fr
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-06-22 14:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from paul dot richard dot thomas at cea dot fr 2006-06-22 14:25 -------
Created an attachment (id=11728)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11728&action=view)
A patch to fix the PR.
A straightforward fix in resolve.c (resolve_select).
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
` (7 preceding siblings ...)
2006-06-22 14:27 ` paul dot richard dot thomas at cea dot fr
@ 2006-06-22 15:36 ` paul dot richard dot thomas at cea dot fr
2006-06-25 15:12 ` pault at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-06-22 15:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from paul dot richard dot thomas at cea dot fr 2006-06-22 14:31 -------
> A straightforward fix in resolve.c (resolve_select).
In checking the attachment, I have just seen that the if condition can be
simplified to
if (cp->low->value.logical & seen_logical)
{
gfc_error ("constant logical value in CASE statement "
"is repeated at %L",
&cp->low->where);
t = FAILURE;
break;
}
seen_logical |= cp->low->value.logical == 0 ? 2 : 1;
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
` (8 preceding siblings ...)
2006-06-22 15:36 ` paul dot richard dot thomas at cea dot fr
@ 2006-06-25 15:12 ` pault at gcc dot gnu dot org
2006-06-25 18:10 ` pault at gcc dot gnu dot org
2006-06-25 18:12 ` pault at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-25 15:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pault at gcc dot gnu dot org 2006-06-25 15:11 -------
Subject: Bug 25073
Author: pault
Date: Sun Jun 25 15:11:02 2006
New Revision: 114987
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114987
Log:
2006-06-25 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25056
* interface.c (compare_actual_formal): Signal an error if the formal
argument is a pure procedure and the actual is not pure.
PR fortran/27554
* resolve.c (resolve_actual_arglist): If the type of procedure
passed as an actual argument is not already declared, see if it is
an intrinsic.
PR fortran/25073
* resolve.c (resolve_select): Use bits 1 and 2 of a new int to
keep track of the appearance of constant logical case expressions.
Signal an error is either value appears more than once.
PR fortran/20874
* resolve.c (resolve_fl_procedure): Signal an error if an elemental
function is not scalar valued.
PR fortran/20867
* match.c (recursive_stmt_fcn): Perform implicit typing of variables.
PR fortran/22038
* match.c (match_forall_iterator): Mark new variables as
FL_UNKNOWN if the match fails.
PR fortran/28119
* match.c (gfc_match_forall): Remove extraneous call to
gfc_match_eos.
PR fortran/25072
* resolve.c (resolve_code, resolve_function): Rework
forall_flag scheme so that it is set and has a value of
2, when the code->expr (ie. the forall mask) is resolved.
This is used to change "block" to "mask" in the non-PURE
error message.
2006-06-25 Paul Thomas <pault@gcc.gnu.org>
PR fortran/20867
* gfortran.dg/stfunc_3.f90: New test.
PR fortran/25056
* gfortran.dg/impure_actual_1.f90: New test.
PR fortran/20874
* gfortran.dg/elemental_result_1.f90: New test.
PR fortran/25073
* gfortran.dg/select_7.f90: New test.
PR fortran/27554
* intrinsic_actual_1.f: New test.
PR fortran/22038
PR fortran/28119
* gfortran.dg/forall_4.f90: New test.
PR fortran/25072
* gfortran.dg/forall_5.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/elemental_result_1.f90
trunk/gcc/testsuite/gfortran.dg/forall_4.f90
trunk/gcc/testsuite/gfortran.dg/forall_5.f90
trunk/gcc/testsuite/gfortran.dg/impure_actual_1.f90
trunk/gcc/testsuite/gfortran.dg/intrinsic_actual_1.f
trunk/gcc/testsuite/gfortran.dg/select_7.f90
trunk/gcc/testsuite/gfortran.dg/stfunc_3.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/interface.c
trunk/gcc/fortran/match.c
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
` (9 preceding siblings ...)
2006-06-25 15:12 ` pault at gcc dot gnu dot org
@ 2006-06-25 18:10 ` pault at gcc dot gnu dot org
2006-06-25 18:12 ` pault at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-25 18:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from pault at gcc dot gnu dot org 2006-06-25 18:08 -------
Subject: Bug 25073
Author: pault
Date: Sun Jun 25 18:08:13 2006
New Revision: 114994
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114994
Log:
2006-06-25 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25056
* interface.c (compare_actual_formal): Signal an error if the formal
argument is a pure procedure and the actual is not pure.
PR fortran/27554
* resolve.c (resolve_actual_arglist): If the type of procedure
passed as an actual argument is not already declared, see if it is
an intrinsic.
PR fortran/25073
* resolve.c (resolve_select): Use bits 1 and 2 of a new int to
keep track of the appearance of constant logical case expressions.
Signal an error is either value appears more than once.
PR fortran/20874
* resolve.c (resolve_fl_procedure): Signal an error if an elemental
function is not scalar valued.
PR fortran/20867
* match.c (recursive_stmt_fcn): Perform implicit typing of variables.
PR fortran/22038
* match.c (match_forall_iterator): Mark new variables as
FL_UNKNOWN if the match fails.
PR fortran/28119
* match.c (gfc_match_forall): Remove extraneous call to
gfc_match_eos.
PR fortran/25072
* resolve.c (resolve_code, resolve_function): Rework
forall_flag scheme so that it is set and has a value of
2, when the code->expr (ie. the forall mask) is resolved.
This is used to change "block" to "mask" in the non-PURE
error message.
2006-06-25 Paul Thomas <pault@gcc.gnu.org>
PR fortran/20867
* gfortran.dg/stfunc_3.f90: New test.
PR fortran/25056
* gfortran.dg/impure_actual_1.f90: New test.
PR fortran/20874
* gfortran.dg/elemental_result_1.f90: New test.
PR fortran/25073
* gfortran.dg/select_7.f90: New test.
PR fortran/27554
* intrinsic_actual_1.f: New test.
PR fortran/22038
PR fortran/28119
* gfortran.dg/forall_4.f90: New test.
PR fortran/25072
* gfortran.dg/forall_5.f90: New test.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/elemental_result_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/forall_4.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/forall_5.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/impure_actual_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/intrinsic_actual_1.f
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/select_7.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/stfunc_3.f90
Modified:
branches/gcc-4_1-branch/gcc/fortran/ChangeLog
branches/gcc-4_1-branch/gcc/fortran/interface.c
branches/gcc-4_1-branch/gcc/fortran/match.c
branches/gcc-4_1-branch/gcc/fortran/resolve.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/25073] CASEs overlap
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
` (10 preceding siblings ...)
2006-06-25 18:10 ` pault at gcc dot gnu dot org
@ 2006-06-25 18:12 ` pault at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-25 18:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from pault at gcc dot gnu dot org 2006-06-25 18:11 -------
Fixed on trunk and 4.1
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25073
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2006-06-25 18:12 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-26 17:55 [Bug fortran/25073] New: better diagnostic needed jv244 at cam dot ac dot uk
2005-11-26 19:54 ` [Bug fortran/25073] CASEs overlap fxcoudert at gcc dot gnu dot org
2006-02-26 19:53 ` pinskia at gcc dot gnu dot org
2006-04-17 19:38 ` tkoenig at gcc dot gnu dot org
2006-05-05 21:47 ` [Bug fortran/25073] [missing testcase] " fxcoudert at gcc dot gnu dot org
2006-05-08 9:49 ` fxcoudert at gcc dot gnu dot org
2006-05-08 22:15 ` tkoenig at gcc dot gnu dot org
2006-05-31 21:10 ` [Bug fortran/25073] " tkoenig at gcc dot gnu dot org
2006-06-22 14:27 ` paul dot richard dot thomas at cea dot fr
2006-06-22 15:36 ` paul dot richard dot thomas at cea dot fr
2006-06-25 15:12 ` pault at gcc dot gnu dot org
2006-06-25 18:10 ` pault at gcc dot gnu dot org
2006-06-25 18:12 ` pault 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).