Bug 21349 - Spurious '$' in warning messages
Summary: Spurious '$' in warning messages
Status: RESOLVED DUPLICATE of bug 14329
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-02 23:48 UTC by Ziemowit Laski
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ziemowit Laski 2005-05-02 23:48:22 UTC
Compile the source code pasted below with "-Os -Wuninitialized" using C++.  You should get the 
following warnings:

uninit.cpp: In function 'int foo()':
uninit.cpp:13: warning: 'range$begin' is used uninitialized in this function
uninit.cpp: In function 'int bar()':
uninit.cpp:21: warning: 'range$end' may be used uninitialized in this function

where the '.' has been secretly replaced by '$'.  This used to be a problem with C and ObjC in the past 
also, but appears fixed now.

============ uninit.cpp ==================
/* Contributed by Ziemowit Laski <zlaski@apple.com> */
/* Check that unused warnings triggered by the optimizer contain '.' rather than '$' in them.  */
/* { dg-do compile } */
/* { dg-options "-Os -Wuninitialized" } */

typedef struct Range {
   long begin, end;
} Range;

int foo(void) {
  Range range;

  while(range.begin != 0) { } /* { dg-warning ".range\\.begin. is used uninitialized in this function" } */

  return 0;
}

extern int baz(void);

int bar(void) {
  Range range;  /* { dg-warning ".range\\.end. may be used uninitialized in this function" } */
  
  do {
    if(baz()) range.end = 2;
  }
  while(range.end != 0);
  
  return 0;
}
Comment 1 Andrew Pinski 2005-05-02 23:51:13 UTC
(In reply to comment #0)
> Compile the source code pasted below with "-Os -Wuninitialized" using C++.  You should get the 
> following warnings:
> 
> uninit.cpp: In function 'int foo()':
> uninit.cpp:13: warning: 'range$begin' is used uninitialized in this function
> uninit.cpp: In function 'int bar()':
> uninit.cpp:21: warning: 'range$end' may be used uninitialized in this function
> 
> where the '.' has been secretly replaced by '$'.  This used to be a problem with C and ObjC in the past 
> also, but appears fixed now.

The reason why it is not fixed for the C++ front-end is because no C++ maintainer did what RTH 
requested for this to be fixed, see PR 14329.

Oh and this is a dup of bug 14329.

*** This bug has been marked as a duplicate of 14329 ***