public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99205] New: [10/11 Regression] Out of memory with undefined character length
@ 2021-02-22 16:58 gscfq@t-online.de
2021-02-23 8:22 ` [Bug fortran/99205] " rguenth at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2021-02-22 16:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99205
Bug ID: 99205
Summary: [10/11 Regression] Out of memory with undefined
character length
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: gscfq@t-online.de
Target Milestone: ---
This changed between 20190728 and 20190811 :
$ cat z1.f90
program p
character(l) :: c(2)
data c /'a', 'b'/
common c
end
$ gfortran-11-20210221 -c z1.f90
z1.f90:2:13:
2 | character(l) :: c(2)
| 1
Error: Variable 'l' cannot appear in the expression at (1)
z1.f90:2:23:
2 | character(l) :: c(2)
| 1
Error: 'c' at (1) must have constant character length in this context
f951: out of memory allocating 137707388940 bytes after a total of 458752 bytes
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99205] [10/11 Regression] Out of memory with undefined character length
2021-02-22 16:58 [Bug fortran/99205] New: [10/11 Regression] Out of memory with undefined character length gscfq@t-online.de
@ 2021-02-23 8:22 ` rguenth at gcc dot gnu.org
2021-03-08 21:29 ` anlauf at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-02-23 8:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99205
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |10.3
Keywords| |memory-hog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99205] [10/11 Regression] Out of memory with undefined character length
2021-02-22 16:58 [Bug fortran/99205] New: [10/11 Regression] Out of memory with undefined character length gscfq@t-online.de
2021-02-23 8:22 ` [Bug fortran/99205] " rguenth at gcc dot gnu.org
@ 2021-03-08 21:29 ` anlauf at gcc dot gnu.org
2021-03-08 22:34 ` anlauf at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-03-08 21:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99205
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-03-08
Status|UNCONFIRMED |NEW
Known to work| |9.3.1
Known to fail| |10.2.1, 11.0
Ever confirmed|0 |1
--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.
gcc-9 gave:
pr99205.f90:2:12:
2 | character(l) :: c(2)
| 1
Error: Variable 'l' cannot appear in the expression at (1)
pr99205.f90:2:22:
2 | character(l) :: c(2)
| 1
Error: 'c' at (1) must have constant character length in this context
pr99205.f90:3:16:
3 | data c /'a', 'b'/
| 1
Warning: Initialization string at (1) was truncated to fit the variable (0/1)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99205] [10/11 Regression] Out of memory with undefined character length
2021-02-22 16:58 [Bug fortran/99205] New: [10/11 Regression] Out of memory with undefined character length gscfq@t-online.de
2021-02-23 8:22 ` [Bug fortran/99205] " rguenth at gcc dot gnu.org
2021-03-08 21:29 ` anlauf at gcc dot gnu.org
@ 2021-03-08 22:34 ` anlauf at gcc dot gnu.org
2021-03-09 19:46 ` anlauf at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-03-08 22:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99205
--- Comment #2 from anlauf at gcc dot gnu.org ---
This fixes the testcase and passes regtesting:
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index 25e97930169..71e2552025d 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -595,6 +595,9 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue,
mpz_t index,
/* An initializer has to be constant. */
if (lvalue->ts.u.cl->length == NULL && !(ref && ref->u.ss.length !=
NULL))
return false;
+ if (lvalue->ts.u.cl->length
+ && lvalue->ts.u.cl->length->expr_type != EXPR_CONSTANT)
+ return false;
expr = create_character_initializer (init, last_ts, ref, rvalue);
if (!expr)
return false;
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99205] [10/11 Regression] Out of memory with undefined character length
2021-02-22 16:58 [Bug fortran/99205] New: [10/11 Regression] Out of memory with undefined character length gscfq@t-online.de
` (2 preceding siblings ...)
2021-03-08 22:34 ` anlauf at gcc dot gnu.org
@ 2021-03-09 19:46 ` anlauf at gcc dot gnu.org
2021-03-10 22:01 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-03-09 19:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99205
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
Status|NEW |ASSIGNED
CC| |anlauf at gcc dot gnu.org
--- Comment #3 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2021-March/055782.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99205] [10/11 Regression] Out of memory with undefined character length
2021-02-22 16:58 [Bug fortran/99205] New: [10/11 Regression] Out of memory with undefined character length gscfq@t-online.de
` (3 preceding siblings ...)
2021-03-09 19:46 ` anlauf at gcc dot gnu.org
@ 2021-03-10 22:01 ` cvs-commit at gcc dot gnu.org
2021-03-19 18:19 ` cvs-commit at gcc dot gnu.org
2021-03-19 18:20 ` anlauf at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-10 22:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99205
--- Comment #4 from CVS 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:8c21bc6646dbe3365d7f89843a79eee823aa3b52
commit r11-7614-g8c21bc6646dbe3365d7f89843a79eee823aa3b52
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Mar 10 22:59:50 2021 +0100
PR fortran/99205 - Out of memory with undefined character length
A character variable appearing as a data statement object cannot
be automatic, thus it shall have constant length.
gcc/fortran/ChangeLog:
PR fortran/99205
* data.c (gfc_assign_data_value): Reject non-constant character
length for lvalue.
* trans-array.c (gfc_conv_array_initializer): Restrict loop to
elements which are defined to avoid NULL pointer dereference.
gcc/testsuite/ChangeLog:
PR fortran/99205
* gfortran.dg/data_char_4.f90: New test.
* gfortran.dg/data_char_5.f90: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99205] [10/11 Regression] Out of memory with undefined character length
2021-02-22 16:58 [Bug fortran/99205] New: [10/11 Regression] Out of memory with undefined character length gscfq@t-online.de
` (4 preceding siblings ...)
2021-03-10 22:01 ` cvs-commit at gcc dot gnu.org
@ 2021-03-19 18:19 ` cvs-commit at gcc dot gnu.org
2021-03-19 18:20 ` anlauf at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-19 18:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99205
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:d6faf78a88151eee32a79cdfb7b38399318724fa
commit r10-9460-gd6faf78a88151eee32a79cdfb7b38399318724fa
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Mar 10 22:59:50 2021 +0100
PR fortran/99205 - Out of memory with undefined character length
A character variable appearing as a data statement object cannot
be automatic, thus it shall have constant length.
gcc/fortran/ChangeLog:
PR fortran/99205
* data.c (gfc_assign_data_value): Reject non-constant character
length for lvalue.
* trans-array.c (gfc_conv_array_initializer): Restrict loop to
elements which are defined to avoid NULL pointer dereference.
gcc/testsuite/ChangeLog:
PR fortran/99205
* gfortran.dg/data_char_4.f90: New test.
* gfortran.dg/data_char_5.f90: New test.
(cherry picked from commit 8c21bc6646dbe3365d7f89843a79eee823aa3b52)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99205] [10/11 Regression] Out of memory with undefined character length
2021-02-22 16:58 [Bug fortran/99205] New: [10/11 Regression] Out of memory with undefined character length gscfq@t-online.de
` (5 preceding siblings ...)
2021-03-19 18:19 ` cvs-commit at gcc dot gnu.org
@ 2021-03-19 18:20 ` anlauf at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-03-19 18:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99205
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from anlauf at gcc dot gnu.org ---
Fixed on master for gcc-11, and on 10-branch.
Thanks for the report!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-03-19 18:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 16:58 [Bug fortran/99205] New: [10/11 Regression] Out of memory with undefined character length gscfq@t-online.de
2021-02-23 8:22 ` [Bug fortran/99205] " rguenth at gcc dot gnu.org
2021-03-08 21:29 ` anlauf at gcc dot gnu.org
2021-03-08 22:34 ` anlauf at gcc dot gnu.org
2021-03-09 19:46 ` anlauf at gcc dot gnu.org
2021-03-10 22:01 ` cvs-commit at gcc dot gnu.org
2021-03-19 18:19 ` cvs-commit at gcc dot gnu.org
2021-03-19 18:20 ` 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).