[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-25 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org
 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #9 from Paul Thomas  ---
Closed as blindingly obvious on 9-, 10- and 11-branches.

Thanks for the fix, Steve.

Paul

[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

--- Comment #8 from CVS Commits  ---
The releases/gcc-9 branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:504159b44da4adbea75047da0ad06c6d4223caec

commit r9-9202-g504159b44da4adbea75047da0ad06c6d4223caec
Author: Paul Thomas 
Date:   Mon Jan 25 10:27:51 2021 +

Fortran: Fix deferred character lengths in array constructors [PR98517].

2021-01-25  Steve Kargl  

gcc/fortran
PR fortran/98517
* resolve.c (resolve_charlen): Check that length expression is
present before testing for scalar/integer..

gcc/testsuite/
PR fortran/98517
* gfortran.dg/charlen_18.f90 : New test.

(cherry picked from commit c6b0e33febbf73abfcc2bb0e28f0b62afe3b0f2a)

[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

--- Comment #7 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:039ac05206397227b68436cd1572ac667820c915

commit r10-9297-g039ac05206397227b68436cd1572ac667820c915
Author: Paul Thomas 
Date:   Mon Jan 25 10:27:51 2021 +

Fortran: Fix deferred character lengths in array constructors [PR98517].

2021-01-25  Steve Kargl  

gcc/fortran
PR fortran/98517
* resolve.c (resolve_charlen): Check that length expression is
present before testing for scalar/integer..

gcc/testsuite/
PR fortran/98517
* gfortran.dg/charlen_18.f90 : New test.

(cherry picked from commit c6b0e33febbf73abfcc2bb0e28f0b62afe3b0f2a)

[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:c6b0e33febbf73abfcc2bb0e28f0b62afe3b0f2a

commit r11-6887-gc6b0e33febbf73abfcc2bb0e28f0b62afe3b0f2a
Author: Paul Thomas 
Date:   Mon Jan 25 10:27:51 2021 +

Fortran: Fix deferred character lengths in array constructors [PR98517].

2021-01-25  Steve Kargl  

gcc/fortran
PR fortran/98517
* resolve.c (resolve_charlen): Check that length expression is
present before testing for scalar/integer..

gcc/testsuite/
PR fortran/98517
* gfortran.dg/charlen_18.f90 : New test.

[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-05 Thread emr-gnu at hev dot psu.edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

--- Comment #5 from Eric Reischer  ---
Sorry, that meant to say, "I can confirm the attached patch resolves the
crash".

Thanks :-)

[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-05 Thread sgk at troutmask dot apl.washington.edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

--- Comment #4 from Steve Kargl  ---
On Tue, Jan 05, 2021 at 09:19:51PM +, emr-gnu at hev dot psu.edu wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517
> 
> --- Comment #3 from Eric Reischer  ---
> Confirm the attached patch resolves the crash.

Of course, it resolves the ICE.  I wouldn't have posted it, otherwise. :-)

>  I have not checked, however, if the generated code is correct.

Given that the code only contains declaration statements, the
generated code with -fdump-tree-original is correct.

% gfcg -c -fdec -fdump-tree-original a.f90
% cat a.f90.005t.original 
__attribute__((fn spec (". ")))
void test_bug ()
{

}

[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-05 Thread emr-gnu at hev dot psu.edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

--- Comment #3 from Eric Reischer  ---
Confirm the attached patch resolves the crash.  I have not checked, however, if
the generated code is correct.

[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-05 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4

[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-05 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

--- Comment #2 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 249f402b8d9..da8e3b63249 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -12437,7 +12437,8 @@ resolve_charlen (gfc_charlen *cl)
}

   /* cl->length has been resolved.  It should have an integer type.  */
-  if (cl->length->ts.type != BT_INTEGER || cl->length->rank != 0)
+  if (cl->length
+ && (cl->length->ts.type != BT_INTEGER || cl->length->rank != 0))
{
  gfc_error ("Scalar INTEGER expression expected at %L",
 >length->where);

[Bug fortran/98517] gfortran segfault on character array initialization from parameter value since r8-5900-g266404a8d62b99ab

2021-01-05 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517

Martin Liška  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-01-05
Summary|gfortran segfault on|gfortran segfault on
   |character array |character array
   |initialization from |initialization from
   |parameter value |parameter value since
   ||r8-5900-g266404a8d62b99ab
 Status|UNCONFIRMED |NEW
 CC||kargl at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška  ---
Started with r8-5900-g266404a8d62b99ab.