public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/61138] New: Wrong code with pointer-bounds remapping
@ 2014-05-10 8:30 burnus at gcc dot gnu.org
2014-05-10 9:13 ` [Bug fortran/61138] [4.8/4.9/4.10 Regression] " dominiq at lps dot ens.fr
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-05-10 8:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
Bug ID: 61138
Summary: Wrong code with pointer-bounds remapping
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Follow up to http://gcc.gnu.org/ml/fortran/2014-05/msg00023.html
The following code should print:
6, -5
5, 6, 7, 8, 9, 10
and it does so with the Cray compiler. With GCC 4.10, however, it prints the
*whole* array:
10 -5
1 2 3 4 5 6 7 8 9 10
implicit none
integer, target :: tgt(10)
integer, target, allocatable :: tgt2(:)
integer, pointer :: ptr(:)
tgt = [1,2,3,4,5,6,7,8,9,10]
tgt2 = [1,2,3,4,5,6,7,8,9,10]
ptr(-5:) => tgt(5:) ! Okay
if (size(ptr) /= 6 .or. lbound(ptr,1) /= -5) call abort()
if (any (ptr /= [5,6,7,8,9,10])) call abort()
ptr(-5:) => tgt2(5:) ! wrongly associates the whole array
print '(*(i4))', size(ptr), lbound(ptr)
print '(*(i4))', ptr
if (size(ptr) /= 6 .or. lbound(ptr,1) /= -5) call abort()
if (any (ptr /= [5,6,7,8,9,10])) call abort()
end
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/4.10 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
@ 2014-05-10 9:13 ` dominiq at lps dot ens.fr
2014-05-13 9:55 ` rguenth at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-05-10 9:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-05-10
Summary|Wrong code with |[4.8/4.9/4.10 Regression]
|pointer-bounds remapping |Wrong code with
| |pointer-bounds remapping
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
r190619 (2012-08-23) is OK, r190641 (2012-08-24) miscompiles the test. Likely
r190641.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/4.10 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
2014-05-10 9:13 ` [Bug fortran/61138] [4.8/4.9/4.10 Regression] " dominiq at lps dot ens.fr
@ 2014-05-13 9:55 ` rguenth at gcc dot gnu.org
2014-05-22 9:06 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-13 9:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |4.8.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/4.10 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
2014-05-10 9:13 ` [Bug fortran/61138] [4.8/4.9/4.10 Regression] " dominiq at lps dot ens.fr
2014-05-13 9:55 ` rguenth at gcc dot gnu.org
@ 2014-05-22 9:06 ` rguenth at gcc dot gnu.org
2014-05-25 12:28 ` mikael at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-22 9:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.3 |4.8.4
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 4.8.3 is being released, adjusting target milestone.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/4.10 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2014-05-22 9:06 ` rguenth at gcc dot gnu.org
@ 2014-05-25 12:28 ` mikael at gcc dot gnu.org
2014-12-19 13:34 ` [Bug fortran/61138] [4.8/4.9/5 " jakub at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-05-25 12:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #2)
> gfc_trans_pointer_assignment sets lse.descriptor_only before calling
> gfc_conv_expr_descriptor (for the lhs), and later on reuses lse for other
> things, without clearing descriptor_only.
The proper fix would avoid reusing any gfc_se struct entirely;
a more humble, ad hoc fix could look like this:
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 5a50122..9748ade 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -6684,2 +6684,3 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr
* expr2)
lse.expr = tmp;
+ lse.descriptor_only = 0;
lse.direct_byref = 1;
@@ -6699,2 +6700,3 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr
* expr2)
lse.direct_byref = 1;
+ lse.descriptor_only = 0;
gfc_conv_expr_descriptor (&lse, expr2);
@@ -6750,2 +6752,3 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr
* expr2)
lse.direct_byref = 1;
+ lse.descriptor_only = 0;
gfc_conv_expr_descriptor (&lse, expr2);
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/5 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2014-05-25 12:28 ` mikael at gcc dot gnu.org
@ 2014-12-19 13:34 ` jakub at gcc dot gnu.org
2015-02-06 21:00 ` mikael at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-12-19 13:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.4 |4.8.5
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.4 has been released.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/5 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
` (4 preceding siblings ...)
2014-12-19 13:34 ` [Bug fortran/61138] [4.8/4.9/5 " jakub at gcc dot gnu.org
@ 2015-02-06 21:00 ` mikael at gcc dot gnu.org
2015-02-09 12:57 ` mikael at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-02-06 21:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
--- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #1)
> Likely r190641.
Yes
(In reply to Mikael Morin from comment #2)
> gfc_trans_pointer_assignment sets lse.descriptor_only before calling
> gfc_conv_expr_descriptor (for the lhs), and later on reuses lse for other
> things, without clearing descriptor_only.
Before r190641, gfc_conv_descriptor was not honoring lse.descriptor_only.
See https://gcc.gnu.org/ml/fortran/2012-08/msg00146.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/5 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
` (5 preceding siblings ...)
2015-02-06 21:00 ` mikael at gcc dot gnu.org
@ 2015-02-09 12:57 ` mikael at gcc dot gnu.org
2015-03-14 12:24 ` mikael at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-02-09 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
URL| |https://gcc.gnu.org/ml/gcc-
| |patches/2015-02/msg00531.ht
| |ml
Assignee|unassigned at gcc dot gnu.org |mikael at gcc dot gnu.org
--- Comment #7 from Mikael Morin <mikael at gcc dot gnu.org> ---
Patch:
https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00531.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/5 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
` (6 preceding siblings ...)
2015-02-09 12:57 ` mikael at gcc dot gnu.org
@ 2015-03-14 12:24 ` mikael at gcc dot gnu.org
2015-03-21 15:47 ` mikael at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-03-14 12:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
--- Comment #8 from Mikael Morin <mikael at gcc dot gnu.org> ---
Author: mikael
Date: Sat Mar 14 12:23:27 2015
New Revision: 221436
URL: https://gcc.gnu.org/viewcvs?rev=221436&root=gcc&view=rev
Log:
PR fortran/61138
fortran/
* trans-expr.c (gfc_trans_pointer_assignment): Clear DESCRIPTOR_ONLY
field before reusing LSE.
testsuite/
gfortran.dg/pointer_remapping_9.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/pointer_remapping_9.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/5 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
` (7 preceding siblings ...)
2015-03-14 12:24 ` mikael at gcc dot gnu.org
@ 2015-03-21 15:47 ` mikael at gcc dot gnu.org
2015-03-21 18:16 ` mikael at gcc dot gnu.org
2015-03-21 18:20 ` mikael at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-03-21 15:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
--- Comment #9 from Mikael Morin <mikael at gcc dot gnu.org> ---
Author: mikael
Date: Sat Mar 21 15:15:19 2015
New Revision: 221555
URL: https://gcc.gnu.org/viewcvs?rev=221555&root=gcc&view=rev
Log:
PR fortran/61138
fortran/
* trans-expr.c (gfc_trans_pointer_assignment): Clear DESCRIPTOR_ONLY
field before reusing LSE.
testsuite/
* gfortran.dg/pointer_remapping_9.f90: New.
Added:
branches/gcc-4_9-branch/gcc/testsuite/gfortran.dg/pointer_remapping_9.f90
Modified:
branches/gcc-4_9-branch/gcc/fortran/ChangeLog
branches/gcc-4_9-branch/gcc/fortran/trans-expr.c
branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/5 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
` (8 preceding siblings ...)
2015-03-21 15:47 ` mikael at gcc dot gnu.org
@ 2015-03-21 18:16 ` mikael at gcc dot gnu.org
2015-03-21 18:20 ` mikael at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-03-21 18:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
--- Comment #10 from Mikael Morin <mikael at gcc dot gnu.org> ---
Author: mikael
Date: Sat Mar 21 15:45:13 2015
New Revision: 221556
URL: https://gcc.gnu.org/viewcvs?rev=221556&root=gcc&view=rev
Log:
Backport from trunk:
2015-03-14 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/61138
fortran/
* trans-expr.c (gfc_trans_pointer_assignment): Clear DESCRIPTOR_ONLY
field before reusing LSE.
testsuite/
* gfortran.dg/pointer_remapping_9.f90: New.
Added:
branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/pointer_remapping_9.f90
Modified:
branches/gcc-4_8-branch/gcc/fortran/ChangeLog
branches/gcc-4_8-branch/gcc/fortran/trans-expr.c
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/61138] [4.8/4.9/5 Regression] Wrong code with pointer-bounds remapping
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
` (9 preceding siblings ...)
2015-03-21 18:16 ` mikael at gcc dot gnu.org
@ 2015-03-21 18:20 ` mikael at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-03-21 18:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61138
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #11 from Mikael Morin <mikael at gcc dot gnu.org> ---
Fixed for 4.8.5, 4.9.3 and 5.0.
Closing.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-03-21 15:47 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-10 8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
2014-05-10 9:13 ` [Bug fortran/61138] [4.8/4.9/4.10 Regression] " dominiq at lps dot ens.fr
2014-05-13 9:55 ` rguenth at gcc dot gnu.org
2014-05-22 9:06 ` rguenth at gcc dot gnu.org
2014-05-25 12:28 ` mikael at gcc dot gnu.org
2014-12-19 13:34 ` [Bug fortran/61138] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-02-06 21:00 ` mikael at gcc dot gnu.org
2015-02-09 12:57 ` mikael at gcc dot gnu.org
2015-03-14 12:24 ` mikael at gcc dot gnu.org
2015-03-21 15:47 ` mikael at gcc dot gnu.org
2015-03-21 18:16 ` mikael at gcc dot gnu.org
2015-03-21 18:20 ` mikael 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).