public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/24168] New: Problems with SPREAD and/or scalarization
@ 2005-10-02 18:00 kargl at gcc dot gnu dot org
2006-05-12 9:24 ` [Bug fortran/24168] " paul dot richard dot thomas at cea dot fr
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: kargl at gcc dot gnu dot org @ 2005-10-02 18:00 UTC (permalink / raw)
To: gcc-bugs
The following program fails to compile.
program bug
implicit none
integer, parameter :: nx=4,ny=4
real, dimension(nx,ny) :: f, g
real, dimension(nx) :: x
integer :: i
x = cshift((/ (i, i = 1, nx) /), nx/2) * 2
g = spread(x, 2, ny)
!
! x and g above (which compiles) are equivalent to f below (which doesn't).
!
f = spread(cshift((/ (i, i = 1, nx) /), nx/2) * 2, 2, ny)
end program bug
kargl[236] gfc41 -o z -static f.f90
In file f.f90:9
f = spread(cshift((/ (i, i = 1, nx) /), nx/2) * 2, 2, ny)
1
Error: Incompatible ranks 2 and 1 in assignment at (1)
-fdump-parse-tree shows
ASSIGN x(FULL) __convert_i4_r4[[(((* _gfortran_cshift0_4[[(((/1, 2, 3, 4/))
(2) ((arg not-present)))]] 2)))]]
ASSIGN g(FULL) _gfortran_spread[[((x(FULL)) (2) (4))]]
ASSIGN f(FULL) _gfortran_spread[[(((* _gfortran_cshift0_4[[(((/1, 2, 3, 4/))
(2) ((arg not-present)))]] 2)) (2) (4))]]
which suggests that the scalarization of cshift0 has set the rank to 2
instead of 2.
--
Summary: Problems with SPREAD and/or scalarization
Product: gcc
Version: 4.1.0
Status: NEW
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: kargl@gcc.gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24168
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/24168] Problems with SPREAD and/or scalarization
2005-10-02 18:00 [Bug fortran/24168] New: Problems with SPREAD and/or scalarization kargl at gcc dot gnu dot org
@ 2006-05-12 9:24 ` paul dot richard dot thomas at cea dot fr
2006-06-06 11:16 ` paul dot richard dot thomas at cea dot fr
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-05-12 9:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paul dot richard dot thomas at cea dot fr 2006-05-12 09:23 -------
I find this to be "surprising":
$ cat pr24168.f90;rm a.exe;/irun/bin/gfortran -fdump-tree-original pr24168.f90;
./a
program bug
implicit none
integer, parameter :: nx=2,ny=2
real, dimension(nx,ny) :: f
real, dimension(nx) :: x
integer, dimension(nx) :: p
integer :: i
x = real ((/ (i, i = 1, nx) /))
print '(A,2F4.1)', "x = ", x
print '(A,2F4.1)', "cshift( x, nx/2) * 2 = ",cshift( x, nx/2) * 2
print '(A,4F4.1)', "spread(cshift( x, nx/2) * 2, 2, ny) = ", spread(cshift( x,
nx/2) * 2, 2, ny)
end program bug
x = 1.0 2.0
cshift( x, nx/2) * 2 = 4.0 2.0
spread(cshift( x, nx/2) * 2, 2, ny) = 4.0 4.0 4.0 4.0
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24168
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/24168] Problems with SPREAD and/or scalarization
2005-10-02 18:00 [Bug fortran/24168] New: Problems with SPREAD and/or scalarization kargl at gcc dot gnu dot org
2006-05-12 9:24 ` [Bug fortran/24168] " paul dot richard dot thomas at cea dot fr
@ 2006-06-06 11:16 ` paul dot richard dot thomas at cea dot fr
2006-06-07 7:21 ` pault at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-06-06 11:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paul dot richard dot thomas at cea dot fr 2006-06-06 10:26 -------
Created an attachment (id=11607)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11607&action=view)
Patch and testcase for the PR
The problem lay in simplification of the binary expression because the rank of
the operands was not transferred.
I will submit tonight.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24168
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/24168] Problems with SPREAD and/or scalarization
2005-10-02 18:00 [Bug fortran/24168] New: Problems with SPREAD and/or scalarization kargl at gcc dot gnu dot org
2006-05-12 9:24 ` [Bug fortran/24168] " paul dot richard dot thomas at cea dot fr
2006-06-06 11:16 ` paul dot richard dot thomas at cea dot fr
@ 2006-06-07 7:21 ` pault at gcc dot gnu dot org
2006-06-11 22:33 ` pault at gcc dot gnu dot org
2006-06-11 22:37 ` pault at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-07 7:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pault at gcc dot gnu dot org 2006-06-07 07:20 -------
Subject: Bug 24168
Author: pault
Date: Wed Jun 7 07:20:39 2006
New Revision: 114461
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114461
Log:
2006-06-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/23091
* resolve.c (resolve_fl_variable): Error if an automatic
object has the SAVE attribute.
PR fortran/24168
* expr.c (simplify_intrinsic_op): Transfer the rank and
the locus to the simplified expression.
PR fortran/25090
PR fortran/25058
* gfortran.h : Add int entry_id to gfc_symbol.
* resolve.c : Add static variables current_entry_id and
specification_expr.
(resolve_variable): During code resolution, check if a
reference to a dummy variable in an executable expression
is preceded by its appearance as a parameter in an entry.
Likewise check its specification expressions.
(resolve_code): Update current_entry_id on EXEC_ENTRY.
(resolve_charlen, resolve_fl_variable): Set and reset
specifiaction_expr.
(is_non_constant_shape_array): Do not return on detection
of a variable but continue to resolve all the expressions.
(resolve_codes): set current_entry_id to an out of range
value.
2006-06-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/23091
* gfortran.dg/saved_automatic_1.f90: New test.
PR fortran/24168
* gfortran.dg/array_simplify_1.f90: New test.
PR fortran/25090
* gfortran.dg/entry_dummy_ref_1.f90: New test.
PR fortran/25058
* gfortran.dg/entry_dummy_ref_2.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/array_simplify_1.f90
trunk/gcc/testsuite/gfortran.dg/entry_dummy_ref_1.f90
trunk/gcc/testsuite/gfortran.dg/entry_dummy_ref_2.f90
trunk/gcc/testsuite/gfortran.dg/saved_automatic_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24168
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/24168] Problems with SPREAD and/or scalarization
2005-10-02 18:00 [Bug fortran/24168] New: Problems with SPREAD and/or scalarization kargl at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-06-07 7:21 ` pault at gcc dot gnu dot org
@ 2006-06-11 22:33 ` pault at gcc dot gnu dot org
2006-06-11 22:37 ` pault at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-11 22:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pault at gcc dot gnu dot org 2006-06-11 22:32 -------
Subject: Bug 24168
Author: pault
Date: Sun Jun 11 22:32:26 2006
New Revision: 114551
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114551
Log:
2006-06-12 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24558
PR fortran/20877
PR fortran/25047
* decl.c (get_proc_name): Add new argument to flag that a
module function entry is being treated. If true, correct
error condition, add symtree to module namespace and add
a module procedure.
(gfc_match_function_decl, gfc_match_entry,
gfc_match_subroutine): Use the new argument in calls to
get_proc_name.
* resolve.c (resolve_entries): ENTRY symbol reference to
to master entry namespace if a module function.
* trans-decl.c (gfc_create_module_variable): Return if
the symbol is an entry.
PR fortran/23091
* resolve.c (resolve_fl_variable): Error if an automatic
object has the SAVE attribute.
PR fortran/24168
* expr.c (simplify_intrinsic_op): Transfer the rank and
the locus to the simplified expression.
PR fortran/25090
PR fortran/25058
* gfortran.h : Add int entry_id to gfc_symbol.
* resolve.c : Add static variables current_entry_id and
specification_expr.
(resolve_variable): During code resolution, check if a
reference to a dummy variable in an executable expression
is preceded by its appearance as a parameter in an entry.
Likewise check its specification expressions.
(resolve_code): Update current_entry_id on EXEC_ENTRY.
(resolve_charlen, resolve_fl_variable): Set and reset
specifiaction_expr.
(is_non_constant_shape_array): Do not return on detection
of a variable but continue to resolve all the expressions.
(resolve_codes): set current_entry_id to an out of range
value.
2006-06-12 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24558
* gfortran.dg/entry_6.f90: New test.
PR fortran/20877
PR fortran/25047
* gfortran.dg/entry_7.f90: New test.
PR fortran/23091
* gfortran.dg/saved_automatic_1.f90: New test.
PR fortran/24168
* gfortran.dg/array_simplify_1.f90: New test.
PR fortran/25090
* gfortran.dg/entry_dummy_ref_1.f90: New test.
PR fortran/25058
* gfortran.dg/entry_dummy_ref_2.f90: New test.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/array_simplify_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/entry_6.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/entry_7.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/entry_dummy_ref_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/entry_dummy_ref_2.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/saved_automatic_1.f90
Modified:
branches/gcc-4_1-branch/gcc/fortran/ChangeLog
branches/gcc-4_1-branch/gcc/fortran/decl.c
branches/gcc-4_1-branch/gcc/fortran/expr.c
branches/gcc-4_1-branch/gcc/fortran/gfortran.h
branches/gcc-4_1-branch/gcc/fortran/resolve.c
branches/gcc-4_1-branch/gcc/fortran/trans-decl.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24168
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/24168] Problems with SPREAD and/or scalarization
2005-10-02 18:00 [Bug fortran/24168] New: Problems with SPREAD and/or scalarization kargl at gcc dot gnu dot org
` (3 preceding siblings ...)
2006-06-11 22:33 ` pault at gcc dot gnu dot org
@ 2006-06-11 22:37 ` pault at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-11 22:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pault at gcc dot gnu dot org 2006-06-11 22:36 -------
Cracked 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=24168
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-06-11 22:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-02 18:00 [Bug fortran/24168] New: Problems with SPREAD and/or scalarization kargl at gcc dot gnu dot org
2006-05-12 9:24 ` [Bug fortran/24168] " paul dot richard dot thomas at cea dot fr
2006-06-06 11:16 ` paul dot richard dot thomas at cea dot fr
2006-06-07 7:21 ` pault at gcc dot gnu dot org
2006-06-11 22:33 ` pault at gcc dot gnu dot org
2006-06-11 22:37 ` 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).