Bug 22539 - Internal compiler error with maximum sized array
Summary: Internal compiler error with maximum sized array
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.2
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2005-07-17 23:09 UTC by Ulf Magnusson
Modified: 2005-11-26 01:38 UTC (History)
1 user (show)

See Also:
Host:
Target: i386-pc-freebsd
Build:
Known to work:
Known to fail: 3.4.0 4.0.0
Last reconfirmed: 2005-07-18 00:01:44


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ulf Magnusson 2005-07-17 23:09:59 UTC
Compiling this:

#define SIZE 2u << 31 - 2

int main() {
    char a[SIZE], b[SIZE];
}

Gives this compilation error:

bigcp.c: In function `main':
bigcp.c:7: error: unrecognizable insn:
(insn/f 34 33 35 (parallel [
            (set (reg/f:SI 7 sp)
                (plus:SI (reg/f:SI 7 sp)
                    (const_int -2147483656 [0xffffffff7ffffff8])))
            (clobber (reg:CC 17 flags))
            (clobber (mem:BLK (scratch) [0 A8]))
        ]) -1 (nil)
    (nil))
bigcp.c:7: internal compiler error: in insn_default_length, at insn-attrtab.c:435

Only the maximum allowed array size gives the error, and at least two objects
must be allocated on stack.
Comment 1 Andrew Pinski 2005-07-18 00:01:44 UTC
Confirmed.  We should be producing a warning/error message for this like we do on PowerPC.
t.c: In function 'main':
t.c:5: warning: stack frame too large
Comment 2 Andrew Pinski 2005-11-26 01:38:21 UTC
This has been fixed now with:
2005-11-09  Eric Botcazou  <ebotcazou@adacore.com>

        * function.c (assign_stack_local_1): Issue an error message if
        the frame size overflows in the signed target arithmetics.
Comment 3 Daniel Franke 2007-05-04 19:02:38 UTC
Subject: Bug 22539

Author: dfranke
Date: Fri May  4 18:02:18 2007
New Revision: 124437

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124437
Log:
gcc/fortran:
2007-05-04  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/22539
	* intrinsic.c (add_subroutines): Added FSEEK.
	* intrinsic.h (gfc_resolve_fseek_sub, gfc_check_fseek_sub): New.
	* iresolve.c (gfc_resolve_fseek_sub): New.
	* check.c (gfc_check_fseek_sub): New.
	* intrinsic.texi (FSEEK): Updated.

gcc/testsuite:
2007-05-01  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/22539
	* gfortran.dg/fseek.f90: New test.

libgfortran:
2007-05-04  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/22539
	* io/intrinsics.c (fseek_sub): New.
	* io/unix.c (fd_fseek): Change logical and physical offsets only
	if seek succeeds.
	* gfortran.map (fseek_sub): New.


Added:
    trunk/gcc/testsuite/gfortran.dg/fseek.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.h
    trunk/gcc/fortran/intrinsic.texi
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/gfortran.map
    trunk/libgfortran/io/intrinsics.c
    trunk/libgfortran/io/unix.c