public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30814]  New: non-conforming array sizes in assignment using pack not caught
@ 2007-02-15 23:58 glv at maths dot otago dot ac dot nz
  2007-02-16 16:09 ` [Bug fortran/30814] non-conforming array sizes in PACK should raise an error fxcoudert at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: glv at maths dot otago dot ac dot nz @ 2007-02-15 23:58 UTC (permalink / raw)
  To: gcc-bugs

Hi All

Using the command line: gfortran -fbounds-check test.f95, I compiled this:

program test
integer :: it, neighbrs(var)
neighbrs = pack( (/ ( it, it=1, 30 ) /),   (/ ( it, it=1, 30 ) /) < 3,  (/ ( 0,
it=1, 30 ) /)  )
end program test

substituting different values for var to get different results.  
When var is not chosen well, the non-conforming sizes of the array asignment
are not caught as errors.  
Sometimes at running glibc catches errors.

Examples - all of these should fail with incorrect array sizes, but they don't:

if var=18
*** glibc detected *** ./a.out: free(): invalid next size (fast):
0x0000000000508460 ***
(plus a whole lot of other guff.  let me know if you want to see that)

if var=19
*** glibc detected *** ./a.out: double free or corruption (out):
0x0000000000508460 ***

if var = 27 it compiles and runs without error

Thanks, Gareth


-- 
           Summary: non-conforming array sizes in assignment using pack not
                    caught
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: glv at maths dot otago dot ac dot nz
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux


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


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

* [Bug fortran/30814] non-conforming array sizes in PACK should raise an error
  2007-02-15 23:58 [Bug fortran/30814] New: non-conforming array sizes in assignment using pack not caught glv at maths dot otago dot ac dot nz
@ 2007-02-16 16:09 ` fxcoudert at gcc dot gnu dot org
  2007-07-10 19:16 ` tkoenig at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-02-16 16:09 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |27766
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|x86_64-redhat-linux         |
   GCC host triplet|x86_64-redhat-linux         |
 GCC target triplet|x86_64-redhat-linux         |
           Keywords|                            |diagnostic
      Known to work|                            |4.2.0 4.3.0 4.1.3
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-16 16:08:46
               date|                            |
            Summary|non-conforming array sizes  |non-conforming array sizes
                   |in assignment using pack not|in PACK should raise an
                   |caught                      |error


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


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

* [Bug fortran/30814] non-conforming array sizes in PACK should raise an error
  2007-02-15 23:58 [Bug fortran/30814] New: non-conforming array sizes in assignment using pack not caught glv at maths dot otago dot ac dot nz
  2007-02-16 16:09 ` [Bug fortran/30814] non-conforming array sizes in PACK should raise an error fxcoudert at gcc dot gnu dot org
@ 2007-07-10 19:16 ` tkoenig at gcc dot gnu dot org
  2007-07-20 16:44 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-07-10 19:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tkoenig at gcc dot gnu dot org  2007-07-10 19:16 -------
A nice m4 project :-)

I'll do this.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tkoenig at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-02-16 16:08:46         |2007-07-10 19:16:00
               date|                            |


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


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

* [Bug fortran/30814] non-conforming array sizes in PACK should raise an error
  2007-02-15 23:58 [Bug fortran/30814] New: non-conforming array sizes in assignment using pack not caught glv at maths dot otago dot ac dot nz
  2007-02-16 16:09 ` [Bug fortran/30814] non-conforming array sizes in PACK should raise an error fxcoudert at gcc dot gnu dot org
  2007-07-10 19:16 ` tkoenig at gcc dot gnu dot org
@ 2007-07-20 16:44 ` patchapp at dberlin dot org
  2007-07-24  5:53 ` tkoenig at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: patchapp at dberlin dot org @ 2007-07-20 16:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2007-07-20 16:43 -------
Subject: Bug number PR 30814

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01597.html


-- 


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


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

* [Bug fortran/30814] non-conforming array sizes in PACK should raise an error
  2007-02-15 23:58 [Bug fortran/30814] New: non-conforming array sizes in assignment using pack not caught glv at maths dot otago dot ac dot nz
                   ` (2 preceding siblings ...)
  2007-07-20 16:44 ` patchapp at dberlin dot org
@ 2007-07-24  5:53 ` tkoenig at gcc dot gnu dot org
  2007-07-24 19:25 ` tkoenig at gcc dot gnu dot org
  2007-07-29 20:02 ` tkoenig at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-07-24  5:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at gcc dot gnu dot org  2007-07-24 05:52 -------
Subject: Bug 30814

Author: tkoenig
Date: Tue Jul 24 05:52:44 2007
New Revision: 126866

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

        PR fortran/30814
        * trans-decl.c (generate_function_code):  Add argument
        for flag_bounds_check to the array for set_options.
        * invoke.texi:  Mention that some checks require
        -fbounds-check to be set during compilation of the
        main program.

