c/4552: case statement "without range" causes gcc to quickly eat all memory

david@blue-labs.org david@blue-labs.org
Fri Oct 12 01:36:00 GMT 2001


>Number:         4552
>Category:       c
>Synopsis:       case statement "without range" causes gcc to quickly eat all memory
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 12 01:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     David Ford <david@blue-labs.org>
>Release:        /home/gccbuild/gcc_auto_build/install/i686-pc-linux-gnu/lib/gcc-lib/i686-pc-linux-gnu/3.0.2
>Organization:
>Environment:
Linux 2.4.10 with GLIBC 2.2.4
>Description:
a case X ... Y where X and Y have either no range or invalid range, a gcc subprocess has an argv[0] of garbage and that process consumes memory at an alarming rate.

gcc -c -DVERSION=0.2.5 -fpic -g3  -DDEBUG=0 -DSQLPostgres -pipe -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wcast-align  -I/usr/local/pgsql/include -I/usr/local/include startup.c
startup.c: In function `parse_options':
startup.c:298: warning: empty range specified

david    25964  0.0  0.1  1468  488 pts/20   S    Oct06   0:00 gcc -c -DVERSION=0.2.5 -fpic -g3 -DDEBUG=0 -DSQLPostgres -pipe -Wall 
david    25965  0.0 84.9 217824 215608 pts/20 R   Oct06   0:03 A@??A@??A@??A@??A@
david    25966  0.0  0.3  2248  988 pts/20   S    Oct06   0:00 as --traditional-format -Qy -o startup.o -

david    26058  0.0  0.3  1764  784 pts/20   S    Oct06   0:00  |       \_ make startup.o
david    26062  0.0  0.2  1472  548 pts/20   S    Oct06   0:00  |           \_ gcc -c -DVERSION=0.2.5 -fpic -g3 -DDEBUG=0 -DSQLPostg
david    26064  0.0  1.3  6344 3468 pts/20   R    Oct06   0:00  |               \_ /home/gccbuild/gcc_auto_build/install/i686-pc-lin

becomes...

david    26064  0.0 87.6 224312 222372 pts/20 D   Oct06   0:03  |               \_ D@0?D@@?D@P?D@`?D@p?D@??D@??D@??D@??D@??D@??D@??D


 switch (c) ... where c is an unsigned integer.

startup.c:298             case o_ADD_USER ... o_OPTIONMAX:

enum {  o_NONE=0, /*skip the lower 256 bits to allow for single char matches*/ 
        o_ADD_USER=1<<8, o_CHECK_CONFIG=1<<9, o_CONVERT_TO_SQL=1<<10,
        o_CREATE_LIST=1<<11, o_CREATE_TABLES=1<<12, o_HELP=1<<13,
        o_IMPORT_MESSAGE=1<<14, o_INITIALIZE_SQL=1<<15, o_MAINTENANCE=1<<16,   
        o_MAKE_DIGESTS=1<<17, o_VERSION=1<<18, o_LISTNAME=1<<19,
        o_LISTGROUP=1<<20, o_LIST_VALUES=1<<21,
        o_OPTIONMAX=1<<31
};

>How-To-Repeat:
I believe any test case utilizing a bad range will suffice.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list