public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34813]  New: ICE on incorrect type constructor (fold-const.c (fold_convert):2629)
@ 2008-01-16 16:33 dfranke at gcc dot gnu dot org
  2008-03-20 21:43 ` [Bug fortran/34813] ICE on incorrect nested " dfranke at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-01-16 16:33 UTC (permalink / raw)
  To: gcc-bugs

$> cat ice.f90
MODULE kd_kd_tree_type
  TYPE :: kd_tree_node
    TYPE(kd_tree_node_private), POINTER :: p
  END TYPE

  TYPE :: kd_tree_node_private
    INTEGER :: dummy
  END TYPE

  TYPE :: kd_tree
    TYPE(kd_tree_node) :: root
  END TYPE

CONTAINS
  SUBROUTINE kd_tree_init_default(this)
    TYPE(kd_tree), INTENT(inout) :: this
!     this = kd_tree(kd_tree_node(null()))     ! correct
    this = kd_tree(null())                     ! ICE
  END SUBROUTINE
END MODULE

$> gfortran-svn ice.f90
ice.f90: In function 'kd_tree_init_default':
ice.f90:15: internal compiler error: in fold_convert, at fold-const.c:2629
Please submit a full bug report,

$> gfortran-svn -v
gcc version 4.3.0 20080107 (experimental)

Backtrace:
(gdb) bt
#0  fancy_abort (file=0x87f3ec4 "../../../svn/gcc/gcc/fold-const.c", line=2629,
function=0x87f8472 "fold_convert")
    at ../../../svn/gcc/gcc/diagnostic.c:659
#1  0x0824efd1 in fold_convert (type=0xb7d0f548, arg=0xb7cd39d8) at
../../../svn/gcc/gcc/fold-const.c:2629
#2  0x080f378b in gfc_trans_subcomponent_assign (dest=0xb7cde078, cm=0x89ba8d0,
expr=0x89bb1c8) at ../../../svn/gcc/gcc/fortran/trans-expr.c:3354
#3  0x080f396a in gfc_trans_structure_assign (dest=0xb7cdd108, expr=<value
optimized out>) at ../../../svn/gcc/gcc/fortran/trans-expr.c:3414
#4  0x080f3b8b in gfc_conv_structure (se=0xbfec283c, expr=0x89bb760, init=0) at
../../../svn/gcc/gcc/fortran/trans-expr.c:3441
#5  0x080ef85c in gfc_conv_expr (se=0xbfec283c, expr=0x89bb760) at
../../../svn/gcc/gcc/fortran/trans-expr.c:3563
#6  0x080f0ab0 in gfc_trans_assignment_1 (expr1=0x89bb100, expr2=0x89bb760,
init_flag=0 '\0') at ../../../svn/gcc/gcc/fortran/trans-expr.c:4293
#7  0x080f0c4c in gfc_trans_assignment (expr1=0x89bb100, expr2=0x89bb760,
init_flag=72 'H') at ../../../svn/gcc/gcc/fortran/trans-expr.c:4440
#8  0x080f17e1 in gfc_trans_assign (code=0x89bb7d0) at
../../../svn/gcc/gcc/fortran/trans-expr.c:4452
#9  0x080cfe90 in gfc_trans_code (code=0x89bb7d0) at
../../../svn/gcc/gcc/fortran/trans.c:994
#10 0x080e7cc2 in gfc_generate_function_code (ns=0x89ba920) at
../../../svn/gcc/gcc/fortran/trans-decl.c:3298
#11 0x080cd01a in gfc_generate_module_code (ns=0x89b9e20) at
../../../svn/gcc/gcc/fortran/trans.c:1214
#12 0x0809f219 in gfc_parse_file () at
../../../svn/gcc/gcc/fortran/parse.c:3391
#13 0x080c8985 in gfc_be_parse_file (set_yydebug=0) at
../../../svn/gcc/gcc/fortran/f95-lang.c:260
#14 0x0836c6d4 in toplev_main (argc=2, argv=0xbfec2ca4) at
../../../svn/gcc/gcc/toplev.c:1042
#15 0x08114b1f in main (argc=16, argv=0x0) at ../../../svn/gcc/gcc/main.c:35


This might be related to (or be a dupe of) PR33295.


-- 
           Summary: ICE on incorrect type constructor (fold-const.c
                    (fold_convert):2629)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dfranke at gcc dot gnu dot org


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


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

* [Bug fortran/34813] ICE on incorrect nested type constructor (fold-const.c (fold_convert):2629)
  2008-01-16 16:33 [Bug fortran/34813] New: ICE on incorrect type constructor (fold-const.c (fold_convert):2629) dfranke at gcc dot gnu dot org
@ 2008-03-20 21:43 ` dfranke at gcc dot gnu dot org
  2008-03-21  8:06 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-03-20 21:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2008-03-20 21:42 -------
