public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/58009] New: Elements with same value in vector subscript in variable definition context
@ 2013-07-28 9:55 tkoenig at gcc dot gnu.org
2013-07-28 10:23 ` [Bug fortran/58009] " dominiq at lps dot ens.fr
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-07-28 9:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58009
Bug ID: 58009
Summary: Elements with same value in vector subscript in
variable definition context
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
The following is illegal:
program main
real, dimension(4) :: a,b
read (*,*) a
b([1,2,3,2]) = a
print *,b
end
See F 2008, 6.5.3.3.2:
If a vector subscript has two or more elements with the same value, an array
section with that vector subscript
shall not appear in a variable definition context (16.6.7)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/58009] Elements with same value in vector subscript in variable definition context
2013-07-28 9:55 [Bug fortran/58009] New: Elements with same value in vector subscript in variable definition context tkoenig at gcc dot gnu.org
@ 2013-07-28 10:23 ` dominiq at lps dot ens.fr
2013-07-28 11:25 ` burnus at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-07-28 10:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58009
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-07-28
Ever confirmed|0 |1
--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> ... and it would be nice to diagnose it (with a hard
> error) whenever possible.
Indeed! I can think of an O(N**2) algorithm with a scalar temporary or an O(N)
one with an O(N) temporary. Do you have better ideas?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/58009] Elements with same value in vector subscript in variable definition context
2013-07-28 9:55 [Bug fortran/58009] New: Elements with same value in vector subscript in variable definition context tkoenig at gcc dot gnu.org
2013-07-28 10:23 ` [Bug fortran/58009] " dominiq at lps dot ens.fr
@ 2013-07-28 11:25 ` burnus at gcc dot gnu.org
2013-07-28 12:38 ` tkoenig at gcc dot gnu.org
2013-07-28 21:16 ` tkoenig at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-28 11:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58009
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #3)
> a([i,j,i]) = ...
> for which I cannot think of an algorithm which is O(n),
> so I guess it will have to be O(n**2).
Given that most code has either no or only very few vector subscripts, it
shouldn't matter too much.
Additionally, I expect that one either has only very few elements - or one uses
A([array]) which is not compile-time checkable.
The only case where one might have a lot of elements in the vector is in
generated code - but that looks as a very, very special case for which one does
not need to performance optimize, I'd guess.
Side note: I tried your example with NAG f95 5.1 (of 2007) - and it does not
detect the issue - neither at compile nor at runtime (-C=all).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/58009] Elements with same value in vector subscript in variable definition context
2013-07-28 9:55 [Bug fortran/58009] New: Elements with same value in vector subscript in variable definition context tkoenig at gcc dot gnu.org
2013-07-28 10:23 ` [Bug fortran/58009] " dominiq at lps dot ens.fr
2013-07-28 11:25 ` burnus at gcc dot gnu.org
@ 2013-07-28 12:38 ` tkoenig at gcc dot gnu.org
2013-07-28 21:16 ` tkoenig at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-07-28 12:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58009
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |tkoenig at gcc dot gnu.org
--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I have a patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/58009] Elements with same value in vector subscript in variable definition context
2013-07-28 9:55 [Bug fortran/58009] New: Elements with same value in vector subscript in variable definition context tkoenig at gcc dot gnu.org
` (2 preceding siblings ...)
2013-07-28 12:38 ` tkoenig at gcc dot gnu.org
@ 2013-07-28 21:16 ` tkoenig at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-07-28 21:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58009
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Sun Jul 28 21:10:23 2013
New Revision: 201294
URL: http://gcc.gnu.org/viewcvs?rev=201294&root=gcc&view=rev
Log:
2013-07-28 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/58009
* expr.c (gfc_check_vardef_context): Check for same values in
vector expression subscripts.
2013-07-28 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/58009
* gfortran.dg/vector_subsript_7.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/vector_subscript_7.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-28 21:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-28 9:55 [Bug fortran/58009] New: Elements with same value in vector subscript in variable definition context tkoenig at gcc dot gnu.org
2013-07-28 10:23 ` [Bug fortran/58009] " dominiq at lps dot ens.fr
2013-07-28 11:25 ` burnus at gcc dot gnu.org
2013-07-28 12:38 ` tkoenig at gcc dot gnu.org
2013-07-28 21:16 ` tkoenig at gcc dot gnu.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).