This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/56231] warning traces have bogus line information when using LTO
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 08 Feb 2013 10:10:14 +0000
- Subject: [Bug middle-end/56231] warning traces have bogus line information when using LTO
- Auto-submitted: auto-generated
- References: <bug-56231-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56231
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-08 10:10:14 UTC ---
Testcase:
t.c:
----
volatile int b;
int foo (int *);
int main ()
{
int a;
b = foo (&a);
return 0;
}
t2.c:
-----
int foo (int *a)
{
return *a;
}
> gcc t.c t2.c -O -Wuninitialized
In file included from t.c:1:0,
from :2:
t.c: In function 'main':
t.c:6:5: warning: 'a' is used uninitialized in this function [-Wuninitialized]
b = foo (&a);
^
In file included from t.c:1:0,
from :2:
t.c:5:7: note: 'a' was declared here
int a;
^
with the last proposed change:
> gcc t.c t2.c -O -Wuninitialized
In file included from t.c:1:0:
t.c: In function 'main':
t.c:6:5: warning: 'a' is used uninitialized in this function [-Wuninitialized]
b = foo (&a);
^
In file included from t.c:1:0:
t.c:5:7: note: 'a' was declared here
int a;
^
that's still odd (the included from thing), but slightly better.
I suppose with LC_LEAVE/LC_ENTER on each file change we see we mess up
the include stack completely anyway. So the question is if we can
suppress printing of the include stack completely from within LTO?
I don't see how we can possibly save the stack without great cost,
as we basically stream locations in random order. The only way to
preserve it is to be able to re-construct (at compile-time where we
still have a single TU) the order in which locations were generated
and stream that info so we can replicate location construction in
exactly the same way (though we might not stream all location transitions).
But I suppose it's not worth all the trouble - the include stack is
only used for late diagnostics.
So - how do we "enter" a toplevel file correctly? It seems that
In file included from t.c:1:0:
t.c:5:7: note: 'a' was declared here
int a;
^
is because of the LC_ENTER? Should we simply not bother about
LC_ENTER/LEAVE at all?