public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14890] New: SCCS version stamps gets optimized away
@ 2004-04-08 13:56 gbruchhaeuser at orga-systems dot com
  2004-04-08 14:18 ` [Bug optimization/14890] " gbruchhaeuser at orga-systems dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gbruchhaeuser at orga-systems dot com @ 2004-04-08 13:56 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug optimization/14890] SCCS version stamps gets optimized away
  2004-04-08 13:56 [Bug optimization/14890] New: SCCS version stamps gets optimized away gbruchhaeuser at orga-systems dot com
@ 2004-04-08 14:18 ` gbruchhaeuser at orga-systems dot com
  2004-04-08 14:40 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gbruchhaeuser at orga-systems dot com @ 2004-04-08 14:18 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug optimization/14890] SCCS version stamps gets optimized away
  2004-04-08 13:56 [Bug optimization/14890] New: SCCS version stamps gets optimized away gbruchhaeuser at orga-systems dot com
  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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-08 14:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-08 14:40 -------
Invalid, use the attribute used like so:
volatile const char main_cc_ID[] __attribute__((used)) = "@(#): main.cc#4";

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug optimization/14890] SCCS version stamps gets optimized away
  2004-04-08 13:56 [Bug optimization/14890] New: SCCS version stamps gets optimized away gbruchhaeuser at orga-systems dot com
  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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-08 14:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-08 14:42 -------
Also the warning has been fix for 3.3.3.

-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug optimization/14890] SCCS version stamps gets optimized away
  2004-04-08 13:56 [Bug optimization/14890] New: SCCS version stamps gets optimized away gbruchhaeuser at orga-systems dot com
                   ` (2 preceding siblings ...)
  2004-04-08 14:42 ` pinskia at gcc dot gnu dot org
@ 2004-04-08 16:44 ` gbruchhaeuser at orga-systems dot com
  3 siblings, 0 replies; 5+ messages in thread
From: gbruchhaeuser at orga-systems dot com @ 2004-04-08 16:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gbruchhaeuser at orga-systems dot com  2004-04-08 16:44 -------
Well, this solution would break source compatibility with Compaqs DEC-C++
compiler which down't know about '__attribute__((used))'. A macro may
workarround this problem but there are still a plenty of source files (3302 in
this project) to change. 

Isn't there any other possibility? Say a command line parameter or so??

-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-08 16:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-08 13:56 [Bug optimization/14890] New: SCCS version stamps gets optimized away gbruchhaeuser at orga-systems dot com
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

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).