* [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
@ 2008-05-07 9:35 ` martin at mpa-garching dot mpg dot de
2008-05-07 9:44 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: martin at mpa-garching dot mpg dot de @ 2008-05-07 9:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from martin at mpa-garching dot mpg dot de 2008-05-07 09:35 -------
Created an attachment (id=15590)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15590&action=view)
a (not really reduced) test case
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
2008-05-07 9:35 ` [Bug c++/36168] " martin at mpa-garching dot mpg dot de
@ 2008-05-07 9:44 ` pinskia at gcc dot gnu dot org
2008-05-07 9:51 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-07 9:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-05-07 09:43 -------
This is a normal issue with the unitialized warnings. See PR 5035. Basically
to get this warning correct for this case, you need conditional PHIs which we
don't have currently. And I don't know of any compiler that does.
Basically the code looks like:
if (a)
set b
for(...)
for(...)
if (a)
use b
Unswitching the loops will help somewhat as then you can then jump thread.
Thanks,
Andrew Pinski
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |24639
nThis| |
Severity|normal |enhancement
Keywords|diagnostic |
Known to fail|4.2.3 4.4.0 |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
2008-05-07 9:35 ` [Bug c++/36168] " martin at mpa-garching dot mpg dot de
2008-05-07 9:44 ` pinskia at gcc dot gnu dot org
@ 2008-05-07 9:51 ` pinskia at gcc dot gnu dot org
2008-05-07 9:52 ` martin at mpa-garching dot mpg dot de
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-07 9:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-05-07 09:51 -------
Also you may as well manually unswitch the loops as they don't do anything
except some multiplication if that bool is true. That is better to write the
code as:
if (a_eq_e)
return;
e=p[m].e;
q=COLOUR8(e.r/(a.r+grayabsorb),e.g/(a.g+grayabsorb),e.b/(a.b+grayabsorb));
float64 radsq = rfacr*rfacr;
float64 prefac1 = -0.5/(r*r*sigma0*sigma0);
float64 prefac2 = -0.5*bfak/p[m].ro;
{
for (int x=minx; x<maxx; ++x)
{
float64 xsq=(x-posx)*(x-posx);
for (int y=miny; y<maxy; ++y)
{
float64 dsq = (y-posy)*(y-posy) + xsq;
if (dsq<radsq)
{
lpic[x][y].r = q.r;
lpic[x][y].g = q.g;
}
}
}
}
As you now have better code as the code is faster as you don't have to go
through those loops at all or even calculate the inner float64s.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
` (2 preceding siblings ...)
2008-05-07 9:51 ` pinskia at gcc dot gnu dot org
@ 2008-05-07 9:52 ` martin at mpa-garching dot mpg dot de
2008-05-07 9:54 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: martin at mpa-garching dot mpg dot de @ 2008-05-07 9:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from martin at mpa-garching dot mpg dot de 2008-05-07 09:51 -------
It would be completely fine by me, if g++ simply emitted bogus warnings in a
consistent way. But the syntax is still confusing, and what seems quite
disconcerting to me is the fact that _both_ warnings disappear if I comment the
line 37214 (lpic[x][y].g = q.g;). Is this also expected behaviour?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
` (3 preceding siblings ...)
2008-05-07 9:52 ` martin at mpa-garching dot mpg dot de
@ 2008-05-07 9:54 ` pinskia at gcc dot gnu dot org
2008-05-07 9:57 ` martin at mpa-garching dot mpg dot de
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-07 9:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2008-05-07 09:54 -------
(In reply to comment #4)
> Is this also expected behavior?
Most likely because SRA choses not to scalarize the aggregate. Aka the
optimizators are choosing different choses based on the code. Nothing new.
-- Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
` (4 preceding siblings ...)
2008-05-07 9:54 ` pinskia at gcc dot gnu dot org
@ 2008-05-07 9:57 ` martin at mpa-garching dot mpg dot de
2008-05-07 10:13 ` manu at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: martin at mpa-garching dot mpg dot de @ 2008-05-07 9:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from martin at mpa-garching dot mpg dot de 2008-05-07 09:57 -------
OK. Thanks for the clarification!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
` (5 preceding siblings ...)
2008-05-07 9:57 ` martin at mpa-garching dot mpg dot de
@ 2008-05-07 10:13 ` manu at gcc dot gnu dot org
2008-08-29 3:53 ` manu at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-05-07 10:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from manu at gcc dot gnu dot org 2008-05-07 10:12 -------
This would be more consistent if uninitialized warnings would work in VOPs.
Anyway, I think we should keep this open as an interesting testcase.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-05-07 10:12:31
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
` (6 preceding siblings ...)
2008-05-07 10:13 ` manu at gcc dot gnu dot org
@ 2008-08-29 3:53 ` manu at gcc dot gnu dot org
2008-12-28 5:13 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-29 3:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from manu at gcc dot gnu dot org 2008-08-29 03:51 -------
Things TODO here:
* Find out if we can get the "original form" of 'q.COLOUR8::r' to print
something closer to the original code.
* What is the difference in SSA after SRA when line 37214 is commented out?
* Perhaps we should never warn about things like this. Can we mark them as
artificial? If not, try setting and preserving TREE_NO_WARNING.
* Does this have to do with compiler-generated EH? If so, this is a duplicate
of another PR I have seen.
* The attached testcase is too big for the testsuite. We would need a smaller
one. Unfortunately, automatically reducing the testcase would probably lead to
a bogus one. So it must be done manually or find an alternative testcase.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
` (7 preceding siblings ...)
2008-08-29 3:53 ` manu at gcc dot gnu dot org
@ 2008-12-28 5:13 ` pinskia at gcc dot gnu dot org
2009-02-09 16:13 ` [Bug c++/36168] bogus uninitialized warning (huge testcase) manu at gcc dot gnu dot org
2009-02-09 16:15 ` manu at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-28 5:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from pinskia at gcc dot gnu dot org 2008-12-28 05:12 -------
>* Find out if we can get the "original form" of 'q.COLOUR8::r' to print
something closer to the original code.
Actually this is a good thing we print out "COLOUR8::" really, sometimes there
are different r's in a class so knowing which one is being used here makes it
easy to understand.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] bogus uninitialized warning (huge testcase)
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
` (8 preceding siblings ...)
2008-12-28 5:13 ` pinskia at gcc dot gnu dot org
@ 2009-02-09 16:13 ` manu at gcc dot gnu dot org
2009-02-09 16:15 ` manu at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-02-09 16:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from manu at gcc dot gnu dot org 2009-02-09 16:13 -------
I cannot reproduce this with current GCC 4.4
Also, the testcase is too big.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
Summary|Incorrect (and strange) |bogus uninitialized warning
|warnings with - |(huge testcase)
|Wuninitialized |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36168] bogus uninitialized warning (huge testcase)
2008-05-07 9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
` (9 preceding siblings ...)
2009-02-09 16:13 ` [Bug c++/36168] bogus uninitialized warning (huge testcase) manu at gcc dot gnu dot org
@ 2009-02-09 16:15 ` manu at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-02-09 16:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from manu at gcc dot gnu dot org 2009-02-09 16:15 -------
Actually, I am going to close it as WORKSFORME, but if you can reproduce this
with a GCC later than revision 143971 (even in this huge testcase), please
reopen. Thanks for the report.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |WORKSFORME
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168
^ permalink raw reply [flat|nested] 12+ messages in thread