public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions
@ 2008-11-20 22:57 burnus at gcc dot gnu dot org
2008-11-22 21:43 ` [Bug fortran/38205] " burnus at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-20 22:57 UTC (permalink / raw)
To: gcc-bugs
The following program fails with:
Error: transformational intrinsic 'sum' at (1) is not permitted in an
initialization expression
I think it is valid Fortran 2003 per "7.1.7 Initialization expression":
"(5) A reference to a transformational standard intrinsic function other than
NULL, where each argument is an initialization expression"
Note: Fortran 95 7.1.7.1 the program is invalid (only few transformational
functions are allowed).
Found by James Van Buskirk:
http://groups.google.com/group/comp.lang.fortran/msg/2119be02dcf93517
integer, parameter :: a = sum([1,2])
print *, a
end
--
Summary: Tranformational function SUM rejected in initialization
expressions
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
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=38205
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/38205] Tranformational function SUM rejected in initialization expressions
2008-11-20 22:57 [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions burnus at gcc dot gnu dot org
@ 2008-11-22 21:43 ` burnus at gcc dot gnu dot org
2008-11-26 12:14 ` mikael at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-22 21:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2008-11-22 21:41 -------
See also James' new c.l.f post:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/e0d04d755453a2a5
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38205
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/38205] Tranformational function SUM rejected in initialization expressions
2008-11-20 22:57 [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions burnus at gcc dot gnu dot org
2008-11-22 21:43 ` [Bug fortran/38205] " burnus at gcc dot gnu dot org
@ 2008-11-26 12:14 ` mikael at gcc dot gnu dot org
2008-11-26 12:14 ` mikael at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu dot org @ 2008-11-26 12:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from mikael at gcc dot gnu dot org 2008-11-26 12:13 -------
confirmed
--
mikael at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-11-26 12:13:31
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38205
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/38205] Tranformational function SUM rejected in initialization expressions
2008-11-20 22:57 [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions burnus at gcc dot gnu dot org
2008-11-22 21:43 ` [Bug fortran/38205] " burnus at gcc dot gnu dot org
2008-11-26 12:14 ` mikael at gcc dot gnu dot org
@ 2008-11-26 12:14 ` mikael at gcc dot gnu dot org
2008-11-26 13:51 ` burnus at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu dot org @ 2008-11-26 12:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from mikael at gcc dot gnu dot org 2008-11-26 12:13 -------
Created an attachment (id=16775)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16775&action=view)
untested fix
This is probably the way to go.
A warning should be added in some cases (didn't think much about it).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38205
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/38205] Tranformational function SUM rejected in initialization expressions
2008-11-20 22:57 [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-11-26 12:14 ` mikael at gcc dot gnu dot org
@ 2008-11-26 13:51 ` burnus at gcc dot gnu dot org
2008-11-26 16:53 ` burnus at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-26 13:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from burnus at gcc dot gnu dot org 2008-11-26 13:50 -------
I think that patch is not enough (though useful!). I think one needs to add a
gfc_simplify_sum to simplify.c and replace then the NULL by the function name
in intrinsic.c for "sum". Possibly as well for the other transformational
intrinsics which are allowed in initialization expressions.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38205
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/38205] Tranformational function SUM rejected in initialization expressions
2008-11-20 22:57 [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions burnus at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-11-26 13:51 ` burnus at gcc dot gnu dot org
@ 2008-11-26 16:53 ` burnus at gcc dot gnu dot org
2008-11-26 17:51 ` mikael at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-26 16:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from burnus at gcc dot gnu dot org 2008-11-26 16:52 -------
> I think that patch is not enough (though useful!). I think one needs to add a
> gfc_simplify_sum to simplify.c
One probably needs an auxiliary function which iterates through an array either
along a dim= (-> return a scalar) or if not present, it returns a expr->rank
sized array. To be used with PRODUCT and SUM at least. gfc_simplify_reshape
might give some idea, though that assumes that source is a rank == 1 array.
(Maybe get_expr_storage_size gives also some ideas.)
Currently not simplified are:
- ALL/ANY/COUNT
- cshift/eoshift
- dot_product/matmul
- (max|min)(loc|val) - note: (max|min)val is implemented for rank == 1 w/o dim
- pack/unpack
- spread
- transpose
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38205
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/38205] Tranformational function SUM rejected in initialization expressions
2008-11-20 22:57 [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions burnus at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-11-26 16:53 ` burnus at gcc dot gnu dot org
@ 2008-11-26 17:51 ` mikael at gcc dot gnu dot org
2008-12-09 21:54 ` dfranke at gcc dot gnu dot org
2009-03-23 19:57 ` dfranke at gcc dot gnu dot org
7 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu dot org @ 2008-11-26 17:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from mikael at gcc dot gnu dot org 2008-11-26 17:49 -------
(In reply to comment #5)
> Currently not simplified are:
> - ALL/ANY/COUNT
> - cshift/eoshift
> - dot_product/matmul
> - (max|min)(loc|val) - note: (max|min)val is implemented for rank == 1 w/o dim
> - pack/unpack
> - spread
> - transpose
>
... and sum.
Ok, I missed that. That's much more work than expected. :-(
Wouldn't there be so many gfc_simplify* in place, I would rather go for a
wrapper to call libgfortran's functions at compile time.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38205
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/38205] Tranformational function SUM rejected in initialization expressions
2008-11-20 22:57 [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions burnus at gcc dot gnu dot org
` (5 preceding siblings ...)
2008-11-26 17:51 ` mikael at gcc dot gnu dot org
@ 2008-12-09 21:54 ` dfranke at gcc dot gnu dot org
2009-03-23 19:57 ` dfranke at gcc dot gnu dot org
7 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-12-09 21:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from dfranke at gcc dot gnu dot org 2008-12-09 21:51 -------
Close as dupe of PR29962?
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38205
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/38205] Tranformational function SUM rejected in initialization expressions
2008-11-20 22:57 [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions burnus at gcc dot gnu dot org
` (6 preceding siblings ...)
2008-12-09 21:54 ` dfranke at gcc dot gnu dot org
@ 2009-03-23 19:57 ` dfranke at gcc dot gnu dot org
7 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-03-23 19:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from dfranke at gcc dot gnu dot org 2009-03-23 19:56 -------
*** This bug has been marked as a duplicate of 29962 ***
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38205
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/38205] Tranformational function SUM rejected in initialization expressions
[not found] <bug-38205-4@http.gcc.gnu.org/bugzilla/>
@ 2013-06-25 17:17 ` dominiq at lps dot ens.fr
0 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-25 17:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38205
Bug 38205 depends on bug 29962, which changed state.
Bug 29962 Summary: Initialization expressions
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29962
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-06-25 17:17 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-20 22:57 [Bug fortran/38205] New: Tranformational function SUM rejected in initialization expressions burnus at gcc dot gnu dot org
2008-11-22 21:43 ` [Bug fortran/38205] " burnus at gcc dot gnu dot org
2008-11-26 12:14 ` mikael at gcc dot gnu dot org
2008-11-26 12:14 ` mikael at gcc dot gnu dot org
2008-11-26 13:51 ` burnus at gcc dot gnu dot org
2008-11-26 16:53 ` burnus at gcc dot gnu dot org
2008-11-26 17:51 ` mikael at gcc dot gnu dot org
2008-12-09 21:54 ` dfranke at gcc dot gnu dot org
2009-03-23 19:57 ` dfranke at gcc dot gnu dot org
[not found] <bug-38205-4@http.gcc.gnu.org/bugzilla/>
2013-06-25 17:17 ` dominiq at lps dot ens.fr
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).