New test for PR tree-optimization/44547 - -Wuninitialized reports false warning in nested switch statements.
gcc/testsuite/ChangeLog: * gcc.dg/uninit-pr44547.c: New.
This commit is contained in:
parent
50bb46e4d2
commit
1b229a3050
61
gcc/testsuite/gcc.dg/uninit-pr44547.c
Normal file
61
gcc/testsuite/gcc.dg/uninit-pr44547.c
Normal file
@ -0,0 +1,61 @@
|
||||
/* PR tree-optimization/44547 - -Wuninitialized reports false warning
|
||||
in nested switch statements
|
||||
{ dg-do compile }
|
||||
{ dg-options "-O1 -Wall" } */
|
||||
|
||||
__attribute__ ((noipa)) int test_O1 (int argc)
|
||||
{
|
||||
switch( argc )
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
{
|
||||
int n;
|
||||
switch( argc )
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
n = argc;
|
||||
break;
|
||||
}
|
||||
|
||||
return n;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#pragma GCC optimize ("2")
|
||||
|
||||
__attribute__ ((noipa)) int test_O2 (int argc)
|
||||
{
|
||||
switch( argc )
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
{
|
||||
int n;
|
||||
switch( argc )
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
n = argc;
|
||||
break;
|
||||
}
|
||||
|
||||
return n;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user