[Bug fortran/65173] ICE while compiling wrong code

2016-12-09 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

Rainer Orth  changed:

   What|Removed |Added

 CC||ro at gcc dot gnu.org

--- Comment #15 from Rainer Orth  ---
Two of the new testcases XPASS on Solaris (i386-pc-solaris2.12,
sparc-sun-solaris2.12, 32 and 64-bit):

XPASS: gfortran.dg/charlen_03.f90   -O  (test for excess errors)
XPASS: gfortran.dg/charlen_10.f90   -O  (test for excess errors)

  Rainer

[Bug fortran/65173] ICE while compiling wrong code

2016-12-08 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |kargl at gcc dot gnu.org
   Target Milestone|--- |7.0
   Severity|minor   |normal

--- Comment #14 from kargl at gcc dot gnu.org ---
Fixed on trunk. Closing.

[Bug fortran/65173] ICE while compiling wrong code

2016-12-08 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

--- Comment #13 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Thu Dec  8 21:26:11 2016
New Revision: 243463

URL: https://gcc.gnu.org/viewcvs?rev=243463=gcc=rev
Log:
2016-12-07  Steven G. Kargl  

PR fortran/65173
PR fortran/69064
PR fortran/69859
PR fortran/78350
* gfortran.h (gfc_namespace): Remove old_cl_list member.
* parse.c (use_modules, next_statement): old_cl_list is gone.
(clear_default_charlen): Remove no longer used function.
(reject_statement): Do not try ot clean up gfc_charlen structure(s)
that may have been added to a cl_list list.
* symbol.c (gfc_new_charlen): old_cl_list structure is gone.

2016-12-07  Steven G. Kargl  

PR fortran/65173
PR fortran/69064
PR fortran/69859
PR fortran/78350
* gfortran.dg/misplaced_implicit_character.f90: Adjust errors.
* gfortran.dg/charlen_01.f90: New test.
* gfortran.dg/charlen_02.f90: Ditto.
* gfortran.dg/charlen_03.f90: Ditto.
* gfortran.dg/charlen_04.f90: Ditto.
* gfortran.dg/charlen_05.f90: Ditto.
* gfortran.dg/charlen_06.f90: Ditto.
* gfortran.dg/charlen_07.f90: Ditto.
* gfortran.dg/charlen_08.f90: Ditto.
* gfortran.dg/charlen_09.f90: Ditto.
* gfortran.dg/charlen_10.f90: Ditto.
* gfortran.dg/charlen_11.f90: Ditto.
* gfortran.dg/charlen_12.f90: Ditto.
* gfortran.dg/charlen_13.f90: Ditto.
* gfortran.dg/charlen_14.f90: Ditto.
* gfortran.dg/charlen_15.f90: Ditto.
* gfortran.dg/charlen_16.f90: Ditto.

Added:
trunk/gcc/testsuite/gfortran.dg/charlen_01.f90
trunk/gcc/testsuite/gfortran.dg/charlen_02.f90
trunk/gcc/testsuite/gfortran.dg/charlen_03.f90
trunk/gcc/testsuite/gfortran.dg/charlen_04.f90
trunk/gcc/testsuite/gfortran.dg/charlen_05.f90
trunk/gcc/testsuite/gfortran.dg/charlen_06.f90
trunk/gcc/testsuite/gfortran.dg/charlen_07.f90
trunk/gcc/testsuite/gfortran.dg/charlen_08.f90
trunk/gcc/testsuite/gfortran.dg/charlen_09.f90
trunk/gcc/testsuite/gfortran.dg/charlen_10.f90
trunk/gcc/testsuite/gfortran.dg/charlen_11.f90
trunk/gcc/testsuite/gfortran.dg/charlen_12.f90
trunk/gcc/testsuite/gfortran.dg/charlen_13.f90
trunk/gcc/testsuite/gfortran.dg/charlen_14.f90
trunk/gcc/testsuite/gfortran.dg/charlen_15.f90
trunk/gcc/testsuite/gfortran.dg/charlen_16.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/parse.c
trunk/gcc/fortran/symbol.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/misplaced_implicit_character.f90

[Bug fortran/65173] ICE while compiling wrong code

2016-12-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

--- Comment #12 from kargl at gcc dot gnu.org ---
Patch posted to fort...@gcc.gnu.org