2007-07-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/30814
        * libgfortran.h:  Add bounds_check to compile_options_t.
        * runtime/compile_options.c (set_options):  Add handling
        of compile_options.bounds_check.
        * intrinsics/pack_generic.c (pack_internal):  Also determine
        the number of elements if compile_options.bounds_check is
        true.  Raise runtime error if a different array shape is
        detected.

2007-07-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/30814
        * gfortran.dg/pack_bounds_1.f90:  New test case.


Added:
    trunk/gcc/testsuite/gfortran.dg/pack_bounds_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/pack_generic.c
    trunk/libgfortran/runtime/compile_options.c


-- 


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


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

* [Bug fortran/30814] non-conforming array sizes in PACK should raise an error
  2007-02-15 23:58 [Bug fortran/30814] New: non-conforming array sizes in assignment using pack not caught glv at maths dot otago dot ac dot nz
                   ` (3 preceding siblings ...)
  2007-07-24  5:53 ` tkoenig at gcc dot gnu dot org
@ 2007-07-24 19:25 ` tkoenig at gcc dot gnu dot org
  2007-07-29 20:02 ` tkoenig at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-07-24 19:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tkoenig at gcc dot gnu dot org  2007-07-24 19:25 -------
Fixed on trunk.

Closing.


-- 

tkoenig at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/30814] non-conforming array sizes in PACK should raise an error
  2007-02-15 23:58 [Bug fortran/30814] New: non-conforming array sizes in assignment using pack not caught glv at maths dot otago dot ac dot nz
                   ` (4 preceding siblings ...)
  2007-07-24 19:25 ` tkoenig at gcc dot gnu dot org
@ 2007-07-29 20:02 ` tkoenig at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-07-29 20:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tkoenig at gcc dot gnu dot org  2007-07-29 20:01 -------
Subject: Bug 30814

Author: tkoenig
Date: Sun Jul 29 20:01:45 2007
New Revision: 127049

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

        PR libfortran/32858
        PR libfortran/30814
        * configure.ac:  Added checks for presence of stdio.h and
        stdarg.h.  Test presence of vsnprintf().
        * configure: Regenerated.
        * config.h.in:  Regenerated.
        * libgfortran.h:  Include <stdio.h>.  Add printf attribute to
        prototype of runtime_error.  Remove prototype for st_sprintf.
        Add prototype for st_vprintf.
        * runtime/main.c (store_exec_path):  Replace st_sprintf by sprintf.
        * runtime/error.c (st_sprintf):  Remove.
        (runtime_error):  Rewrite as a variadic function.  Call
        st_vprintf().
        * intrinsics/pack_generic.c:  Output extents of LHS and RHS for
        bounds error.
        * io/open.c (new_unit):  Replace st_sprintf by sprintf.
        * io/list_read.c (convert_integer):  Likewise.
        (parse_repeat):  Likewise.
        (read_logical):  Likewise.
        (read_character):  Likewise.
        (parse_real):  Likewise.
        (read_real):  Likewise.
        (check_type):  Likewise.
        (nml_parse_qualifyer):  Likewise.
        (nml_read_obj):  Likewise.
        (nml_get_ojb_data):  Likewise.
        * io/unix.c (init_error_stream):  Remove.
        (tempfile):  Replace st_sprintf by sprintf.
        (st_vprintf):  New function.
        (st_printf):  Rewrite to call st_vprintf.
        * io/transfer.c (require_type):  Replace st_sprintf by sprintf.
        * io/format.c (format_error):  Likewise.
        * io/write.c (nml_write_obj):  Likewise.

2007-07-29  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR libfortran/32858
        PR libfortran/30814
        * gfortran.dg/pack_bounds_1.f90:  Adjust to new error message.


Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/pack_bounds_1.f90
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/config.h.in
    trunk/libgfortran/configure
    trunk/libgfortran/configure.ac
    trunk/libgfortran/intrinsics/pack_generic.c
    trunk/libgfortran/io/format.c
    trunk/libgfortran/io/list_read.c
    trunk/libgfortran/io/open.c
    trunk/libgfortran/io/transfer.c
    trunk/libgfortran/io/unix.c
    trunk/libgfortran/io/write.c
    trunk/libgfortran/libgfortran.h
    trunk/libgfortran/runtime/error.c
    trunk/libgfortran/runtime/main.c


-- 


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


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

end of thread, other threads:[~2007-07-29 20:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-15 23:58 [Bug fortran/30814] New: non-conforming array sizes in assignment using pack not caught glv at maths dot otago dot ac dot nz
2007-02-16 16:09 ` [Bug fortran/30814] non-conforming array sizes in PACK should raise an error fxcoudert at gcc dot gnu dot org
2007-07-10 19:16 ` tkoenig at gcc dot gnu dot org
2007-07-20 16:44 ` patchapp at dberlin dot org
2007-07-24  5:53 ` tkoenig at gcc dot gnu dot org
2007-07-24 19:25 ` tkoenig at gcc dot gnu dot org
2007-07-29 20:02 ` tkoenig at gcc dot gnu dot 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).