[Bug fortran/52542] New: Procedure with a Bind (C) named interface does not inherit the Bind (C)

2012-03-09 Thread mathewc at nag dot co.uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52542

 Bug #: 52542
   Summary: Procedure with a Bind (C) named interface does not
inherit the Bind (C)
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: math...@nag.co.uk


$ uname -a
Linux stonehenge 3.2.9-1.fc16.x86_64 #1 SMP Thu Mar 1 01:41:10 UTC 2012 x86_64
x86_64 x86_64 GNU/Linux

$ gfortran --version
GNU Fortran (GCC) 4.8.0 20120309 (experimental) [trunk revision 185121]

$ cat bind.f90
interface
  subroutine s() bind(c)
  end subroutine s
end interface
procedure(s) :: t
call t
end

$ gfortran -c bind.f90 ; nm bind.o
 t MAIN__
 U _gfortran_set_args
 U _gfortran_set_options
000b T main
 r options.0.1852
 U t_

Note: that should be 't', not 't_'.


[Bug fortran/52585] New: Dummy procedure pointer loses its pointer association status

2012-03-14 Thread mathewc at nag dot co.uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52585

 Bug #: 52585
   Summary: Dummy procedure pointer loses its pointer association
status
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: math...@nag.co.uk


$ uname -a
Linux stonehenge 3.2.9-2.fc16.x86_64 #1 SMP Mon Mar 5 20:55:39 UTC 2012 x86_64
x86_64 x86_64 GNU/Linux

$ gfortran --version
GNU Fortran (GCC) 4.8.0 20120314 (experimental) [trunk revision 185372]

$ cat p_assoc.f90
module m0
abstract interface
  subroutine sub
  end subroutine sub
end interface
interface
  subroutine s(ss)
import sub
procedure(sub), pointer, intent(in) :: ss
  end subroutine s
end interface
end module m0
use m0, only : sub, s
procedure(sub) :: sub2, pp
pointer :: pp
pp => sub2
if (.not. associated(pp,sub2)) stop 'FAIL'
call s(pp)
end
subroutine s(ss)
  use m0, only : sub
  procedure(sub), pointer, intent(in) :: ss
  procedure(sub) :: sub2
  if (.not. associated(ss,sub2)) stop 'FAIL2'
end subroutine s
subroutine sub2
end subroutine sub2

$ gfortran p_assoc.f90 ; ./a.out
STOP FAIL2


[Bug fortran/52789] New: gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense

2012-03-30 Thread mathewc at nag dot co.uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52789

 Bug #: 52789
   Summary: gfortran sets -Wunused-parameter in the C sense as
well as the Fortran sense
Classification: Unclassified
   Product: gcc
   Version: 4.6.3
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: fortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: math...@nag.co.uk


I'm using

$ uname -a
Linux stonehenge 3.3.0-4.fc16.x86_64 #1 SMP Tue Mar 20 18:05:40 UTC 2012 x86_64
x86_64 x86_64 GNU/Linux

$ gfortran --version
GNU Fortran (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)

and with

$ cat unused.f90
subroutine s(x)
integer, parameter :: i = 0
end

I get

$ gfortran -Wunused-parameter -c unused.f90
unused.f90:2.23:

integer, parameter :: i = 0
   1
Warning: Unused parameter 'i' declared at (1)
unused.f90:1:0: warning: unused parameter ‘x’ [-Wunused-parameter]

I think the C warning used to be suppressed at 4.5(?).

Specifying -Wunused-dummy-argument gets rid of the C message:

$ gfortran -Wunused-parameter -Wunused-dummy-argument -c unused.f90
unused.f90:2.23:

integer, parameter :: i = 0
   1
Warning: Unused parameter 'i' declared at (1)
unused.f90:1.14:

subroutine s(x)
  1
Warning: Unused dummy argument 'x' at (1)


[Bug fortran/52789] gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense

2012-03-30 Thread mathewc at nag dot co.uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52789

--- Comment #2 from Mat Cross  2012-03-30 16:22:34 
UTC ---
(In reply to comment #1)
> So?

If I RTM I see:

"-Wunused-parameter
Contrary to gcc's meaning of -Wunused-parameter, gfortran's implementation
of this option does not warn about unused dummy arguments (see
-Wunused-dummy-argument), but about unused PARAMETER values. -Wunused-parameter
is not included in -Wall but is implied by -Wall -Wextra."


[Bug fortran/52789] gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense

2012-04-02 Thread mathewc at nag dot co.uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52789

--- Comment #4 from Mat Cross  2012-04-02 08:03:22 
UTC ---
(In reply to comment #3)
> Can you maybe check on trunk/4.7.0 ?

I've just tried with

$ gfortran --version
GNU Fortran (GCC) 4.7.1 20120331 (prerelease)

$ gfortran -c -Wunused-parameter unused.f90
unused.f90:2.23:

integer, parameter :: i = 0
   1
Warning: Unused parameter 'i' declared at (1)
unused.f90:1:0: warning: unused parameter ‘x’ [-Wunused-parameter]

and

$ gfortran --version
GNU Fortran (GCC) 4.8.0 20120330 (experimental) [trunk revision 185988]

$ gfortran -c -Wunused-parameter unused.f90
unused.f90:2.23:

integer, parameter :: i = 0
   1
Warning: Unused parameter 'i' declared at (1)
unused.f90:1:0: warning: unused parameter ‘x’ [-Wunused-parameter]


[Bug fortran/59107] New: Spurious "Type specified for intrinsic function 'command_argument_count' at (1) is ignored" under -Wsurprising.

2013-11-13 Thread mathewc at nag dot co.uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59107

Bug ID: 59107
   Summary: Spurious "Type specified for intrinsic function
'command_argument_count' at (1) is ignored" under
-Wsurprising.
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
      Reporter: mathewc at nag dot co.uk

> cat test.f90
Program p
  Integer :: nargs
  Intrinsic :: command_argument_count
  nargs = command_argument_count()
End
> gfortran --version
GNU Fortran (GCC) 4.8.2 20131017 (Red Hat 4.8.2-1)
> gfortran -Wsurprising test.f90
test.f90:3.37:

  Intrinsic :: command_argument_count
 1
Warning: Type specified for intrinsic function 'command_argument_count' at (1)
is ignored


[Bug fortran/81447] New: gfortran fails to recognize the exact dynamic type of a polymorphic entity that was allocated in a external procedure

2017-07-14 Thread mathewc at nag dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81447

Bug ID: 81447
   Summary: gfortran fails to recognize the exact dynamic type of
a polymorphic entity that was allocated in a external
procedure
   Product: gcc
   Version: 7.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mathewc at nag dot co.uk
  Target Milestone: ---

> uname -a && gfortran --version && cat foo.f90 && gfortran foo.f90 && ./a.out
Linux cuivienen.nag.co.uk 4.11.9-300.fc26.x86_64 #1 SMP Wed Jul 5 16:21:56 UTC
2017 x86_64 x86_64 x86_64 GNU/Linux
GNU Fortran (GCC) 7.1.1 20170622 (Red Hat 7.1.1-3)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Module m
  Type :: t
  End Type
End Module
Program p
  Use m
  Class (t), Allocatable :: x
  Interface
Subroutine s(x)
  Use m
  Class (t), Allocatable :: x
End Subroutine
  End Interface
  Call s(x)
  Select Type (x)
  Type Is (t)
Continue
  Class Is (t)
Stop 'Inconceivable t'
  Class Default
Stop 'Inconceivable *'
  End Select
  Print *, 'ok'
End Program
Subroutine s(x)
  Use m, Only: t
  Implicit None
  Class (t), Allocatable :: x
  Allocate (t :: x)
End Subroutine
STOP Inconceivable t

Note that the version with s internal to p is OK:

Module m
  Type :: t
  End Type
End Module
Program p
  Use m
  Class (t), Allocatable :: x
  Call s(x)
  Select Type (x)
  Type Is (t)
Continue
  Class Is (t)
Stop 'Inconceivable t'
  Class Default
Stop 'Inconceivable *'
  End Select
  Print *, 'ok'
Contains
  Subroutine s(x)
Use m, Only: t
Implicit None
Class (t), Allocatable :: x
Allocate (t :: x)
  End Subroutine
End Program
 ok

[Bug fortran/77507] New: gfortran rejects keyworded calls to procedures from intrinsic modules

2016-09-07 Thread mathewc at nag dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77507

Bug ID: 77507
   Summary: gfortran rejects keyworded calls to procedures from
intrinsic modules
   Product: gcc
   Version: 6.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mathewc at nag dot co.uk
  Target Milestone: ---

$ uname -a && gfortran --version && cat foo.f90 && gfortran foo.f90
Linux cuivienen.nag.co.uk 4.7.2-201.fc24.x86_64 #1 SMP Fri Aug 26 15:58:40 UTC
2016 x86_64 x86_64 x86_64 GNU/Linux
GNU Fortran (GCC) 6.1.1 20160621 (Red Hat 6.1.1-3)
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Program p
  Use ieee_arithmetic
  Use iso_c_binding
  Print *, ieee_value(x=1.0, class=ieee_negative_inf)
  Print *, c_associated(c_ptr_1=c_null_ptr)
End Program
foo.f90:4:10:

   Print *, ieee_value(x=1.0, class=ieee_negative_inf)
  1
Error: There is no specific function for the generic ‘ieee_value’ at (1)
foo.f90:5:10:

   Print *, c_associated(c_ptr_1=c_null_ptr)
  1
Error: Can't find keyword named ‘c_ptr_1’ in call to ‘c_associated’ at (1)

[Bug fortran/64230] [4.9/5 Regression] Invalid memory reference in a compiler-generated finalizer for allocatable component

2015-04-24 Thread mathewc at nag dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64230

Mat Cross  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #9 from Mat Cross  ---
Thanks for the progress so far.

I built 4.9.3 to try on my larger piece of code. The problem still seems
present:

> uname -a
Linux whakarewarewa.nag.co.uk 3.19.4-200.fc21.x86_64 #1 SMP Mon Apr 13 21:43:26
UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

> gfortran --version
GNU Fortran (GCC) 4.9.3 20150415 (prerelease)

> cat test.f90
Program test
  Implicit None
  Type :: t1
Integer, Allocatable :: i
  End Type
  Type :: t2
Integer, Allocatable :: i
  End Type
  Type, Extends (t1) :: t3
Type (t2) :: j
  End Type
  Type, Extends (t3) :: t4
Integer, Allocatable :: k
  End Type
  Class (t1), Allocatable :: x
  Allocate (t4 :: x)
  Deallocate (x)
  Print *, 'ok'
End Program

> gfortran test.f90 && ./a.out

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x2B51E7B11417
#1  0x2B51E7B11A2E
#2  0x3265A3495F
#3  0x401392 in __final_test_T3.2353 at test.f90:?
#4  0x400D45 in __final_test_T4.2342 at test.f90:?
#5  0x400E87 in MAIN__ at test.f90:?
Segmentation fault (core dumped)

Do you see this too?

I hope that reopening this PR is acceptable. If not then just let me know and I
will happily file a new one.


[Bug fortran/64230] [4.9/5 Regression] Invalid memory reference in a compiler-generated finalizer for allocatable component

2015-04-26 Thread mathewc at nag dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64230

Mat Cross  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Mat Cross  ---
I've restored the closure status and I'll keep an eye on how PR64921 goes.


[Bug fortran/64921] [4.9/5/6 Regression] FAIL: gfortran.dg/class_allocate_18.f90

2015-04-27 Thread mathewc at nag dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64921

--- Comment #14 from Mat Cross  ---
For the record, perhaps it is of interest for me to note that we are running
into this (cf. PR64230 comment 9) on code like

Program test
  Implicit None
  Type :: t1
Integer, Allocatable :: i
  End Type
  Type :: t2
Integer, Allocatable :: i
  End Type
  Type, Extends (t1) :: t3
Type (t2) :: j
  End Type
  Type, Extends (t3) :: t4
Integer, Allocatable :: k
  End Type
  Call s
  Print *, 'ok'
Contains
  Subroutine s
Class (t1), Allocatable :: x
Allocate (t4 :: x)
  End Subroutine
End Program

Since the crash is in bad compiler-generated finalization code (since 4.9), and
given that (if I recall correctly) gfortran is using the Fortran 2008 semantics
for entities declared in a main program being implicitly saved, this is why
removing the Deallocate (in the comment 12 example) works - the finalizer is
never called then.

In the interim, does anyone have any bright ideas for a reasonable (few-line)
workaround?

Thanks.


[Bug fortran/64230] New: Segmentation fault - invalid memory reference in a compiler-generated finalizer for a complicated type hierarchy when a polymorphic variable is allocated in an external proced

2014-12-08 Thread mathewc at nag dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64230

Bug ID: 64230
   Summary: Segmentation fault - invalid memory reference in a
compiler-generated finalizer for a complicated type
hierarchy when a polymorphic variable is allocated in
an external procedure.
   Product: gcc
   Version: 4.9.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mathewc at nag dot co.uk

> uname -a
Linux whakarewarewa.nag.co.uk 3.17.4-301.fc21.x86_64 #1 SMP Thu Nov 27 19:09:10
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

> gfortran --version
GNU Fortran (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1)

> cat test.f90
Module m
  Implicit None
  Type, Public :: t1
Integer, Allocatable :: i(:)
  End Type
  Type, Public :: t2
Integer, Allocatable :: i(:)
  End Type
  Type, Public :: t3
Type (t2) :: t
  End Type
  Type, Public :: t4
  End Type
  Type, Public, Extends (t4) :: t5
Type (t1) :: t_c1
  End Type
  Type, Public, Extends (t4) :: t6
Type (t5) :: t_c2
  End Type
  Type, Public, Extends (t6) :: t7
Type (t3) :: t_c3
  End Type
End Module
Program main
  Use m
  Implicit None
  Interface
Subroutine s(t)
  Use m
  Class (t4), Allocatable, Intent (Out) :: t
End Subroutine
  End Interface
  Class (t4), Allocatable :: t
  Call s(t)
  Deallocate (t)
End Program
Subroutine s(t)
  Use m
  Class (t4), Allocatable, Intent (Out) :: t
  Allocate (t7 :: t)
End Subroutine

> gfortran test.f90 && ./a.out

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x2B18DDE51517
#1  0x2B18DDE51B5E
#2  0x3E2B23494F
#3  0x401294 in __final_m_T6.2389 at test.f90:?
#4  0x400BEE in __final_m_T7.2378 at test.f90:?
#5  0x40159A in MAIN__ at test.f90:?
Segmentation fault (core dumped)

PS This works OK with 4.8.3.


[Bug libfortran/68987] New: double free or corruption in _gfortran_st_write_done when a write statement to an internal file uses an invalid format and the ERR= specifier appears.

2015-12-18 Thread mathewc at nag dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68987

Bug ID: 68987
   Summary: double free or corruption in _gfortran_st_write_done
when a write statement to an internal file uses an
invalid format and the ERR= specifier appears.
   Product: gcc
   Version: 5.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libfortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mathewc at nag dot co.uk
  Target Milestone: ---

I'm using

> gfortran --version
GNU Fortran (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)

on

> uname -a
Linux cuivienen.nag.co.uk 4.2.7-300.fc23.x86_64 #1 SMP Wed Dec 9 22:28:30 UTC
2015 x86_64 x86_64 x86_64 GNU/Linux

> /lib/libc.so.6
GNU C Library (GNU libc) stable release version 2.22, by Roland McGrath et al.
...
Compiled by GNU CC version 5.1.1 20150618 (Red Hat 5.1.1-4).

and then with

> cat foo.f90 && gfortran foo.f90 && ./a.out
Program foo
  Call s('(foo)')
End Program
Subroutine s(fmt)
  Character (*) :: fmt
  Character (1) :: c
  Integer :: i
  Write (c, fmt, Iostat=i) 42
  If (i==0) Stop 'FAIL1'
  Write (c, fmt, Err=100) 42
  Stop 'FAIL2'
100 Continue
  Print *, 'ok'
End Subroutine
*** Error in `./a.out': double free or corruption (out): 0x01050360 ***
=== Backtrace: =
/lib64/libc.so.6(+0x77e35)[0x2b46ad0cae35]
/lib64/libc.so.6(+0x8051a)[0x2b46ad0d351a]
/lib64/libc.so.6(cfree+0x4c)[0x2b46ad0d6ccc]
/lib64/libgfortran.so.3(_gfortran_st_write_done+0x7b)[0x2b46ac6bcdab]
./a.out[0x400a0a]
./a.out[0x400a9e]
./a.out[0x400ad5]
/lib64/libc.so.6(__libc_start_main+0xf0)[0x2b46ad073580]
./a.out[0x4007b9]
=== Memory map: 
0040-00401000 r-xp  00:2b 43527338  
/fserver/mathewc/test_f/a.out
0060-00601000 r--p  00:2b 43527338  
/fserver/mathewc/test_f/a.out
00601000-00602000 rw-p 1000 00:2b 43527338  
/fserver/mathewc/test_f/a.out
0104d000-0106e000 rw-p  00:00 0  [heap]
2b46ac3ac000-2b46ac3cd000 r-xp  fd:01 1315819   
/usr/lib64/ld-2.22.so
2b46ac3cd000-2b46ac3cf000 rw-p  00:00 0 
2b46ac3ec000-2b46ac3ef000 rw-p  00:00 0 
2b46ac5cc000-2b46ac5cd000 r--p 0002 fd:01 1315819   
/usr/lib64/ld-2.22.so
2b46ac5cd000-2b46ac5ce000 rw-p 00021000 fd:01 1315819   
/usr/lib64/ld-2.22.so
2b46ac5ce000-2b46ac5cf000 rw-p  00:00 0 
2b46ac5cf000-2b46ac6f7000 r-xp  fd:01 1321356   
/usr/lib64/libgfortran.so.3.0.0
2b46ac6f7000-2b46ac8f7000 ---p 00128000 fd:01 1321356   
/usr/lib64/libgfortran.so.3.0.0
2b46ac8f7000-2b46ac8f9000 r--p 00128000 fd:01 1321356   
/usr/lib64/libgfortran.so.3.0.0
2b46ac8f9000-2b46ac8fb000 rw-p 0012a000 fd:01 1321356   
/usr/lib64/libgfortran.so.3.0.0
2b46ac8fb000-2b46ac9fc000 r-xp  fd:01 1321296   
/usr/lib64/libm-2.22.so
2b46ac9fc000-2b46acbfb000 ---p 00101000 fd:01 1321296   
/usr/lib64/libm-2.22.so
2b46acbfb000-2b46acbfc000 r--p 0010 fd:01 1321296   
/usr/lib64/libm-2.22.so
2b46acbfc000-2b46acbfd000 rw-p 00101000 fd:01 1321296   
/usr/lib64/libm-2.22.so
2b46acbfd000-2b46acc13000 r-xp  fd:01 1312410   
/usr/lib64/libgcc_s-5.3.1-20151207.so.1
2b46acc13000-2b46ace12000 ---p 00016000 fd:01 1312410   
/usr/lib64/libgcc_s-5.3.1-20151207.so.1
2b46ace12000-2b46ace13000 r--p 00015000 fd:01 1312410   
/usr/lib64/libgcc_s-5.3.1-20151207.so.1
2b46ace13000-2b46ace14000 rw-p 00016000 fd:01 1312410   
/usr/lib64/libgcc_s-5.3.1-20151207.so.1
2b46ace14000-2b46ace52000 r-xp  fd:01 1312475   
/usr/lib64/libquadmath.so.0.0.0
2b46ace52000-2b46ad051000 ---p 0003e000 fd:01 1312475   
/usr/lib64/libquadmath.so.0.0.0
2b46ad051000-2b46ad052000 r--p 0003d000 fd:01 1312475   
/usr/lib64/libquadmath.so.0.0.0
2b46ad052000-2b46ad053000 rw-p 0003e000 fd:01 1312475   
/usr/lib64/libquadmath.so.0.0.0
2b46ad053000-2b46ad20a000 r-xp  fd:01 1321289   
/usr/lib64/libc-2.22.so
2b46ad20a000-2b46ad40a000 ---p 001b7000 fd:01 1321289   
/usr/lib64/libc-2.22.so
2b46ad40a000-2b46ad40e000 r--p 001b7000 fd:01 1321289   
/usr/lib64/libc-2.22.so
2b46ad40e000-2b46ad41 rw-p 001bb000 fd:01 1321289   
/usr/lib64/libc-2.22.so
2b46ad41-2b46ad414000 rw-p  00:00 0 
2b46b000-2b46b0021000 rw-p  00:00 0 
2b46b0021000-2b46b400 ---p  00:00 0 
7ffdd7827000-7ffdd7848000 rw-p  00:00 0 
[stack]
7ffdd785d000-7ffdd785f000 r--p  00:00 0  

[Bug fortran/46705] New: Spurious "Missing '&' in continued character constant" warning occurs twice

2010-11-29 Thread mathewc at nag dot co.uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46705

   Summary: Spurious "Missing '&' in continued character constant"
warning occurs twice
   Product: gcc
   Version: fortran-dev
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: math...@nag.co.uk


> uname -a
Linux loanamd27 2.6.11.4-20a-smp #1 SMP Wed Mar 23 21:52:37 UTC 2005 x86_64
x86_64 x86_64 GNU/Linux

> gfortran --version
GNU Fortran (GCC) 4.6.0 20101120 (experimental)

> cat contin_char.f90 
1 FORMAT (''&
   )
END

> gfortran -Wampersand contin_char.f90
contin_char.f90:2.8:

   )
1
Warning: Missing '&' in continued character constant at (1)
contin_char.f90:2.8:

   )
1
Warning: Missing '&' in continued character constant at (1)


[Bug libfortran/49885] New: Segmentation fault when writing to an automatic character array

2011-07-28 Thread mathewc at nag dot co.uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49885

   Summary: Segmentation fault when writing to an automatic
character array
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libfortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: math...@nag.co.uk


> uname -a
Linux tiree.nag.co.uk 2.6.27.41-170.2.117.fc10.x86_64 #1 SMP Thu Dec 10
10:36:29 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

> gfortran --version
GNU Fortran (GCC) 4.7.0 20110723 (experimental)

> cat gf.f90
subroutine s(nb)
  integer :: nb
  character (max(80,nb)) :: bad_rec(1)
  write (bad_rec,'(I1)') 0
end
call s(10)
end

> gfortran gf.f90 ; ./a.out
Segmentation fault

Note that the program executes fine if declaration for bad_rec is changed to
any of:

  character (nb) :: bad_rec(1)
  character (max(80,nb)) :: bad_rec