[Bug fortran/65173] ICE while compiling wrong code

2016-12-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

--- Comment #11 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #10)
> (In reply to Gerhard Steinmetz from comment #9)
> > Another example, together with LANG=de_DE.UTF-8 :
> > 
> > 
> > $ cat zz1.f90
> > program p
> >type t
> >   character, allocatable :: z1(:), z1(:)
> >end type
> > end
> > 
> > 
> > $ gfortran-7-20161204 -m32 zz1.f90
> > zz1.f90:3:37-44:
> > 
> >character, allocatable :: z1(:), z1(:)
> >  2  1
> > Error: Component »z1« at (1) already declared at (2)
> > f951: internal compiler error: Speicherzugriffsfehler
> > 0xc4940f crash_signal
> > ../../gcc/toplev.c:333
> > 0x6f3aea gfc_resolve_expr(gfc_expr*)
> > ../../gcc/fortran/resolve.c:6465
> 
> (gdb) bt
> (gdb) bt
> #0  gfc_is_constant_expr (e=0x837f) at ../../gcc7/gcc/fortran/expr.c:894
> #1  0x0065a320 in resolve_component (c=0x20365f8c0, sym=0x203635f00)
> at ../../gcc7/gcc/fortran/resolve.c:13507
> #2  0x0065a9ab in resolve_fl_derived0 (sym=sym@entry=0x203635f00)
> at ../../gcc7/gcc/fortran/resolve.c:13738
> ...
> (gdb) up
> #1  0x0065a320 in resolve_component (c=0x20365f8c0, sym=0x203635f00)
> at ../../gcc7/gcc/fortran/resolve.c:13507
> 13507|| !gfc_is_constant_expr (c->ts.u.cl->length))
> (gdb) p *c->ts.u.cl
> $5 = {length = 0x837f, next = 0x20362b5d0, length_from_typespec = false, 
>   backend_decl = 0x2039d8040, passed_length = 0x0, resolved = 56844672}
> 
> length=0x837f is an invalid pointer.  So, gfortran ICE's.  This 
> looks similar to the fight that Janus waged this weekend.  For
> some reason, a CHARACTER(LEN=) component in a derived type
> does not set the length correctly.

Well, this is due to reject_statement(), which frees memory associated
with charlen.  It seems we have a tangling pointer that needs to be
explicitly NULLed, but I cannot find it.  If the code is changed to

program p
type t
   character, allocatable :: z1(:)
   character, allocatable :: z1(:)
end type
end

gfortran generates an error message without the ICE because the
charlen from the first statement is not cleared.

[Bug fortran/65173] ICE while compiling wrong code

2016-12-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #10 from kargl at gcc dot gnu.org ---
(In reply to Gerhard Steinmetz from comment #9)
> Another example, together with LANG=de_DE.UTF-8 :
> 
> 
> $ cat zz1.f90
> program p
>type t
>   character, allocatable :: z1(:), z1(:)
>end type
> end
> 
> 
> $ gfortran-7-20161204 -m32 zz1.f90
> zz1.f90:3:37-44:
> 
>character, allocatable :: z1(:), z1(:)
>  2  1
> Error: Component »z1« at (1) already declared at (2)
> f951: internal compiler error: Speicherzugriffsfehler
> 0xc4940f crash_signal
> ../../gcc/toplev.c:333
> 0x6f3aea gfc_resolve_expr(gfc_expr*)
> ../../gcc/fortran/resolve.c:6465

(gdb) bt
(gdb) bt
#0  gfc_is_constant_expr (e=0x837f) at ../../gcc7/gcc/fortran/expr.c:894
#1  0x0065a320 in resolve_component (c=0x20365f8c0, sym=0x203635f00)
at ../../gcc7/gcc/fortran/resolve.c:13507
#2  0x0065a9ab in resolve_fl_derived0 (sym=sym@entry=0x203635f00)
at ../../gcc7/gcc/fortran/resolve.c:13738
...
(gdb) up
#1  0x0065a320 in resolve_component (c=0x20365f8c0, sym=0x203635f00)
at ../../gcc7/gcc/fortran/resolve.c:13507
13507|| !gfc_is_constant_expr (c->ts.u.cl->length))
(gdb) p *c->ts.u.cl
$5 = {length = 0x837f, next = 0x20362b5d0, length_from_typespec = false, 
  backend_decl = 0x2039d8040, passed_length = 0x0, resolved = 56844672}

length=0x837f is an invalid pointer.  So, gfortran ICE's.  This 
looks similar to the fight that Janus waged this weekend.  For
some reason, a CHARACTER(LEN=) component in a derived type
does not set the length correctly.

[Bug fortran/65173] ICE while compiling wrong code

2016-12-05 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

--- Comment #9 from Gerhard Steinmetz  
---
Another example, together with LANG=de_DE.UTF-8 :


$ cat zz1.f90
program p
   type t
  character, allocatable :: z1(:), z1(:)
   end type
end


$ gfortran-7-20161204 -m32 zz1.f90
zz1.f90:3:37-44:

   character, allocatable :: z1(:), z1(:)
 2  1
Error: Component »z1« at (1) already declared at (2)
f951: internal compiler error: Speicherzugriffsfehler
0xc4940f crash_signal
../../gcc/toplev.c:333
0x6f3aea gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.c:6465
0x6f3e45 resolve_operator
../../gcc/fortran/resolve.c:3639
0x6f3e45 gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.c:6475
0x6f6f08 resolve_index_expr
../../gcc/fortran/resolve.c:11379
0x6f6f74 resolve_charlen
../../gcc/fortran/resolve.c:11424
0x702da8 resolve_charlen
../../gcc/fortran/resolve.c:13580
0x702da8 resolve_component
../../gcc/fortran/resolve.c:13506
0x702f0a resolve_fl_derived0
../../gcc/fortran/resolve.c:13738
0x7032d7 resolve_fl_derived0
../../gcc/fortran/resolve.c:13122
0x7032d7 resolve_fl_derived
../../gcc/fortran/resolve.c:13815
0x6fe0a7 resolve_symbol
../../gcc/fortran/resolve.c:14146
0x71825b do_traverse_symtree
../../gcc/fortran/symbol.c:3994
0x70125a resolve_types
../../gcc/fortran/resolve.c:15948
0x6fcdac gfc_resolve(gfc_namespace*)
../../gcc/fortran/resolve.c:16061
0x6e71fa resolve_all_program_units
../../gcc/fortran/parse.c:5977
0x6e71fa gfc_parse_file()
../../gcc/fortran/parse.c:6224
0x72b182 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:202

[Bug fortran/65173] ICE while compiling wrong code

2016-11-09 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

--- Comment #8 from Dominique d'Humieres  ---
Note that the tests z1.f90 and z8.f90 fail in a different way:

pr65173_3.f90:3:39:

   character(:), allocatable :: x(n)
   1
Error: Allocatable component of structure at (1) must have a deferred shape
=
==24015==ERROR: AddressSanitizer: heap-use-after-free on address 0x6040cbf8
at pc 0x0001002b5734 bp 0x7fff5fbfe660 sp 0x7fff5fbfe658
READ of size 8 at 0x6040cbf8 thread T0
#0 0x1002b5733 in check_host_association(gfc_expr*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002b5733)
#1 0x1002ae1d7 in gfc_resolve_expr(gfc_expr*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002ae1d7)
#2 0x1e80a 
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1e80a)
#3 0x100014067 in gfc_resolve_array_spec(gfc_array_spec*, int)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100014067)
#4 0x1002a2754 in resolve_component(gfc_component*, gfc_symbol*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002a2754)
#5 0x1002a5440 in resolve_fl_derived0(gfc_symbol*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002a5440)
#6 0x1002a61bd in resolve_fl_derived(gfc_symbol*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002a61bd)
#7 0x1002966c8 in resolve_symbol(gfc_symbol*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002966c8)
#8 0x10032dacc in do_traverse_symtree(gfc_symtree*, void (*)(gfc_symtree*),
void (*)(gfc_symbol*))
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10032dacc)
#9 0x100345881 in gfc_traverse_ns(gfc_namespace*, void (*)(gfc_symbol*))
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100345881)
#10 0x1002d51ed in resolve_types(gfc_namespace*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002d51ed)
#11 0x100293315 in gfc_resolve(gfc_namespace*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100293315)
#12 0x100223cdc in resolve_all_program_units(gfc_namespace*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100223cdc)
#13 0x10023e38e in gfc_parse_file()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023e38e)
#14 0x10038020a in gfc_be_parse_file()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10038020a)
#15 0x103bf0124 in compile_file()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x103bf0124)
#16 0x103bf92ee in do_compile()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x103bf92ee)
#17 0x10568dc2f in toplev::main(int, char**)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10568dc2f)
#18 0x105692be5 in main
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x105692be5)
#19 0x7fffe8d83254 in start (/usr/lib/system/libdyld.dylib+0x5254)
#20 0xd 
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0xd)

0x6040cbf8 is located 40 bytes inside of 48-byte region
[0x6040cbd0,0x6040cc00)
freed by thread T0 here:
#0 0x15078e690 in wrap_free.part.0
(/opt/gcc/gcc7a/lib/libasan.3.dylib+0x53690)
#1 0x10033ce36 in gfc_delete_symtree(gfc_symtree**, char const*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10033ce36)
#2 0x1003511bf in gfc_restore_last_undo_checkpoint()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1003511bf)
#3 0x1003515bd in gfc_undo_symbols()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1003515bd)
#4 0x1002241ee in reject_statement()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002241ee)
#5 0x100224373 in match_word(char const*, match (*)(), locus*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100224373)
#6 0x1002322bd in decode_statement()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002322bd)
#7 0x10023427b in next_free()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023427b)
#8 0x100234af9 in next_statement()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100234af9)
#9 0x10023679d in parse_derived()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023679d)
#10 0x100238b9b in parse_spec(gfc_statement)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100238b9b)
#11 0x10023c78b in parse_progunit(gfc_statement)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023c78b)
#12 0x10023e350 in gfc_parse_file()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023e350)
#13 0x10038020a in gfc_be_parse_file()

[Bug fortran/65173] ICE while compiling wrong code

2016-11-09 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

--- Comment #7 from Dominique d'Humieres  ---
Compiling the test in comment 0 with and instrumented gfortran I get

pr65173.f90:7:45:

  real*8, dimension(256), allocatable :: x
 1
Error: Allocatable component of structure at (1) must have a deferred shape
pr65173.f90:8:52:

  real*8, dimension(2,256), allocatable :: bounds
1
Error: Allocatable component of structure at (1) must have a deferred shape
pr65173.f90:9:67:

  character(string_length), dimension(256), allocatable :: names
   1
Error: Allocatable component of structure at (1) must have a deferred shape
pr65173.f90:13:28:

 character(*), dimension(), parameter :: char_params =
['element','parametrization']
1
Error: Expected expression in array specification at (1)
=
==23996==ERROR: AddressSanitizer: heap-use-after-free on address 0x6040bf10
at pc 0x0001002a2d95 bp 0x7fff5fbfe830 sp 0x7fff5fbfe828
READ of size 8 at 0x6040bf10 thread T0
#0 0x1002a2d94 in resolve_component(gfc_component*, gfc_symbol*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002a2d94)
#1 0x1002a5440 in resolve_fl_derived0(gfc_symbol*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002a5440)
#2 0x1002a61bd in resolve_fl_derived(gfc_symbol*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002a61bd)
#3 0x1002966c8 in resolve_symbol(gfc_symbol*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002966c8)
#4 0x10032dacc in do_traverse_symtree(gfc_symtree*, void (*)(gfc_symtree*),
void (*)(gfc_symbol*))
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10032dacc)
#5 0x100345881 in gfc_traverse_ns(gfc_namespace*, void (*)(gfc_symbol*))
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100345881)
#6 0x1002d51ed in resolve_types(gfc_namespace*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002d51ed)
#7 0x100293315 in gfc_resolve(gfc_namespace*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100293315)
#8 0x100223cdc in resolve_all_program_units(gfc_namespace*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100223cdc)
#9 0x10023e38e in gfc_parse_file()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023e38e)
#10 0x10038020a in gfc_be_parse_file()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10038020a)
#11 0x103bf0124 in compile_file()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x103bf0124)
#12 0x103bf92ee in do_compile()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x103bf92ee)
#13 0x10568dc2f in toplev::main(int, char**)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10568dc2f)
#14 0x105692be5 in main
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x105692be5)
#15 0x7fffe8d83254 in start (/usr/lib/system/libdyld.dylib+0x5254)
#16 0xd 
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0xd)

0x6040bf10 is located 0 bytes inside of 48-byte region
[0x6040bf10,0x6040bf40)
freed by thread T0 here:
#0 0x15078e690 in wrap_free.part.0
(/opt/gcc/gcc7a/lib/libasan.3.dylib+0x53690)
#1 0x1003446ba in gfc_free_charlen(gfc_charlen*, gfc_charlen*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1003446ba)
#2 0x10022400d in reject_statement()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10022400d)
#3 0x100224373 in match_word(char const*, match (*)(), locus*)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100224373)
#4 0x1002322bd in decode_statement()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x1002322bd)
#5 0x10023427b in next_free()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023427b)
#6 0x100234af9 in next_statement()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100234af9)
#7 0x10023679d in parse_derived()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023679d)
#8 0x100238b9b in parse_spec(gfc_statement)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x100238b9b)
#9 0x10023c78b in parse_progunit(gfc_statement)
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023c78b)
#10 0x10023e350 in gfc_parse_file()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10023e350)
#11 0x10038020a in gfc_be_parse_file()
(/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951+0x10038020a)
#12 0x103bf0124 in compile_file()

[Bug fortran/65173] ICE while compiling wrong code

2016-11-08 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|RESOLVED|NEW
 Resolution|FIXED   |---

--- Comment #6 from Dominique d'Humieres  ---
> All of these ICEs are now gone with r238822.

On darwin, I still get an ICE for the test in comment 0. For the other tests I
get non-deterministic ICEs: for the test in comment 2 I get

pr65173_1.f90:3:55:

  character(1), dimension(256), allocatable :: names
   1
Error: Allocatable component of structure at (1) must have a deferred shape
f951: internal compiler error: Segmentation fault: 11

or

pr65173_1.f90:3:55:

  character(1), dimension(256), allocatable :: names
   1
Error: Allocatable component of structure at (1) must have a deferred shape
pr65173_1.f90:3:55:

  character(1), dimension(256), allocatable :: names
   1
Error: Character length of component 'names' needs to be a constant
specification expression at (1)

I have traced the problem to

   13476 if (c->ts.u.cl->length == NULL
   13477 || (!resolve_charlen(c->ts.u.cl))
-> 13478 || !gfc_is_constant_expr (c->ts.u.cl->length))

in resolve.c. The ICEs occur when c->ts.u.cl->length != NULL, the ICE occurs in
gfc_is_constant_expr in expr.c at

-> 899switch (e->expr_type)

It seems that c->ts.u.cl->length is not properly set to NULL.

[Bug fortran/65173] ICE while compiling wrong code

2016-08-22 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

--- Comment #5 from Gerhard Steinmetz  
---
On my environment the ICE is gone only for z1.f90 and z8.f90.


$ gfortran-7-20160821 z7.f90
z7.f90:5:20:

   character x(:)
1
Error: Array component of structure at (1) must have an explicit shape
f951: internal compiler error: Segmentation fault
0xc1b63f crash_signal
../../gcc/toplev.c:335
0x688b02 gfc_is_constant_expr(gfc_expr*)
../../gcc/fortran/expr.c:899
0x688c1b gfc_is_constant_expr(gfc_expr*)
../../gcc/fortran/expr.c:902
0x6f47d6 resolve_component
../../gcc/fortran/resolve.c:13092
0x6f4eb4 resolve_component
../../gcc/fortran/resolve.c:12847
0x6f4eb4 resolve_fl_derived0
../../gcc/fortran/resolve.c:13329
0x6f508c resolve_fl_derived0
../../gcc/fortran/resolve.c:13298
0x6f508c resolve_fl_derived
../../gcc/fortran/resolve.c:13406
0x6f0206 resolve_symbol
../../gcc/fortran/resolve.c:13685
0x7098ab do_traverse_symtree
../../gcc/fortran/symbol.c:3930
0x6f319a resolve_types
../../gcc/fortran/resolve.c:15482
0x6eee5c gfc_resolve(gfc_namespace*)
../../gcc/fortran/resolve.c:15593
0x6da18a resolve_all_program_units
../../gcc/fortran/parse.c:5855
0x6da18a gfc_parse_file()
../../gcc/fortran/parse.c:6107
0x71c602 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:198

[Bug fortran/65173] ICE while compiling wrong code

2016-08-09 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

Thomas Koenig  changed:

   What|Removed |Added

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

--- Comment #4 from Thomas Koenig  ---
All of these ICEs are now gone with r238822.

[Bug fortran/65173] ICE while compiling wrong code

2016-07-04 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

Gerhard Steinmetz  changed:

   What|Removed |Added

 CC||gerhard.steinmetz.fortran@t
   ||-online.de

--- Comment #3 from Gerhard Steinmetz  
---
Several more examples.
The dimension attribute may be placed this way or that way.


gfortran-6 (release) aborts with ...
(null):0: confused by earlier errors, bailing out


gfortran-7 (experimental) aborts in one of ...
gfc_is_constant_expr
gfc_get_default_type
gfc_resolve_expr


... with one of these messages :
Error: Allocatable component of structure at (1) must have a deferred shape
Error: Array component of structure at (1) must have an explicit shape
Error: Expression at (1) must be of INTEGER type, found PROCEDURE
Error: Syntax error in data declaration at (1)



$ cat z0.f90
program p
   type t
  character(1), allocatable :: names(256)
   end type
end


$ cat z1.f90
program p
   type t
  character(:), allocatable :: x(n)
   end type
end


$ cat z2.f90
program p
   type t
  character(*), allocatable :: x(*)
   end type
end


$ cat z3.f90
program p
   type t
  character(*) :: x y
   end type
end


$ cat z4.f90
program p
   type t
  character(*) :: x+1
   end type
end


$ cat z5.f90
program p
   type t
   end type
   type, extends(t) :: t2
  character x =
   end type
end


$ cat z6.f90
program p
   type t
   end type
   type, extends(t) :: t2
  character x 'x'
   end type
end


$ cat z7.f90
program p
   type t
   end type
   type, extends(t) :: t2
  character x(:)
   end type
end


$ cat z8.f90
program p
   type t
  character(:), allocatable :: x(y)1
   end type
end


...

[Bug fortran/65173] ICE while compiling wrong code

2016-04-05 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

Harald Anlauf  changed:

   What|Removed |Added

 CC||anlauf at gmx dot de

--- Comment #2 from Harald Anlauf  ---
Further reduced test:

  implicit none
  type :: param_t
 character(1), dimension(256), allocatable :: names
  end type param_t
end

% gfc-trunk pr65173.f90
pr65173.f90:3:55:

  character(1), dimension(256), allocatable :: names
   1
Error: Allocatable component of structure at (1) must have a deferred shape
f951: internal compiler error: gfc_resolve_expr(): Bad expression type
0x824c5e3 gfc_internal_error(char const*, ...)
../../trunk/gcc/fortran/error.c:1314
0x82b8817 gfc_resolve_expr(gfc_expr*)
../../trunk/gcc/fortran/resolve.c:6409
0x82c15ed resolve_index_expr
../../trunk/gcc/fortran/resolve.c:10958
0x82c16df resolve_charlen
../../trunk/gcc/fortran/resolve.c:11003
0x82c621d resolve_fl_derived0
../../trunk/gcc/fortran/resolve.c:13208
0x82c6bf7 resolve_fl_derived
../../trunk/gcc/fortran/resolve.c:13413
0x82c7656 resolve_symbol
../../trunk/gcc/fortran/resolve.c:13687
0x82de443 do_traverse_symtree
../../trunk/gcc/fortran/symbol.c:3817
0x82cb17f resolve_types
../../trunk/gcc/fortran/resolve.c:15476
0x82cb550 gfc_resolve(gfc_namespace*)
../../trunk/gcc/fortran/resolve.c:15586
0x82a6718 resolve_all_program_units
../../trunk/gcc/fortran/parse.c:5552
0x82a6718 gfc_parse_file()
../../trunk/gcc/fortran/parse.c:5804
0x82f40f5 gfc_be_parse_file
../../trunk/gcc/fortran/f95-lang.c:201

[Bug fortran/65173] ICE while compiling wrong code

2015-02-27 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

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

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-02-27
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres dominiq at lps dot ens.fr ---
Confirmed on 4.8.4, 4.9.2, and trunk (5.0).