public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45495]  New: ICE: For character function with length specifier dependent on non-present arg.
@ 2010-09-02 10:41 pmason at ricardo dot com
  2010-09-02 10:43 ` [Bug fortran/45495] " pmason at ricardo dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pmason at ricardo dot com @ 2010-09-02 10:41 UTC (permalink / raw)
  To: gcc-bugs

When compiling test.f90 file as follows:

> gfortran test.f90

I get the following error message:

---------------------------------------------------------
internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
---------------------------------------------------------

Not sure if this is actually a bug as such. The code that causes this is
slightly bad. See sample file test.f90 attached.


-- 
           Summary: ICE: For character function with length specifier
                    dependent on non-present arg.
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pmason at ricardo dot com
 GCC build triplet: 4.6.0 20100828 (experimental)
  GCC host triplet: x86_64
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug fortran/45495] ICE: For character function with length specifier dependent on non-present arg.
  2010-09-02 10:41 [Bug fortran/45495] New: ICE: For character function with length specifier dependent on non-present arg pmason at ricardo dot com
@ 2010-09-02 10:43 ` pmason at ricardo dot com
  2010-09-02 11:32 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pmason at ricardo dot com @ 2010-09-02 10:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pmason at ricardo dot com  2010-09-02 10:42 -------
Created an attachment (id=21654)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21654&action=view)
Small testcase that causes ICE.


-- 


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


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

* [Bug fortran/45495] ICE: For character function with length specifier dependent on non-present arg
  2010-09-02 10:41 [Bug fortran/45495] New: ICE: For character function with length specifier dependent on non-present arg pmason at ricardo dot com
  2010-09-02 10:43 ` [Bug fortran/45495] " pmason at ricardo dot com
@ 2010-09-02 11:32 ` burnus at gcc dot gnu dot org
  2010-09-02 14:17 ` kargl at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-09-02 11:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2010-09-02 11:32 -------
Confirm: It compiles with g95 and NAG f95, but ICEs with gfortran (4.1 to 4.6)
and a couple of other compilers.

My feeling is that the program is invalid - at least in case the actual
argument is not present.

The program compiles (and runs) if one passes an actual argument - thus the
problem only occurs very late during folding.

The best probably would be to add a warning (default on?) and some conditions
around the expression such that it remains valid for folding even if the
argument is not present.

Due to the complexity of fixing it for invalid programs - without having a
chance to print an error message at compile time, I have reduced the priority
to minor.

Valgrind shows:

==5725== Invalid read of size 8
==5725==    at 0x896636: get_frame_type (tree-nested.c:223)
==5725==    by 0x896BFF: get_chain_decl (tree-nested.c:330)
==5725==    by 0x899ED5: get_nonlocal_debug_decl (tree-nested.c:842)
==5725==    by 0x89A7C1: convert_nonlocal_reference_op (tree-nested.c:920)
==5725==    by 0x9D0B66: walk_tree_1 (tree.c:10174)
==5725==    by 0x70F96B: walk_gimple_op (gimple.c:1356)


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |minor
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
      Known to fail|                            |4.2.1 4.1.2 4.3.4 4.4.0
                   |                            |4.5.1 4.6.0
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-02 11:32:28
               date|                            |
            Summary|ICE: For character function |ICE: For character function
                   |with length specifier       |with length specifier
                   |dependent on non-present    |dependent on non-present arg
                   |arg.                        |


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


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

* [Bug fortran/45495] ICE: For character function with length specifier dependent on non-present arg
  2010-09-02 10:41 [Bug fortran/45495] New: ICE: For character function with length specifier dependent on non-present arg pmason at ricardo dot com
  2010-09-02 10:43 ` [Bug fortran/45495] " pmason at ricardo dot com
  2010-09-02 11:32 ` burnus at gcc dot gnu dot org
@ 2010-09-02 14:17 ` kargl at gcc dot gnu dot org
  2010-09-02 20:13 ` kargl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-09-02 14:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kargl at gcc dot gnu dot org  2010-09-02 14:17 -------
(In reply to comment #2)
> Confirm: It compiles with g95 and NAG f95, but ICEs with gfortran (4.1 to 4.6)
> and a couple of other compilers.
> 
> My feeling is that the program is invalid - at least in case the actual
> argument is not present.

Yes, the code is invalid.  See restrictions on specification
expression.  C710 and 3 lines down to item (2).

PS: I'm willing to bet that you can get g95 (and may be Nag)
to die on the code by replacing "jack = ''" in the subroutine
with a sufficiently long string on the RHS. 


-- 


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


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

* [Bug fortran/45495] ICE: For character function with length specifier dependent on non-present arg
  2010-09-02 10:41 [Bug fortran/45495] New: ICE: For character function with length specifier dependent on non-present arg pmason at ricardo dot com
                   ` (2 preceding siblings ...)
  2010-09-02 14:17 ` kargl at gcc dot gnu dot org
@ 2010-09-02 20:13 ` kargl at gcc dot gnu dot org
  2010-09-02 21:46 ` kargl at gcc dot gnu dot org
  2010-09-09 19:02 ` kargl at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-09-02 20:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kargl at gcc dot gnu dot org  2010-09-02 20:12 -------
I may have a patch for this one.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |kargl at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-09-02 11:32:28         |2010-09-02 20:13:00
               date|                            |


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


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

* [Bug fortran/45495] ICE: For character function with length specifier dependent on non-present arg
  2010-09-02 10:41 [Bug fortran/45495] New: ICE: For character function with length specifier dependent on non-present arg pmason at ricardo dot com
                   ` (3 preceding siblings ...)
  2010-09-02 20:13 ` kargl at gcc dot gnu dot org
@ 2010-09-02 21:46 ` kargl at gcc dot gnu dot org
  2010-09-09 19:02 ` kargl at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-09-02 21:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kargl at gcc dot gnu dot org  2010-09-02 21:46 -------
http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00190.html


-- 


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


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

* [Bug fortran/45495] ICE: For character function with length specifier dependent on non-present arg
  2010-09-02 10:41 [Bug fortran/45495] New: ICE: For character function with length specifier dependent on non-present arg pmason at ricardo dot com
                   ` (4 preceding siblings ...)
  2010-09-02 21:46 ` kargl at gcc dot gnu dot org
@ 2010-09-09 19:02 ` kargl at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-09-09 19:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from kargl at gcc dot gnu dot org  2010-09-09 19:02 -------
Fixed in trunk.

No plans for back port to 4.5.x branch.

I'll open a bug report about intent(out)
issues with dummy arguments.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0


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


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

end of thread, other threads:[~2010-09-09 19:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-02 10:41 [Bug fortran/45495] New: ICE: For character function with length specifier dependent on non-present arg pmason at ricardo dot com
2010-09-02 10:43 ` [Bug fortran/45495] " pmason at ricardo dot com
2010-09-02 11:32 ` burnus at gcc dot gnu dot org
2010-09-02 14:17 ` kargl at gcc dot gnu dot org
2010-09-02 20:13 ` kargl at gcc dot gnu dot org
2010-09-02 21:46 ` kargl at gcc dot gnu dot org
2010-09-09 19:02 ` kargl at gcc dot gnu dot 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).