Simplified testcase:

SUBROUTINE kd_tree_init_default()
  TYPE :: kd_tree_node
    INTEGER :: dummy
  END TYPE

  TYPE :: kd_tree
    TYPE(kd_tree_node) :: root
  END TYPE

  TYPE(kd_tree)  :: tree
  tree = kd_tree(null())
END SUBROUTINE


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.1.2 4.2.3 4.3.0           |4.1.2 4.2.3 4.3.0 4.4.0


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


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

* [Bug fortran/34813] ICE on incorrect nested type constructor (fold-const.c (fold_convert):2629)
  2008-01-16 16:33 [Bug fortran/34813] New: ICE on incorrect type constructor (fold-const.c (fold_convert):2629) dfranke at gcc dot gnu dot org
  2008-03-20 21:43 ` [Bug fortran/34813] ICE on incorrect nested " dfranke at gcc dot gnu dot org
@ 2008-03-21  8:06 ` pault at gcc dot gnu dot org
  2008-03-21 10:21 ` dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-21  8:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2008-03-21 08:05 -------
I'll take this on as relief from memory leaks....

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-21 08:05:52
               date|                            |


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


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

* [Bug fortran/34813] ICE on incorrect nested type constructor (fold-const.c (fold_convert):2629)
  2008-01-16 16:33 [Bug fortran/34813] New: ICE on incorrect type constructor (fold-const.c (fold_convert):2629) dfranke at gcc dot gnu dot org
  2008-03-20 21:43 ` [Bug fortran/34813] ICE on incorrect nested " dfranke at gcc dot gnu dot org
  2008-03-21  8:06 ` pault at gcc dot gnu dot org
@ 2008-03-21 10:21 ` dfranke at gcc dot gnu dot org
  2008-03-24 19:13 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-03-21 10:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2008-03-21 10:20 -------
Last night, I tracked this to resolve.c (resolve_structure_cons), but I was not
100% sure what to do.

With the simplified testcase, Intel complains:
$> ifort pr34813.f90
fortcom: Error: pr34813.f90, line 15: The type of the NULL(MOLD) element in a
structure-constructor differs from the type of the component in the
derived-type-def.
 tree = kd_tree(kd_tree_node(null()))
-----------------------------^
fortcom: Error: pr34813.f90, line 15: This array or function or substring is
invalid in constant expressions.
 tree = kd_tree(kd_tree_node(null()))
----------------^
fortcom: Error: pr34813.f90, line 15: Replacing invalid structure constructor
by integer 1   [<NULL_STRING>]
 tree = kd_tree(kd_tree_node(null()))
^

Interestingly, if it is slightly changed,
-  tree = kd_tree(kd_tree_node(null()))
+  integer, pointer :: i
+  tree = kd_tree(kd_tree_node(null(i)))

Intel gives an ICE while gfortran happily (but wrongly?) accepts it:
$> ifort -warn all pr34813.f90
fortcom: Severe: pr34813.f90, line 12: **Internal compiler error: internal
abort** Please report this error along with the circumstances in which it
occurred in a Software Problem Report.  Note: File and line given may not be
explicit cause of this error.
  tree = kd_tree(kd_tree_node(null(i)))
