[Bug fortran/71880] pointer to allocatable character

2019-02-14 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

Dominique d'Humieres  changed:

   What|Removed |Added

 CC||clange001 at gmail dot com

--- Comment #12 from Dominique d'Humieres  ---
*** Bug 89352 has been marked as a duplicate of this bug. ***

[Bug fortran/71880] pointer to allocatable character

2018-10-26 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

Paul Thomas  changed:

   What|Removed |Added

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

--- Comment #11 from Paul Thomas  ---
(In reply to Dominique d'Humieres from comment #8)
> The test in comment 2 looks like a duplicate of pr70149. It is fixed at
> revision r265266.

This indeed is fixed on trunk.

I am trying to build up the intestinal fortitude to go back through some of the
recent fixes and apply them to 8-branch.

However, I will close this one now.

Thanks for the report.

Paul

[Bug fortran/71880] pointer to allocatable character

2018-10-21 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

--- Comment #10 from Paul Thomas  ---
Author: pault
Date: Sun Oct 21 17:32:06 2018
New Revision: 265353

URL: https://gcc.gnu.org/viewcvs?rev=265353=gcc=rev
Log:
2018-10-21  Paul Thomas  

PR fortran/71880
* trans-expr.c (gfc_trans_pointer_assignment): Set the string
length for array valued deferred length lhs.

2018-10-21  Paul Thomas  

PR fortran/71880
* gfortran.dg/deferred_character_31.f90 : New test.


Added:
trunk/gcc/testsuite/gfortran.dg/deferred_character_31.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/71880] pointer to allocatable character

2018-10-19 Thread paul.richard.thomas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

--- Comment #9 from paul.richard.thomas at gmail dot com  ---
Not quite fixed. The lhs character length doesn't get set and so it
fails at runtime. I will commit the patch as 'obvious'.

Paul

2018-10-19  Paul Thomas  

PR fortran/71880
* trans-expr.c (gfc_trans_pointer_assignment): Set the string
length for array valued deferred length lhs.

2018-10-19  Paul Thomas  

PR fortran/71880
* gfortran.dg/deferred_character_31.f90 : New test.

On Thu, 18 Oct 2018 at 22:12, dominiq at lps dot ens.fr
 wrote:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880
>
> Dominique d'Humieres  changed:
>
>What|Removed |Added
> 
>  CC||pault at gcc dot gnu.org
>
> --- Comment #8 from Dominique d'Humieres  ---
> The test in comment 2 looks like a duplicate of pr70149. It is fixed at
> revision r265266.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.

[Bug fortran/71880] pointer to allocatable character

2018-10-18 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

Dominique d'Humieres  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org

--- Comment #8 from Dominique d'Humieres  ---
The test in comment 2 looks like a duplicate of pr70149. It is fixed at
revision r265266.

[Bug fortran/71880] pointer to allocatable character

2017-01-02 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

