shift-1.C: New test.
* g++.dg/ubsan/shift-1.C: New test. * gcc.dg/ubsan/c-shift-2.c: New test. * c-c++-common/ubsan/shift-5.c: Remove file. From-SVN: r220631
This commit is contained in:
parent
d3f2e41eae
commit
b06479fd41
|
@ -1,3 +1,9 @@
|
|||
2015-02-11 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
* g++.dg/ubsan/shift-1.C: New test.
|
||||
* gcc.dg/ubsan/c-shift-2.c: New test.
|
||||
* c-c++-common/ubsan/shift-5.c: Remove file.
|
||||
|
||||
2015-02-11 Alex Velenko <Alex.Velenko@arm.com>
|
||||
|
||||
* gcc.target/aarch64/atomic-op-consume.c (scan-assember-times):
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-fsanitize=shift -w" } */
|
||||
/* { dg-shouldfail "ubsan" } */
|
||||
|
||||
int
|
||||
foo (int x)
|
||||
{
|
||||
/* None of the following should pass. */
|
||||
switch (x)
|
||||
{
|
||||
case 1 >> -1:
|
||||
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 11 } */
|
||||
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 11 } */
|
||||
case -1 >> -1:
|
||||
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 14 } */
|
||||
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 14 } */
|
||||
case 1 << -1:
|
||||
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 17 } */
|
||||
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 17 } */
|
||||
case -1 << -1:
|
||||
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 20 } */
|
||||
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 20 } */
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bar (int x)
|
||||
{
|
||||
/* None of the following should pass. */
|
||||
switch (x)
|
||||
{
|
||||
case -1 >> 200:
|
||||
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 34 } */
|
||||
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 34 } */
|
||||
case 1 << 200:
|
||||
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 37 } */
|
||||
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 37 } */
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-fsanitize=shift -w" } */
|
||||
/* { dg-shouldfail "ubsan" } */
|
||||
|
||||
int
|
||||
foo (int x)
|
||||
{
|
||||
/* None of the following should pass. */
|
||||
switch (x)
|
||||
{
|
||||
case 1 >> -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
|
||||
case -1 >> -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
|
||||
case 1 << -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
|
||||
case -1 << -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bar (int x)
|
||||
{
|
||||
/* None of the following should pass. */
|
||||
switch (x)
|
||||
{
|
||||
case -1 >> 200: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
|
||||
case 1 << 200: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-fsanitize=shift -w" } */
|
||||
/* { dg-shouldfail "ubsan" } */
|
||||
|
||||
int
|
||||
foo (int x)
|
||||
{
|
||||
/* None of the following should pass. */
|
||||
switch (x)
|
||||
{
|
||||
case 1 >> -1: /* { dg-error "case label does not reduce to an integer constant" } */
|
||||
case -1 >> -1: /* { dg-error "case label does not reduce to an integer constant" } */
|
||||
case 1 << -1: /* { dg-error "case label does not reduce to an integer constant" } */
|
||||
case -1 << -1: /* { dg-error "case label does not reduce to an integer constant" } */
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bar (int x)
|
||||
{
|
||||
/* None of the following should pass. */
|
||||
switch (x)
|
||||
{
|
||||
case -1 >> 200: /* { dg-error "case label does not reduce to an integer constant" } */
|
||||
case 1 << 200: /* { dg-error "case label does not reduce to an integer constant" } */
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue