Bug 39810
Summary: | gcc-c++-2.96-81 inadequate optimization | ||||||
---|---|---|---|---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Omnifarious <hopper> | ||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED RAWHIDE | QA Contact: | David Lawrence <dkl> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 7.0 | Keywords: | FutureFeature | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | i386 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Enhancement | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2001-05-09 10:21:44 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Omnifarious
2001-05-09 06:35:44 UTC
Created attachment 17827 [details]
This is an example C++ source file that compiles with bloated initializers
As for eliminating the static initializers, ATM none of g++ 2.95.x, 2.96-RH, 3.0-branch or 3.1-head do this. It would be probably better if you requested this enhancement on @gnu.org lists (it is too late for 3.0, but for 3.1 it could be doable). As for the jump to test+jump not being optimized out, I'll look at what's going on. It seems that gcc 3.0 and 3.1 behave the same way, have reproduced it on C code as well: int abarney[2]; int afred[1]; void foo(int edx, int eax) { if (eax == 65535) { if (edx == 1) { abarney[0] = 5; abarney[1] = 6; } } if (eax == 65535) { if (--edx == 0) afred[0] = 2; } } Jump threading should be fixed in gcc-2.96-86, likewise it will generate better code for __static_initialization_and_destruction_0 (which even jump threading is not able to cope with). Thanks, in gcc-c++-2.96-88, this is now lots better than it was. :-) I still say the constructors can be done away with completely and the constant initial values moved into the .bss segment, but I imagine that's kind of hard to do. It would solve a major class of problems dealing with order of static intialization though. I wouldn't have to worry about initialization order for many types of global constants. |