* 'SR.1419' is used uninitialized in this function...
@ 2005-01-25 18:04 Benjamin Redelings
2005-01-25 18:08 ` Andrew Pinski
0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Redelings @ 2005-01-25 18:04 UTC (permalink / raw)
To: gcc
Hello,
I'm testing 4.0 snapshot 2005-01-15 by trying to compile my
program. I get error messages like the following a few times:
'SR.1419' is used uninitialized in this function...
I'm guessing that this is an SSA name and should not be reported to the
user. Is this a known bug? Should I file a PR?
-BenRI
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 'SR.1419' is used uninitialized in this function...
2005-01-25 18:04 'SR.1419' is used uninitialized in this function Benjamin Redelings
@ 2005-01-25 18:08 ` Andrew Pinski
2005-01-25 19:11 ` Gabriel Dos Reis
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Pinski @ 2005-01-25 18:08 UTC (permalink / raw)
To: Benjamin Redelings; +Cc: gcc
On Jan 25, 2005, at 12:58 PM, Benjamin Redelings wrote:
> Hello,
>
> I'm testing 4.0 snapshot 2005-01-15 by trying to compile my
> program. I get error messages like the following a few times:
>
> 'SR.1419' is used uninitialized in this function...
>
> I'm guessing that this is an SSA name and should not be reported to
> the user. Is this a known bug? Should I file a PR?
Yes it is known but it is most likely a bug in your code.
The problem is that SR.1419 should really be named
"<<unnamed>>.structmember".
-- Pinski
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 'SR.1419' is used uninitialized in this function...
2005-01-25 18:08 ` Andrew Pinski
@ 2005-01-25 19:11 ` Gabriel Dos Reis
2005-01-25 22:11 ` Benjamin Redelings
0 siblings, 1 reply; 6+ messages in thread
From: Gabriel Dos Reis @ 2005-01-25 19:11 UTC (permalink / raw)
To: Andrew Pinski; +Cc: Benjamin Redelings, gcc
Andrew Pinski <pinskia@physics.uc.edu> writes:
| On Jan 25, 2005, at 12:58 PM, Benjamin Redelings wrote:
|
| > Hello,
| >
| > I'm testing 4.0 snapshot 2005-01-15 by trying to compile my
| > program. I get error messages like the following a few times:
| >
| > 'SR.1419' is used uninitialized in this function...
| >
| > I'm guessing that this is an SSA name and should not be reported to
| > the user. Is this a known bug? Should I file a PR?
|
| Yes it is known but it is most likely a bug in your code.
| The problem is that SR.1419 should really be named
| "<<unnamed>>.structmember".
Not really. I've already filled a PR (which I think you quickly
closed) where SR.xxxx should have been A::i (where A is a base
class). I wanted to fix this by using DECL_ABSTRACT_ORIGIN but RTH
thinks that is not appropriate. Anyhow, we need to put a back
reference to the original tree that was SRAed.
-- Gaby
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 'SR.1419' is used uninitialized in this function...
2005-01-25 19:11 ` Gabriel Dos Reis
@ 2005-01-25 22:11 ` Benjamin Redelings
2005-01-26 0:32 ` Richard Henderson
2005-01-26 14:27 ` Jonathan Wakely
0 siblings, 2 replies; 6+ messages in thread
From: Benjamin Redelings @ 2005-01-25 22:11 UTC (permalink / raw)
Cc: gcc
[-- Attachment #1: Type: text/plain, Size: 1366 bytes --]
Gabriel Dos Reis wrote:
>Andrew Pinski <pinskia@physics.uc.edu> writes:
>
>| On Jan 25, 2005, at 12:58 PM, Benjamin Redelings wrote:
>|
>| > Hello,
>| >
>| > I'm testing 4.0 snapshot 2005-01-15 by trying to compile my
>| > program. I get error messages like the following a few times:
>| >
>| > 'SR.1419' is used uninitialized in this function...
>| >
>| > I'm guessing that this is an SSA name and should not be reported to
>| > the user. Is this a known bug? Should I file a PR?
>|
>| Yes it is known but it is most likely a bug in your code.
>| The problem is that SR.1419 should really be named
>| "<<unnamed>>.structmember".
>
>Not really. I've already filled a PR (which I think you quickly
>closed) where SR.xxxx should have been A::i (where A is a base
>class). I wanted to fix this by using DECL_ABSTRACT_ORIGIN but RTH
>thinks that is not appropriate. Anyhow, we need to put a back
>reference to the original tree that was SRAed.
>
>-- Gaby
>
>
I now have a 30-line test-case (attatched) which triggers two bugs:
a) the structure member has a name, but is not named.
b) the structure member is not actually used, despite the warning.
Ways to make the problem go away include:
a) make a function non-virtual
b) make a function not a template
c) remove the undefined, and supposedly unused variable.
d) turn off all optimization.
-BenRI
[-- Attachment #2: test-SR4.C --]
[-- Type: text/x-c++src, Size: 668 bytes --]
struct branchview;
struct iterator
{
unsigned circuits; // Warning goes away if you remove this line
virtual branchview operator*() const; // Warning goes away if you remove 'virtual'
iterator() {}
};
struct branchview
{
iterator my_iterator() const {return iterator();}
branchview(){}
};
inline branchview iterator::operator*() const {
return branchview();
}
// You have to do this inside a template to get the bug, I think.
template<class iterator_t>
inline void append(const iterator_t& start, branchview& t) {
iterator_t i = start;
t = *i;
}
void iterator_set(const branchview& bv1,branchview& bv2) {
append(bv1.my_iterator(),bv2);
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 'SR.1419' is used uninitialized in this function...
2005-01-25 22:11 ` Benjamin Redelings
@ 2005-01-26 0:32 ` Richard Henderson
2005-01-26 14:27 ` Jonathan Wakely
1 sibling, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2005-01-26 0:32 UTC (permalink / raw)
To: Benjamin Redelings; +Cc: gcc
On Tue, Jan 25, 2005 at 12:48:58PM -0800, Benjamin Redelings wrote:
> struct branchview;
>
> struct iterator
> {
> unsigned circuits; // Warning goes away if you remove this line
>
> virtual branchview operator*() const; // Warning goes away if you remove 'virtual'
>
> iterator() {}
> };
>
> struct branchview
> {
> iterator my_iterator() const {return iterator();}
>
> branchview(){}
> };
>
> inline branchview iterator::operator*() const {
> return branchview();
> }
>
> // You have to do this inside a template to get the bug, I think.
> template<class iterator_t>
> inline void append(const iterator_t& start, branchview& t) {
> iterator_t i = start;
> t = *i;
> }
>
> void iterator_set(const branchview& bv1,branchview& bv2) {
> append(bv1.my_iterator(),bv2);
> }
The result of my_iterator is unnamed, and the element circuits
is indeed uninitialized when it it copied to "i" in append.
Ergo I do not see the warning as actively incorrect, modulo the
name used in the warning text.
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 'SR.1419' is used uninitialized in this function...
2005-01-25 22:11 ` Benjamin Redelings
2005-01-26 0:32 ` Richard Henderson
@ 2005-01-26 14:27 ` Jonathan Wakely
1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Wakely @ 2005-01-26 14:27 UTC (permalink / raw)
To: Benjamin Redelings; +Cc: gcc
On Tue, Jan 25, 2005 at 12:48:58PM -0800, Benjamin Redelings wrote:
> I now have a 30-line test-case (attatched) which triggers two bugs:
> a) the structure member has a name, but is not named.
> b) the structure member is not actually used, despite the warning.
It's used in the compiler-generated copy constructor, which would be
something like this:
iterator(const iterator& other) : circuits(other.circuits) {}
and it is called when branchview::my_iterator returns by value.
> Ways to make the problem go away include:
> a) make a function non-virtual
> b) make a function not a template
> c) remove the undefined, and supposedly unused variable.
> d) turn off all optimization.
Or alternatively, initialise the variable in the constructor:
iterator() : circuits() {}
jon
--
Dull but sincere filler
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-01-26 11:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-25 18:04 'SR.1419' is used uninitialized in this function Benjamin Redelings
2005-01-25 18:08 ` Andrew Pinski
2005-01-25 19:11 ` Gabriel Dos Reis
2005-01-25 22:11 ` Benjamin Redelings
2005-01-26 0:32 ` Richard Henderson
2005-01-26 14:27 ` Jonathan Wakely
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).