public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gbruchhaeuser at orga-systems dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug optimization/14890] New: SCCS version stamps gets optimized away
Date: Thu, 08 Apr 2004 13:56:00 -0000	[thread overview]
Message-ID: <20040408135632.14890.gbruchhaeuser@orga-systems.com> (raw)

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


             reply	other threads:[~2004-04-08 13:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-08 13:56 gbruchhaeuser at orga-systems dot com [this message]
2004-04-08 14:18 ` [Bug optimization/14890] " gbruchhaeuser at orga-systems dot com
2004-04-08 14:40 ` pinskia at gcc dot gnu dot org
2004-04-08 14:42 ` pinskia at gcc dot gnu dot org
2004-04-08 16:44 ` gbruchhaeuser at orga-systems dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040408135632.14890.gbruchhaeuser@orga-systems.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).