This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/781: fPIC and exception spec pessimises code



>Number:         781
>Category:       c++
>Synopsis:       fPIC and exception spec pessimises code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 13 01:16:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ralph Loader
>Release:        2.97 (2000-11-06 snapshot), also 2.95.2
>Organization:
>Environment:
Linux
>Description:
If a C++ function has an exception specification, and is 
compiled with -fPIC, then it always generates code to 
compute the GOT address, even when this is not needed.

Doing some printf debugging suggests that the following is
happening:

The compiler generates code to catch exceptions that violate
the exception spec.  This code requires the GOT.  The exception related code may get optimised away, but the 
computation of the GOT remains.
>How-To-Repeat:
Compile the following with g++ -S -O2 -fPIC:

void f()throw(){}

The generated assembler contains instructions to calculate the GOT address; this is dead code.
>Fix:

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]