------------------------------^


-- 


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


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

* [Bug fortran/34813] ICE on incorrect nested type constructor (fold-const.c (fold_convert):2629)
  2008-01-16 16:33 [Bug fortran/34813] New: ICE on incorrect type constructor (fold-const.c (fold_convert):2629) dfranke at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-03-21 10:21 ` dfranke at gcc dot gnu dot org
@ 2008-03-24 19:13 ` pault at gcc dot gnu dot org
  2008-03-24 21:12 ` pault at gcc dot gnu dot org
  2008-03-25  5:35 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-24 19:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2008-03-24 19:12 -------
Subject: Bug 34813

Author: pault
Date: Mon Mar 24 19:11:24 2008
New Revision: 133488

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133488
Log:
2008-03-24  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/34813
        * resolve.c (resolve_structure_cons): It is an error to assign
        NULL to anything other than a pointer or allocatable component.

        PR fortran/33295
        * resolve.c (resolve_symbol): If the symbol is a derived type,
        resolve the derived type.  If the symbol is a derived type
        function, ensure that the derived type is visible in the same
        namespace as the function.

2008-03-24  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/34813
        * gfortran.dg/null_3.f90 : New test

        PR fortran/33295
        * gfortran.dg/module_function_type_1.f90 : New test


Added:
    trunk/gcc/testsuite/gfortran.dg/module_function_type_1.f90
    trunk/gcc/testsuite/gfortran.dg/null_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/34813] ICE on incorrect nested type constructor (fold-const.c (fold_convert):2629)
  2008-01-16 16:33 [Bug fortran/34813] New: ICE on incorrect type constructor (fold-const.c (fold_convert):2629) dfranke at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-03-24 19:13 ` pault at gcc dot gnu dot org
@ 2008-03-24 21:12 ` pault at gcc dot gnu dot org
  2008-03-25  5:35 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-24 21:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2008-03-24 21:11 -------
Subject: Bug 34813

Author: pault
Date: Mon Mar 24 21:10:36 2008
New Revision: 133490

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133490
Log:
2008-03-24  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/34813
        * resolve.c (resolve_structure_cons): It is an error to assign
        NULL to anything other than a pointer or allocatable component.

        PR fortran/33295
        * resolve.c (resolve_symbol): If the symbol is a derived type,
        resolve the derived type.  If the symbol is a derived type
        function, ensure that the derived type is visible in the same
        namespace as the function.

2008-03-24  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/34813
        * gfortran.dg/null_3.f90 : New test

        PR fortran/33295
        * gfortran.dg/module_function_type_1.f90 : New test


Added:
   
branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/module_function_type_1.f90
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/null_3.f90
Modified:
    branches/gcc-4_3-branch/gcc/fortran/ChangeLog
    branches/gcc-4_3-branch/gcc/fortran/resolve.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/34813] ICE on incorrect nested type constructor (fold-const.c (fold_convert):2629)
  2008-01-16 16:33 [Bug fortran/34813] New: ICE on incorrect type constructor (fold-const.c (fold_convert):2629) dfranke at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-03-24 21:12 ` pault at gcc dot gnu dot org
@ 2008-03-25  5:35 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-25  5:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2008-03-25 05:34 -------
Fixed on trumk and 4.3.

Thanks for the report.

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-03-25  5:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-16 16:33 [Bug fortran/34813] New: ICE on incorrect type constructor (fold-const.c (fold_convert):2629) dfranke at gcc dot gnu dot org
2008-03-20 21:43 ` [Bug fortran/34813] ICE on incorrect nested " dfranke at gcc dot gnu dot org
2008-03-21  8:06 ` pault at gcc dot gnu dot org
2008-03-21 10:21 ` dfranke at gcc dot gnu dot org
2008-03-24 19:13 ` pault at gcc dot gnu dot org
2008-03-24 21:12 ` pault at gcc dot gnu dot org
2008-03-25  5:35 ` pault 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).