public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error
@ 2012-01-25 10:28 bardeau at iram dot fr
  2012-01-25 11:14 ` [Bug fortran/51993] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: bardeau at iram dot fr @ 2012-01-25 10:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

             Bug #: 51993
           Summary: Erroneous type component initialization leads to
                    internal compiler error
    Classification: Unclassified
           Product: gcc
           Version: fortran-dev
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bardeau@iram.fr


The following (erroneous) code raises an internal compiler error (gfortran
4.7.0 20111119):

module mymod
  type :: mytyp
    character(len=3) :: a = .true.
  end type mytyp
end module mymod

f951: internal compiler error: in gfc_set_constant_character_len, at
fortran/decl.c:1215


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/51993] Erroneous type component initialization leads to internal compiler error
  2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
@ 2012-01-25 11:14 ` burnus at gcc dot gnu.org
  2013-02-27 15:56 ` dominiq at lps dot ens.fr
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-25 11:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid,
                   |                            |diagnostic,
                   |                            |ice-on-invalid-code
                 CC|                            |burnus at gcc dot gnu.org
            Version|fortran-dev                 |4.7.0

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-25 11:01:39 UTC ---
I can reproduce the ICE. It compiles with GCC 4.1 (without further diagnostic)
but it crashes with 4.3 to 4.7.   (If one uses the DT without specifying an
initialization, GCC 4.1 prints an error.)

There are also other variants, which crash, e.g.
  type :: mytyp
    character(len=.true.) :: a = '3'
  end type mytyp
which diagnoses the error without the initializer "= '3'".

No error but nevertheless invalid: Initialization of a scalar with an array

  type :: mytyp
    character(len=4) :: a = ['a','3']
  end type mytyp


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/51993] Erroneous type component initialization leads to internal compiler error
  2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
  2012-01-25 11:14 ` [Bug fortran/51993] " burnus at gcc dot gnu.org
@ 2013-02-27 15:56 ` dominiq at lps dot ens.fr
  2015-10-29 10:54 ` dominiq at lps dot ens.fr
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-02-27 15:56 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-02-27
     Ever Confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-02-27 15:56:31 UTC ---
It affects also 4.8.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/51993] Erroneous type component initialization leads to internal compiler error
  2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
  2012-01-25 11:14 ` [Bug fortran/51993] " burnus at gcc dot gnu.org
  2013-02-27 15:56 ` dominiq at lps dot ens.fr
@ 2015-10-29 10:54 ` dominiq at lps dot ens.fr
  2015-10-29 12:34 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-29 10:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The first test in comment 1 has been fixed between revisions r229283 (ICE) and
r229293 (Error: Scalar INTEGER expression expected at (1)), likely r229287
(pr67805).

Compiling the second test in comment 1 with 4.4.7 up to 4.7.3 gives

pr51993_2.f90:2.27:

    character(len=4) :: a = ['a','3']
                           1
Error: The rank of the element in the structure constructor at (1) does not
match that of the component (1/0)

With 4.8 up to trunk (6.0) the errors are

pr51993_2.f90:2.37:

    character(len=4) :: a = ['a','3']
                                     1
Error: Incompatible ranks 0 and 1 in assignment at (1)
pr51993_2.f90:2.37:

    character(len=4) :: a = ['a','3']
                                     1
Error: Incompatible ranks 0 and 1 in assignment at (1)
pr51993_2.f90:2.27:

    character(len=4) :: a = ['a','3']
                           1
Error: The rank of the element in the structure constructor at (1) does not
match that of the component (1/0)

The change occurred between r194897 (2013-01-04, one error) and r195140
(2013-01-14, three errors).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/51993] Erroneous type component initialization leads to internal compiler error
  2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
                   ` (2 preceding siblings ...)
  2015-10-29 10:54 ` dominiq at lps dot ens.fr
@ 2015-10-29 12:34 ` dominiq at lps dot ens.fr
  2015-10-30 17:55 ` kargl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-29 12:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Changing the gcc_assert to an early return gives ...

Confirmed with the patch

--- ../_clean/gcc/fortran/decl.c        2015-10-27 18:14:22.000000000 +0100
+++ gcc/fortran/decl.c  2015-10-29 12:02:02.000000000 +0100
@@ -1293,7 +1293,9 @@ gfc_set_constant_character_len (int len,
   int slen;

   gcc_assert (expr->expr_type == EXPR_CONSTANT);
-  gcc_assert (expr->ts.type == BT_CHARACTER);
+  /* gcc_assert (expr->ts.type == BT_CHARACTER); */
+  if (expr->ts.type != BT_CHARACTER)
+    return;

   slen = expr->value.character.length;
   if (len != slen)

No regression.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/51993] Erroneous type component initialization leads to internal compiler error
  2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
                   ` (3 preceding siblings ...)
  2015-10-29 12:34 ` dominiq at lps dot ens.fr
@ 2015-10-30 17:55 ` kargl at gcc dot gnu.org
  2015-10-30 18:14 ` kargl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-30 17:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |kargl at gcc dot gnu.org

--- Comment #6 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #5)
> > Changing the gcc_assert to an early return gives ...
> 
> Confirmed with the patch
> 
> --- ../_clean/gcc/fortran/decl.c	2015-10-27 18:14:22.000000000 +0100
> +++ gcc/fortran/decl.c	2015-10-29 12:02:02.000000000 +0100
> @@ -1293,7 +1293,9 @@ gfc_set_constant_character_len (int len,
>    int slen;
>  
>    gcc_assert (expr->expr_type == EXPR_CONSTANT);
> -  gcc_assert (expr->ts.type == BT_CHARACTER);
> +  /* gcc_assert (expr->ts.type == BT_CHARACTER); */
> +  if (expr->ts.type != BT_CHARACTER)
> +    return;
>  
>    slen = expr->value.character.length;
>    if (len != slen)
> 
> No regression.

Yep, that's the patch I was testing.  I'll submit shortly with 
a testcase.
>From gcc-bugs-return-501037-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Oct 30 17:58:19 2015
Return-Path: <gcc-bugs-return-501037-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 123047 invoked by alias); 30 Oct 2015 17:58:19 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 122994 invoked by uid 48); 30 Oct 2015 17:58:15 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/38979] OpenMP extension: THREADPRIVATE for EQUIVALENCEd symbols
Date: Fri, 30 Oct 2015 17:58:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.4.0
X-Bugzilla-Keywords: openmp
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: WAITING
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status
Message-ID: <bug-38979-4-zExYcXFgnh@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-38979-4@http.gcc.gnu.org/bugzilla/>
References: <bug-38979-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-10/txt/msg02592.txt.bz2
Content-length: 406

https://gcc.gnu.org/bugzilla/show_bug.cgi?id8979

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #11 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Any progress after six years?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/51993] Erroneous type component initialization leads to internal compiler error
  2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
                   ` (4 preceding siblings ...)
  2015-10-30 17:55 ` kargl at gcc dot gnu.org
@ 2015-10-30 18:14 ` kargl at gcc dot gnu.org
  2015-10-30 18:27 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-30 18:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