--- Comment #7 from Harald Anlauf  ---
(In reply to Harald Anlauf from comment #6)
> Additional data points:
> 
> - The ICE in comment #4 can be reproduced with
> 
>   character(:), dimension(:), pointer :: p => NULL()
>   write(*,*) size(p)! ICE
>   write(*,*) len(p) ! ICE
> end

The ICE is generated by the assert at trans-decl.c:1738

  /* Associate names can use the hidden string length variable
 of their associated target.  */
  if (sym->ts.type == BT_CHARACTER
  && TREE_CODE (length) != INTEGER_CST)
{
  gfc_finish_var_decl (length, sym);
  gcc_assert (!sym->value);
}

It does not show up when the initialization is removed,
or when the "pointer" is replaced by "allocatable".

[Bug fortran/71880] pointer to allocatable character

2017-01-02 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

--- Comment #6 from Harald Anlauf  ---
Additional data points:

- The ICE in comment #4 can be reproduced with

  character(:), dimension(:), pointer :: p => NULL()
  write(*,*) size(p)! ICE
  write(*,*) len(p) ! ICE
end

- The bug in the other comments also shows up when one replaces

  character(:), dimension(:), allocatable, target :: c

by

  character(1), dimension(:), allocatable, target :: c

[Bug fortran/71880] pointer to allocatable character

2017-01-01 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

--- Comment #5 from Harald Anlauf  ---
Maybe the dump-tree gives a hint.  Looking at the example

program t
  character(:), dimension(:), allocatable, target :: c
  character(:), dimension(:), pointer :: p
  allocate(c(10),source='X')
  p=>c
  write(*,*) size(c),len(c) !,' c=<',c(1),'>'
  write(*,*) size(p),len(p) !,' p=<',p(1),'>'
end program t

I find:

t ()
{
  integer(kind=4) .c;
  struct array1_unknown c;
  integer(kind=4) .p;
  struct array1_unknown p;
[...]
.c = 1;
[...]

but .p seems to never get set.  (.c, .p are the quantities
that are printed as the len(c),len(p)).

[Bug fortran/71880] pointer to allocatable character

2016-12-30 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

Harald Anlauf  changed:

   What|Removed |Added

 CC||anlauf at gmx dot de

--- Comment #4 from Harald Anlauf  ---
For a minor variant with NULLified p I get an ICE with trunk:

program t
  character(:), dimension(:), allocatable, target :: c
  character(:), dimension(:), pointer :: p => NULL()
  allocate(c(10),source='X')
  p=>c
end program t

% gfc-trunk -c pr71880.f90
pr71880.f90:1:0:

 program t

internal compiler error: in gfc_get_symbol_decl, at fortran/trans-decl.c:1738
0x838f263 gfc_get_symbol_decl(gfc_symbol*)
../../trunk/gcc/fortran/trans-decl.c:1738
0x838f9b7 generate_local_decl
../../trunk/gcc/fortran/trans-decl.c:5356
0x8341e23 do_traverse_symtree
../../trunk/gcc/fortran/symbol.c:3986
0x83934c8 generate_local_vars
../../trunk/gcc/fortran/trans-decl.c:5556
0x83934c8 gfc_generate_function_code(gfc_namespace*)
../../trunk/gcc/fortran/trans-decl.c:6220
0x8312713 translate_all_program_units
../../trunk/gcc/fortran/parse.c:6008
0x8312713 gfc_parse_file()
../../trunk/gcc/fortran/parse.c:6208
0x8357ea5 gfc_be_parse_file
../../trunk/gcc/fortran/f95-lang.c:202

[Bug fortran/71880] pointer to allocatable character

2016-12-30 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

--- Comment #3 from Dominique d'Humieres  ---
When compiled with '-m64 -fsanitize=address' the test give at run time

=
==81688==ERROR: AddressSanitizer: negative-size-param: (size=-1)
#0 0x10f4d9b3b in wrap_memmove (/opt/gcc/gcc7a/lib/libasan.4.dylib+0x41b3b)
#1 0x10f3e0032 in list_formatted_write_scalar
(/opt/gcc/gcc7a/lib/libgfortran.4.dylib+0x142032)

0x60200150 is located 0 bytes inside of 10-byte region
[0x60200150,0x6020015a)
allocated by thread T0 here:
#0 0x10f4fa96d in wrap_malloc (/opt/gcc/gcc7a/lib/libasan.4.dylib+0x6296d)
#1 0x10f29b10d in MAIN__
(/Users/dominiq/Documents/Fortran/g95bench/win/f90/bug/a.out+0x1110d)
#2 0x10f29b956 in main
(/Users/dominiq/Documents/Fortran/g95bench/win/f90/bug/a.out+0x11956)
#3 0x7fff94598254 in start (/usr/lib/system/libdyld.dylib+0x5254)

SUMMARY: AddressSanitizer: negative-size-param
(/opt/gcc/gcc7a/lib/libasan.4.dylib+0x41b3b) in wrap_memmove
==81688==ABORTING

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x10f2a0979
#1  0x10f29fd13
#2  0x7fff947a5bb9
Abort

When compiled with '-m32 -fsanitize=address' they give

ASAN:DEADLYSIGNAL
=
==75073==ERROR: AddressSanitizer: SEGV on unknown address 0x2400 (pc
0x00357260 bp 0x0002 sp 0xbfffba20 T0)
#0 0x35725f in __sanitizer::mem_is_zero(char const*, unsigned long)
(/opt/gcc/gcc7a/lib/i386/libasan.4.dylib+0x8425f)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV
(/opt/gcc/gcc7a/lib/i386/libasan.4.dylib+0x8425f) in
__sanitizer::mem_is_zero(char const*, unsigned long)
==75073==ABORTING

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0xf124f
#1  0xf05be
#2  0x9f98beba
Abort

[Bug fortran/71880] pointer to allocatable character

2016-07-15 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-07-15
 Ever confirmed|0   |1

--- Comment #2 from Dominique d'Humieres  ---
Confirmed from 5.4.0 up to trunk (7.0). Compiling the tests with gcc-4.8/9
gives an ICE.

[Bug fortran/71880] pointer to allocatable character

2016-07-14 Thread valeryweber at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71880

--- Comment #1 from Valery Weber  ---
what about this one?

cat gcc-6.1b.f90
program t
character(:), dimension(:), allocatable, target :: c
character(:), dimension(:), pointer :: p
allocate(c(10),source='X')
p=>c(:)
write(*,*) 'p=<',p(1),'> c=<',c(1),'>',len(p(1))
end program t


gfortran-6.1.0 gcc-6.1b.f90 
./a.out 
p= c=   32674