public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48876] New: ICE when initializing character variable with zero-length string
@ 2011-05-04 20:58 mhp77 at gmx dot at
  2011-05-04 21:22 ` [Bug fortran/48876] " mhp77 at gmx dot at
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mhp77 at gmx dot at @ 2011-05-04 20:58 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE when initializing character variable with
                    zero-length string
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mhp77@gmx.at


The following Fortran program compiles without errors:

program test
  character ::  string =  "string"( : 0 )
end program test

On the other hand, compiling the semantically equivalent program

program test
  character ::  string =  "string"( : - 1 )
end program test

leads to an internal compiler error. Interestingly, if the ending point of the
substring is less than -2 the internal compiler error turns into an "out of
memory" error.

$ gfortran-4.6 -v -c test.f90

Using built-in specs.

COLLECT_GCC=gfortran-4.6

COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper

Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.0-2'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-multiarch
--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-plugin --enable-gold --enable-ld=default --with-plugin-ld
--enable-objc-gc --with-arch-32=i586 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu

Thread model: posix

gcc version 4.6.1 20110329 (prerelease) (Debian 4.6.0-2)

COLLECT_GCC_OPTIONS='-v' '-c' '-mtune=generic' '-march=x86-64'

/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951 test.f90 -quiet -dumpbase test.f90
-mtune=generic -march=x86-64 -auxbase test -version -fintrinsic-modules-path
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/finclude -o /tmp/ccWeUXPn.s

GNU Fortran (Debian 4.6.0-2) version 4.6.1 20110329 (prerelease)
(x86_64-linux-gnu)
compiled by GNU C version 4.6.1 20110329 (prerelease), GMP version 5.0.1, MPFR
version 3.0.0-p8, MPC version 0.9

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072

GNU Fortran (Debian 4.6.0-2) version 4.6.1 20110329 (prerelease)
(x86_64-linux-gnu)
compiled by GNU C version 4.6.1 20110329 (prerelease), GMP version 5.0.1, MPFR
version 3.0.0-p8, MPC version 0.9

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072

*** glibc detected *** /usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951: malloc():
smallbin double linked list corrupted: 0x0000000001e98f50 *** 

======= Backtrace: =========
/lib/libc.so.6(+0x71ad6)[0x2b666912bad6]
/lib/libc.so.6(+0x753ed)[0x2b666912f3ed]
/lib/libc.so.6(__libc_malloc+0x70)[0x2b6669130930]
/lib/libc.so.6(+0x2f682)[0x2b66690e9682]
/lib/libc.so.6(+0x2d8b5)[0x2b66690e78b5]
/lib/libc.so.6(+0x2d1a0)[0x2b66690e71a0]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951[0x7b07c1]
/lib/libc.so.6(+0x321e0)[0x2b66690ec1e0]
/lib/libc.so.6(memcpy+0x2eb)[0x2b6669139a3b]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951(gfc_simplify_expr+0x213)[0x4e0273]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951[0x4df07e]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951(gfc_reduce_init_expr+0x78)[0x4df8f8]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951(gfc_match_init_expr+0x5a)[0x4df95a]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951(gfc_match_data_decl+0xde4)[0x4d28b4]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951[0x51609a]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951[0x51680a]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951[0x517d35]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951[0x5190e5]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951[0x51a799]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951(gfc_parse_file+0x3ff)[0x51b6df]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951[0x554136]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951(toplev_main+0xd82)[0x7b2752]
/lib/libc.so.6(__libc_start_main+0xfd)[0x2b66690d8c4d]
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951[0x4b5319]

======= Memory map: ========
...

f951: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.


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

* [Bug fortran/48876] ICE when initializing character variable with zero-length string
  2011-05-04 20:58 [Bug fortran/48876] New: ICE when initializing character variable with zero-length string mhp77 at gmx dot at
@ 2011-05-04 21:22 ` mhp77 at gmx dot at
  2011-07-24  2:04 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mhp77 at gmx dot at @ 2011-05-04 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from mhp77 at gmx dot at 2011-05-04 21:08:09 UTC ---
Created attachment 24187
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24187
test case


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

* [Bug fortran/48876] ICE when initializing character variable with zero-length string
  2011-05-04 20:58 [Bug fortran/48876] New: ICE when initializing character variable with zero-length string mhp77 at gmx dot at
  2011-05-04 21:22 ` [Bug fortran/48876] " mhp77 at gmx dot at
@ 2011-07-24  2:04 ` pinskia at gcc dot gnu.org
  2011-07-30  9:56 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-07-24  2:04 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.07.24 02:04:22
     Ever Confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-07-24 02:04:22 UTC ---
Confirmed.


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

* [Bug fortran/48876] ICE when initializing character variable with zero-length string
  2011-05-04 20:58 [Bug fortran/48876] New: ICE when initializing character variable with zero-length string mhp77 at gmx dot at
  2011-05-04 21:22 ` [Bug fortran/48876] " mhp77 at gmx dot at
  2011-07-24  2:04 ` pinskia at gcc dot gnu.org
@ 2011-07-30  9:56 ` tkoenig at gcc dot gnu.org
  2011-07-30 18:18 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-07-30  9:56 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |tkoenig at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-07-30 09:56:30 UTC ---
Taking a look.


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

* [Bug fortran/48876] ICE when initializing character variable with zero-length string
  2011-05-04 20:58 [Bug fortran/48876] New: ICE when initializing character variable with zero-length string mhp77 at gmx dot at
                   ` (2 preceding siblings ...)
  2011-07-30  9:56 ` tkoenig at gcc dot gnu.org
@ 2011-07-30 18:18 ` tkoenig at gcc dot gnu.org
  2011-07-30 21:33 ` tkoenig at gcc dot gnu.org
  2011-07-30 22:59 ` tkoenig at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-07-30 18:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-07-30 18:17:57 UTC ---
Author: tkoenig
Date: Sat Jul 30 18:17:55 2011
New Revision: 176961

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176961
Log:
2011-07-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/48876
    * expr.c (gfc_simplify_expr):  If end of a string is less
    than zero, set it to zero.

2011-07-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/48876
    * gfortran.dg/string_5.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/string_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/48876] ICE when initializing character variable with zero-length string
  2011-05-04 20:58 [Bug fortran/48876] New: ICE when initializing character variable with zero-length string mhp77 at gmx dot at
                   ` (3 preceding siblings ...)
  2011-07-30 18:18 ` tkoenig at gcc dot gnu.org
@ 2011-07-30 21:33 ` tkoenig at gcc dot gnu.org
  2011-07-30 22:59 ` tkoenig at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-07-30 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-07-30 21:33:14 UTC ---
Author: tkoenig
Date: Sat Jul 30 21:33:11 2011
New Revision: 176963

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176963
Log:
2011-07-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

    Backport from trunk.
    PR fortran/48876
    * expr.c (gfc_simplify_expr):  If end of a string is less
    than zero, set it to zero.

2011-07-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

    Backport from trunk.
    PR fortran/48876
    * gfortran.dg/string_5.f90:  New test.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/string_5.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/expr.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/48876] ICE when initializing character variable with zero-length string
  2011-05-04 20:58 [Bug fortran/48876] New: ICE when initializing character variable with zero-length string mhp77 at gmx dot at
                   ` (4 preceding siblings ...)
  2011-07-30 21:33 ` tkoenig at gcc dot gnu.org
@ 2011-07-30 22:59 ` tkoenig at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-07-30 22:59 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-07-30 22:59:02 UTC ---
Fixed on trunk and 4.6.  Closing.


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

end of thread, other threads:[~2011-07-30 22:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 20:58 [Bug fortran/48876] New: ICE when initializing character variable with zero-length string mhp77 at gmx dot at
2011-05-04 21:22 ` [Bug fortran/48876] " mhp77 at gmx dot at
2011-07-24  2:04 ` pinskia at gcc dot gnu.org
2011-07-30  9:56 ` tkoenig at gcc dot gnu.org
2011-07-30 18:18 ` tkoenig at gcc dot gnu.org
2011-07-30 21:33 ` tkoenig at gcc dot gnu.org
2011-07-30 22:59 ` tkoenig at gcc dot gnu.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).