Commit 5e74e93c by Martin Sebor Committed by Martin Sebor

PR middle-end/50476 - Warn of pointer set to object whose lifetime is limited

gcc/testsuite/ChangeLog:
	* gcc.dg/uninit-pr50476.c: New test.

From-SVN: r274135
parent 57771366
2019-08-05 Martin Sebor <msebor@redhat.com> 2019-08-05 Martin Sebor <msebor@redhat.com>
PR middle-end/50476
* gcc.dg/uninit-pr50476.c: New test.
PR c++/60517 PR c++/60517
* g++.dg/pr60517.C: New test. * g++.dg/pr60517.C: New test.
......
/* PR middle-end/50476 - Warn of pointer set to object whose lifetime is limited
{ dg-do compile }
{ dg-options "-O1 -Wall" } */
int *x = 0;
void f (void)
{
int y = 1;
x = &y;
}
int g (void)
{
f ();
return *x; // { dg-warning "\\\[-Wuninitialized" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment