[Bug fortran/78718] ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1427

2016-12-13 Thread jim.macarthur at codethink dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78718

Jim MacArthur  changed:

   What|Removed |Added

 CC||jim.macarthur at codethink dot 
co.
   ||uk

--- Comment #1 from Jim MacArthur  ---
Confirmed on latest trunk (x8664). Looks like it has the wrong namespace when
trying to find 'z'. I'm looking into it.

[Bug fortran/78718] ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1427

2016-12-15 Thread jim.macarthur at codethink dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78718

--- Comment #3 from Jim MacArthur  ---
It looks to me like the assertion failure is because the symbol in the argument
expression doesn't have the attr.referenced bit set. resolve_actual_arglist
replaces the symtree in the 'z' expression when it finds the 'z' in the parent
namespace:

  e->symtree = parent_st;   /* Point to the right thing.  */

But this new symtree's symbol doesn't have attr.referenced set, unlike the
symtree it's replacing. You can copy the old referenced bit across to make it
work, but I've no idea yet what the correct solution is.

[Bug fortran/68544] New: ICE trying to pass derived type constructor as a function

2015-11-25 Thread jim.macarthur at codethink dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68544

Bug ID: 68544
   Summary: ICE trying to pass derived type constructor as a
function
   Product: gcc
   Version: 5.2.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jim.macarthur at codethink dot co.uk
  Target Milestone: ---

Created attachment 36839
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36839&action=edit
Minimal test case

The attached code causes an internal compiler error with the latest source from
git master (commit 9c822ac) and 5.2.0. It attempts to pass the implicit
constructor for a derived type as an argument to a subroutine.

I don't know if this is valid code. I haven't found anything in the standards
which suggest either way yet. Sun's F90 compiler rejects it, but gives a useful
error message.

gfortran -v:
Using built-in specs.
COLLECT_GCC=/home/jimmacarthur/gcc-5.2.0/gccinstall/bin/gfortran
COLLECT_LTO_WRAPPER=/home/jimmacarthur/gcc-5.2.0/gccinstall/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-5.2.0/configure --with-languages=fortran
--prefix=/home/jimmacarthur/gcc-5.2.0/gccinstall --disable-bootstrap
Thread model: posix
gcc version 5.2.0 (GCC) 

Compiler command line:
~/gcc-5.2.0/gccinstall/bin/gfortran -Wall -Wextra
pass-type-constructor-as-function.f

output:
pass-type-constructor-as-function.f:1:23:

   SUBROUTINE sub (f)
   1
Warning: Unused dummy argument ‘f’ at (1) [-Wunused-dummy-argument]
pass-type-constructor-as-function.f:7:0:

   TYPE t
 1
internal compiler error: Segmentation fault
0xa20cdf crash_signal
../../gcc-5.2.0/gcc/toplev.c:383
0x67b990 gfc_sym_identifier
../../gcc-5.2.0/gcc/fortran/trans-decl.c:347
0x67c38a build_function_decl
../../gcc-5.2.0/gcc/fortran/trans-decl.c:2057
0x682fa5 gfc_get_symbol_decl(gfc_symbol*)
../../gcc-5.2.0/gcc/fortran/trans-decl.c:1487
0x693537 gfc_conv_variable
../../gcc-5.2.0/gcc/fortran/trans-expr.c:2312
0x690c8a gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc-5.2.0/gcc/fortran/trans-expr.c:7219
0x696048 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
../../gcc-5.2.0/gcc/fortran/trans-expr.c:7319
0x68d3ff gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec*)
../../gcc-5.2.0/gcc/fortran/trans-expr.c:4831
0x6be024 gfc_trans_call(gfc_code*, bool, tree_node*, tree_node*, bool)
../../gcc-5.2.0/gcc/fortran/trans-stmt.c:419
0x66539c trans_code
../../gcc-5.2.0/gcc/fortran/trans.c:1743
0x685e54 gfc_generate_function_code(gfc_namespace*)
../../gcc-5.2.0/gcc/fortran/trans-decl.c:5841
0x622648 translate_all_program_units
../../gcc-5.2.0/gcc/fortran/parse.c:5340
0x622648 gfc_parse_file()
../../gcc-5.2.0/gcc/fortran/parse.c:5537
0x6613e5 gfc_be_parse_file
../../gcc-5.2.0/gcc/fortran/f95-lang.c:229

[Bug fortran/68544] ICE trying to pass derived type constructor as a function

2015-11-25 Thread jim.macarthur at codethink dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68544

--- Comment #2 from Jim MacArthur  ---
Sun f90 output:


  CALL sub(t)
   ^  
"pass-type-constructor-as-function.f", Line = 10, Column = 16: ERROR: This use
of derived type "T" is not valid.

[Bug fortran/69043] New: Trying to include a directory causes an infinite loop

2015-12-24 Thread jim.macarthur at codethink dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69043

Bug ID: 69043
   Summary: Trying to include a directory causes an infinite loop
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jim.macarthur at codethink dot co.uk
  Target Milestone: ---

Created attachment 37128
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37128&action=edit
Reproduction test case.

Trying to include a directory, for example:

include '.'
include '/'

...causes the scanner to go into an infinite loop. Also reproduced on 4.8. I
have a fix for this which I'll send to the mailing list in due course.

Command line: gccinstall/bin/gfortran -Wall -Wextra
~/vanilla-gcc/gcc/gcc/testsuite/gfortran.dg/include_9.f

Output: None (goes into infinite loop immediately)

gfortran -v:
Using built-in specs.
COLLECT_GCC=gccinstall/bin/gfortran
COLLECT_LTO_WRAPPER=/home/jimmacarthur/vanilla-gcc/gccinstall/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure
--prefix=/home/jimmacarthur/vanilla-gcc/gccinstall --enable-languages=fortran :
(reconfigured) ../gcc/configure
--prefix=/home/jimmacarthur/vanilla-gcc/gccinstall --enable-languages=fortran :
(reconfigured) ../gcc/configure
--prefix=/home/jimmacarthur/vanilla-gcc/gccinstall --enable-languages=fortran
Thread model: posix
gcc version 6.0.0 20151224 (experimental) (GCC)