public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
@ 2024-03-25 19:27 anlauf at gcc dot gnu.org
2024-03-25 19:28 ` [Bug fortran/114474] " anlauf at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-25 19:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
Bug ID: 114474
Summary: [11/12/13/14 Regression] DATA statement with derived
type, pointer component rejected
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
While working on pr50410, I noticed that the following code works with
gfortran <= 9.5.0, but fails with 10.5.0 and higher:
program p
implicit none
integer, target :: zz = 42 ! initial data target
type t
integer, pointer :: h
end type t
type(t) :: x, y
data x / t(null()) / ! OK
data y / t(zz) / ! fails starting with gcc-10
if (associated (y% h)) print *, y% h
end
This works with NAG and older gfortran and prints "42".
Current mainline gives:
pr50410_ctor.f90:9:13:
9 | data y / t(zz) / ! fails starting with gcc-10
| 1
Error: The element in the structure constructor at (1), for pointer component
'h', is PROCEDURE but should be INTEGER
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/114474] [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
@ 2024-03-25 19:28 ` anlauf at gcc dot gnu.org
2024-03-25 20:55 ` anlauf at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-25 19:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Known to fail| |10.5.0, 11.4.1, 12.3.1,
| |13.2.1, 14.0
Priority|P3 |P4
Known to work| |7.5.0, 8.5.0, 9.5.0
Target Milestone|--- |11.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/114474] [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
2024-03-25 19:28 ` [Bug fortran/114474] " anlauf at gcc dot gnu.org
@ 2024-03-25 20:55 ` anlauf at gcc dot gnu.org
2024-03-26 21:29 ` anlauf at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-25 20:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
--- Comment #1 from anlauf at gcc dot gnu.org ---
Might have been caused by the fix for pr67804 (r10-10418).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/114474] [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
2024-03-25 19:28 ` [Bug fortran/114474] " anlauf at gcc dot gnu.org
2024-03-25 20:55 ` anlauf at gcc dot gnu.org
@ 2024-03-26 21:29 ` anlauf at gcc dot gnu.org
2024-03-27 20:43 ` anlauf at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-26 21:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
--- Comment #2 from anlauf at gcc dot gnu.org ---
Created attachment 57817
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57817&action=edit
Draft patch
This adds a fixup of the expression type of the actual argument of the
DT constructor which is often set to BT_PROCEDURE in match_actual_arg.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/114474] [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
` (2 preceding siblings ...)
2024-03-26 21:29 ` anlauf at gcc dot gnu.org
@ 2024-03-27 20:43 ` anlauf at gcc dot gnu.org
2024-03-28 17:44 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-27 20:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-03-27
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
--- Comment #3 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2024-March/060381.html
This is a much tighter restricted fix of the regression.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/114474] [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
` (3 preceding siblings ...)
2024-03-27 20:43 ` anlauf at gcc dot gnu.org
@ 2024-03-28 17:44 ` cvs-commit at gcc dot gnu.org
2024-04-07 18:10 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-28 17:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:bbb7c513dddc5c9b2d5e9b78bc1c2f85a0cfe07e
commit r14-9712-gbbb7c513dddc5c9b2d5e9b78bc1c2f85a0cfe07e
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Mar 27 21:18:04 2024 +0100
Fortran: fix DATA and derived types with pointer components [PR114474]
When matching actual arguments in match_actual_arg, these are initially
treated as a possible dummy procedure, assuming that the correct type is
determined later. This resolution could fail when the procedure is a
derived type constructor with a pointer component and appears in a DATA
statement, where the pointer shall be associated with an initial data
target. Check for those cases where the type obviously has not been
resolved yet, and which were missed because there was no component
reference.
gcc/fortran/ChangeLog:
PR fortran/114474
* primary.cc (gfc_variable_attr): Catch variables used in structure
constructors within DATA statements that are still tagged with a
temporary type BT_PROCEDURE from match_actual_arg and which have
the
target attribute, and fix their typespec.
gcc/testsuite/ChangeLog:
PR fortran/114474
* gfortran.dg/data_pointer_3.f90: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/114474] [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
` (4 preceding siblings ...)
2024-03-28 17:44 ` cvs-commit at gcc dot gnu.org
@ 2024-04-07 18:10 ` cvs-commit at gcc dot gnu.org
2024-04-07 18:12 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-07 18:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:0d4862691d2b58f7bd2d58de0e78bc574c313d39
commit r13-8592-g0d4862691d2b58f7bd2d58de0e78bc574c313d39
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Mar 27 21:18:04 2024 +0100
Fortran: fix DATA and derived types with pointer components [PR114474]
When matching actual arguments in match_actual_arg, these are initially
treated as a possible dummy procedure, assuming that the correct type is
determined later. This resolution could fail when the procedure is a
derived type constructor with a pointer component and appears in a DATA
statement, where the pointer shall be associated with an initial data
target. Check for those cases where the type obviously has not been
resolved yet, and which were missed because there was no component
reference.
gcc/fortran/ChangeLog:
PR fortran/114474
* primary.cc (gfc_variable_attr): Catch variables used in structure
constructors within DATA statements that are still tagged with a
temporary type BT_PROCEDURE from match_actual_arg and which have
the
target attribute, and fix their typespec.
gcc/testsuite/ChangeLog:
PR fortran/114474
* gfortran.dg/data_pointer_3.f90: New test.
(cherry picked from commit bbb7c513dddc5c9b2d5e9b78bc1c2f85a0cfe07e)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/114474] [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
` (5 preceding siblings ...)
2024-04-07 18:10 ` cvs-commit at gcc dot gnu.org
@ 2024-04-07 18:12 ` cvs-commit at gcc dot gnu.org
2024-04-07 18:13 ` cvs-commit at gcc dot gnu.org
2024-04-07 18:14 ` anlauf at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-07 18:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:88abe04de2f16f773126f3908632a27568330cc9
commit r12-10314-g88abe04de2f16f773126f3908632a27568330cc9
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Mar 27 21:18:04 2024 +0100
Fortran: fix DATA and derived types with pointer components [PR114474]
When matching actual arguments in match_actual_arg, these are initially
treated as a possible dummy procedure, assuming that the correct type is
determined later. This resolution could fail when the procedure is a
derived type constructor with a pointer component and appears in a DATA
statement, where the pointer shall be associated with an initial data
target. Check for those cases where the type obviously has not been
resolved yet, and which were missed because there was no component
reference.
gcc/fortran/ChangeLog:
PR fortran/114474
* primary.cc (gfc_variable_attr): Catch variables used in structure
constructors within DATA statements that are still tagged with a
temporary type BT_PROCEDURE from match_actual_arg and which have
the
target attribute, and fix their typespec.
gcc/testsuite/ChangeLog:
PR fortran/114474
* gfortran.dg/data_pointer_3.f90: New test.
(cherry picked from commit bbb7c513dddc5c9b2d5e9b78bc1c2f85a0cfe07e)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/114474] [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
` (6 preceding siblings ...)
2024-04-07 18:12 ` cvs-commit at gcc dot gnu.org
@ 2024-04-07 18:13 ` cvs-commit at gcc dot gnu.org
2024-04-07 18:14 ` anlauf at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-07 18:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:619fc13043c86d616ef57cb31f8ac5d29b059ade
commit r11-11311-g619fc13043c86d616ef57cb31f8ac5d29b059ade
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Mar 27 21:18:04 2024 +0100
Fortran: fix DATA and derived types with pointer components [PR114474]
When matching actual arguments in match_actual_arg, these are initially
treated as a possible dummy procedure, assuming that the correct type is
determined later. This resolution could fail when the procedure is a
derived type constructor with a pointer component and appears in a DATA
statement, where the pointer shall be associated with an initial data
target. Check for those cases where the type obviously has not been
resolved yet, and which were missed because there was no component
reference.
gcc/fortran/ChangeLog:
PR fortran/114474
* primary.c (gfc_variable_attr): Catch variables used in structure
constructors within DATA statements that are still tagged with a
temporary type BT_PROCEDURE from match_actual_arg and which have
the
target attribute, and fix their typespec.
gcc/testsuite/ChangeLog:
PR fortran/114474
* gfortran.dg/data_pointer_3.f90: New test.
(cherry picked from commit bbb7c513dddc5c9b2d5e9b78bc1c2f85a0cfe07e)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/114474] [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
` (7 preceding siblings ...)
2024-04-07 18:13 ` cvs-commit at gcc dot gnu.org
@ 2024-04-07 18:14 ` anlauf at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-04-07 18:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from anlauf at gcc dot gnu.org ---
Backported to all open branches. Closing.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-04-07 18:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-25 19:27 [Bug fortran/114474] New: [11/12/13/14 Regression] DATA statement with derived type, pointer component rejected anlauf at gcc dot gnu.org
2024-03-25 19:28 ` [Bug fortran/114474] " anlauf at gcc dot gnu.org
2024-03-25 20:55 ` anlauf at gcc dot gnu.org
2024-03-26 21:29 ` anlauf at gcc dot gnu.org
2024-03-27 20:43 ` anlauf at gcc dot gnu.org
2024-03-28 17:44 ` cvs-commit at gcc dot gnu.org
2024-04-07 18:10 ` cvs-commit at gcc dot gnu.org
2024-04-07 18:12 ` cvs-commit at gcc dot gnu.org
2024-04-07 18:13 ` cvs-commit at gcc dot gnu.org
2024-04-07 18:14 ` anlauf 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).