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]
Other format: [Raw text]

[Bug optimization/14890] New: SCCS version stamps gets optimized away


Say a file called 'main.cc' contains:
---
   volatile const char main_cc_ID[] = "@(#): main.cc#4";
   int main() { return 0; }
---
and it gets compiled like:
   g++ -O0 -o main main.cc

then 'what main' (alternativly 'strings main | grep "(#)"') shows the proper
content of variable 'main_cc_ID'. The problem is that once we compile with '-O1'
then the variable gets optimized away from the binary.

A second issue is that g++ reports a warning if we remove the 'const' from the
declaration and the string remains in the binary also if we compile with '-O2'.

It would be really greate if g++ would keep such 'volatile static const char'
array's in within binary and would not printout a warning although with '-Wall'
for them. Of course, the warning is not the real problem ;-) -but its quite
difficult to grep it away since g++ wraps lines when filename and/or
variablenames get to long.

-- 
           Summary: SCCS version stamps gets optimized away
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gbruchhaeuser at orga-systems dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14890


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