optimization/9059: unused arrays not optimized away when followed by external call

stefaandr@hotmail.com stefaandr@hotmail.com
Thu Dec 26 06:56:00 GMT 2002


>Number:         9059
>Category:       optimization
>Synopsis:       unused arrays not optimized away when followed by external call
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 26 06:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     stefaandr@hotmail.com
>Release:        gcc (GCC) 3.4 20021225 (experimental)
>Organization:
>Environment:
intel piii, redhat 8.0
>Description:
attached file says it all, i suppose

stack-variables which are never consumed, should not appear in the assembler output anymore.  they are indeed removed when the variable is no array (or an array of size 1), but they're in case of this source file, even though they go out of scope without ever being used.  
please note that removing the external function call stops this from being triggered.

Reading specs from /tmp/inst/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with:
Thread model: posix
gcc version 3.4 20021225 (experimental)
 /tmp/inst/lib/gcc-lib/i686-pc-linux-gnu/3.4/cc1plus -E -D__GNUG__=3 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=0 -D_GNU_SOURCE test3.cpp -Wall -W -O3 test3.ii
ignoring nonexistent directory "/tmp/inst/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /tmp/inst/include/c++/3.4
 /tmp/inst/include/c++/3.4/i686-pc-linux-gnu
 /tmp/inst/include/c++/3.4/backward
 /usr/local/include
 /tmp/inst/include
 /tmp/inst/lib/gcc-lib/i686-pc-linux-gnu/3.4/include
 /usr/include
End of search list.
 /tmp/inst/lib/gcc-lib/i686-pc-linux-gnu/3.4/cc1plus -fpreprocessed test3.ii -quiet -dumpbase test3.cpp -auxbase-strip test3.s -O3 -Wall -W -version -o test3.s
GNU C++ version 3.4 20021225 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.2 20020903 (Red Hat Linux 8.0 3.2-7).
>How-To-Repeat:
look at the assembler output of the attached source with -O3
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test3.ii"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test3.ii"

IyAxICJ0ZXN0My5jcHAiCiMgMSAiPGJ1aWx0LWluPiIKIyAxICI8Y29tbWFuZCBsaW5lPiIKIyAx
ICJ0ZXN0My5jcHAiCmV4dGVybiB2b2lkIGNhbGwoKTsKCnZvaWQgdGVzdCgpIHsKICAgICAgICBp
bnQgeFs1XTsKICAgICAgICB4WzRdID0gMTIzNDsKfTsKCmludCBtYWluKCkgewogICAgICAgIHRl
c3QoKTsKCiAgICAgICAgY2FsbCgpOwp9Owo=



More information about the Gcc-bugs mailing list