--- Comment #7 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Fri Oct 30 18:13:50 2015
New Revision: 229594

URL: https://gcc.gnu.org/viewcvs?rev=229594&root=gcc&view=rev
Log:
2015-10-15  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/51993
        * decl.c (gfc_set_constant_character_len): Convert gcc_assert into an
        if-statement causing an early return leads to valid error message.

2015-10-15  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/51993
        * gfortran.dg/pr51993.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr51993.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/51993] Erroneous type component initialization leads to internal compiler error
  2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
                   ` (5 preceding siblings ...)
  2015-10-30 18:14 ` kargl at gcc dot gnu.org
@ 2015-10-30 18:27 ` kargl at gcc dot gnu.org
  2015-10-30 18:35 ` kargl at gcc dot gnu.org
  2015-10-30 18:36 ` kargl at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-30 18:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

--- Comment #8 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Fri Oct 30 18:27:14 2015
New Revision: 229596

URL: https://gcc.gnu.org/viewcvs?rev=229596&root=gcc&view=rev
Log:
2015-10-30  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/51993
        * decl.c (gfc_set_constant_character_len): Convert gcc_assert into an
        if-statement causing an early return leads to valid error message.

2015-10-30  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/51993
        * gfortran.dg/pr51993.f90: New test.

Added:
    branches/gcc-5-branch/gcc/testsuite/gfortran.dg/pr51993.f90
Modified:
    branches/gcc-5-branch/gcc/fortran/ChangeLog
    branches/gcc-5-branch/gcc/fortran/decl.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/51993] Erroneous type component initialization leads to internal compiler error
  2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
                   ` (6 preceding siblings ...)
  2015-10-30 18:27 ` kargl at gcc dot gnu.org
@ 2015-10-30 18:35 ` kargl at gcc dot gnu.org
  2015-10-30 18:36 ` kargl at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-30 18:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.3

--- Comment #9 from kargl at gcc dot gnu.org ---
Fixed on trunk and 5-branch.  Thanks for the bug report.  Sorry it
took so long to fix.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/51993] Erroneous type component initialization leads to internal compiler error
  2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
                   ` (7 preceding siblings ...)
  2015-10-30 18:35 ` kargl at gcc dot gnu.org
@ 2015-10-30 18:36 ` kargl at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-30 18:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51993

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from kargl at gcc dot gnu.org ---
Change status.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-10-30 18:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25 10:28 [Bug fortran/51993] New: Erroneous type component initialization leads to internal compiler error bardeau at iram dot fr
2012-01-25 11:14 ` [Bug fortran/51993] " burnus at gcc dot gnu.org
2013-02-27 15:56 ` dominiq at lps dot ens.fr
2015-10-29 10:54 ` dominiq at lps dot ens.fr
2015-10-29 12:34 ` dominiq at lps dot ens.fr
2015-10-30 17:55 ` kargl at gcc dot gnu.org
2015-10-30 18:14 ` kargl at gcc dot gnu.org
2015-10-30 18:27 ` kargl at gcc dot gnu.org
2015-10-30 18:35 ` kargl at gcc dot gnu.org
2015-10-30 18:36 ` kargl 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).