c++/7261: ICE when reporting on passing variable-sized struct to function

richard.myers@praxis-cs.co.uk richard.myers@praxis-cs.co.uk
Wed Jul 10 08:06:00 GMT 2002


>Number:         7261
>Category:       c++
>Synopsis:       ICE when reporting on passing variable-sized struct to function
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-illegal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 10 07:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Richard Myers
>Release:        2.95.3-6 (mingw special)
>Organization:
>Environment:
MinGW on WIndows 2000
>Description:
gcc falls over when reporting the errors with the code shown below. The code declares a variable-sized struct of indeterminate size and then passes it to a function.

Output of gcc -v in attached

C:>gcc error.cpp
error.cpp:10: variable-size type declared outside of any function
error.cpp: In function `int main(int, char **)':
error.cpp:16: Internal compiler error in `find_function_data', at function.c:543

Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>How-To-Repeat:
extern const int x;

typedef struct {
  int  data[x+1];
} Y_t;

extern const int x = 4;

void foo(Y_t y)
{
  y.data[0] = 0;
}

int main(int argc, char **argv)
{
  Y_t  y;

  foo(y);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="gcc-report.txt"
Content-Disposition: inline; filename="gcc-report.txt"

C:>gcc -v -save-temps error.cpp
Reading specs from C:/MinGW/bin/../lib/gcc-lib/mingw32/2.95.3-6/specs
gcc version 2.95.3-6 (mingw special)
 C:\MinGW\bin\..\lib\gcc-lib\mingw32\2.95.3-6\cpp0.exe -lang-c++ -v -iprefix C:\
MinGW\bin/../lib/gcc-lib/mingw32/2.95.3-6/ -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MI
NOR__=95 -D__cplusplus -Di386 -D_WIN32 -DWIN32 -D__WIN32__ -D__MINGW32__=1.0 -D_
_MSVCRT__ -DWINNT -D_X86_=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)
) -D_stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -
D__declspec(x)=__attribute__((x)) -D__i386__ -D_WIN32 -D__WIN32__ -D__WIN32__ -D
__MINGW32__=1.0 -D__MSVCRT__ -D__WINNT__ -D_X86_=1 -D__STDC__=1 -D__stdcall=__at
tribute__((__stdcall__)) -D___stdcall__=__attribute__((__stdcall__)) -D__cdecl=_
_attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386 -D__WIN32
-D__WINNT -D___stdcall=__attribute__((__stdcall__)) -Asystem(winnt) -Acpu(i386)
-Amachine(i386) -D__EXCEPTIONS -remap -Acpu(i386) -Amachine(i386) -Di386 -D__i38
6 -D__i386__ error.cpp error.ii
GNU CPP version 2.95.3-6 (mingw special) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 C:/MinGW/bin/../lib/gcc-lib/mingw32/2.95.3-6/../../../../include/g++-3
 C:/MinGW/bin/../lib/gcc-lib/mingw32/2.95.3-6/../../../../include
 C:/MinGW/bin/../lib/gcc-lib/mingw32/2.95.3-6/../../../../mingw32/include
 C:/MinGW/bin/../lib/gcc-lib/mingw32/2.95.3-6/include
 /mingw/lib/gcc-lib/mingw32/2.95.3-6/../../../../include/g++-3
 /mingw/lib/gcc-lib/mingw32/2.95.3-6/../../../../include
 /mingw/lib/gcc-lib/mingw32/2.95.3-6/../../../../mingw32/include
 /mingw/lib/gcc-lib/mingw32/2.95.3-6/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/local/mingw32/include
End of omitted list.
 C:\MinGW\bin\..\lib\gcc-lib\mingw32\2.95.3-6\cc1plus.exe error.ii -quiet -dumpb
ase error.cc -version -o error.s
GNU C++ version 2.95.3-6 (mingw special) (mingw32) compiled by GNU C version 2.9
5.3-6 (mingw special).
error.cpp:10: variable-size type declared outside of any function
error.cpp: In function `int main(int, char **)':
error.cpp:16: Internal compiler error in `find_function_data', at function.c:543

Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.




More information about the Gcc-bugs mailing list